Merge
[m6w6/libmemcached] / tests / mem_functions.c
index 263119d6194887ead789a9b7db5c2b102629f20f..68d40d921482bdde66576f924b891a9e5f262eea 100644 (file)
@@ -4796,7 +4796,8 @@ static test_return_t memcached_get_hashkit_test (memcached_st *memc)
 {
   uint32_t x;
   const char **ptr;
-  hashkit_st *kit;
+  const hashkit_st *kit;
+  hashkit_st new_kit;
   hashkit_return_t hash_rc;
 
   uint32_t md5_hosts[]= {4U, 1U, 0U, 1U, 4U, 2U, 0U, 3U, 0U, 0U, 3U, 1U, 0U, 0U, 1U, 3U, 0U, 0U, 0U, 3U, 1U, 0U, 4U, 4U, 3U};
@@ -4804,9 +4805,12 @@ static test_return_t memcached_get_hashkit_test (memcached_st *memc)
 
   kit= memcached_get_hashkit(memc);
 
-  hash_rc= hashkit_set_custom_function(kit, hash_md5_test_function, NULL);
+  hashkit_clone(&new_kit, kit);
+  hash_rc= hashkit_set_custom_function(&new_kit, hash_md5_test_function, NULL);
   test_true(hash_rc == HASHKIT_SUCCESS);
 
+  memcached_set_hashkit(memc, &new_kit);
+
   /*
     Verify Setting the hash.
   */
@@ -4830,9 +4834,11 @@ static test_return_t memcached_get_hashkit_test (memcached_st *memc)
     test_true(md5_hosts[x] == hash_val);
   }
 
-  hash_rc= hashkit_set_custom_function(kit, hash_crc_test_function, NULL);
+  hash_rc= hashkit_set_custom_function(&new_kit, hash_crc_test_function, NULL);
   test_true(hash_rc == HASHKIT_SUCCESS);
 
+  memcached_set_hashkit(memc, &new_kit);
+
   /*
     Verify Setting the hash.
   */