subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject svn commit: r1679015 - /subversion/branches/1.9-cache-improvements/subversion/libsvn_subr/cache-membuffer.c
Date Tue, 12 May 2015 17:42:46 GMT
Author: ivan
Date: Tue May 12 17:42:46 2015
New Revision: 1679015

URL: http://svn.apache.org/r1679015
Log:
On the '1.9-cache-improvements' branch: Fix a bug of combining full cache
keys.

* subversion/libsvn_subr/cache-membuffer.c
  (combine_key, combine_long_key): Use CACHE->PREFIX.ENTRY_KEY.KEY_LEN to
   get length of cache prefix instead of PREFIX.FULL_KEY.SIZE which is just
   size of allocated buffer and could be greater.

Modified:
    subversion/branches/1.9-cache-improvements/subversion/libsvn_subr/cache-membuffer.c

Modified: subversion/branches/1.9-cache-improvements/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9-cache-improvements/subversion/libsvn_subr/cache-membuffer.c?rev=1679015&r1=1679014&r2=1679015&view=diff
==============================================================================
--- subversion/branches/1.9-cache-improvements/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/1.9-cache-improvements/subversion/libsvn_subr/cache-membuffer.c Tue
May 12 17:42:46 2015
@@ -2615,7 +2615,7 @@ combine_long_key(svn_membuffer_cache_t *
 {
   apr_uint32_t *digest_buffer;
   char *key_copy;
-  apr_size_t prefix_len = cache->prefix.full_key.size;
+  apr_size_t prefix_len = cache->prefix.entry_key.key_len;
   apr_size_t aligned_key_len;
 
   /* handle variable-length keys */
@@ -2654,13 +2654,13 @@ combine_key(svn_membuffer_cache_t *cache
   /* short, fixed-size keys are the most common case */
   if (key_len != APR_HASH_KEY_STRING && key_len <= 16)
     {
+      const apr_size_t prefix_len = cache->prefix.entry_key.key_len;
       /* Copy of *key, padded with 0.
        * We put it just behind the prefix already copied into the COMBINED_KEY.
        * The buffer space has been allocated when the cache was created. */
-      apr_uint64_t *data = (void *)((char *)cache->combined_key.full_key.data +
-                                    cache->prefix.full_key.size);
-      assert(cache->combined_key.full_key.size >
-             cache->prefix.full_key.size + 16);
+      apr_uint64_t *data = (void *)((char *)cache->combined_key.full_key.data + 
+                                    prefix_len);
+      assert(prefix_len + 16 <= cache->combined_key.full_key.size);
 
       data[0] = 0;
       data[1] = 0;



Mime
View raw message