From: Date: Sun, 24 Feb 2008 21:40:22 +0000 (+0000) Subject: Rewrite of memcached_behavior_set() to take a uint64_t instead of a pointer. X-Git-Tag: _20~1^2~55^2~3^2~4 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=c09ad179bd7c11393db624c4228fae86c2eb1d23;p=m6w6%2Flibmemcached Rewrite of memcached_behavior_set() to take a uint64_t instead of a pointer. --- diff --git a/ChangeLog b/ChangeLog index 46c15ea9..f8596982 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 0.17 * MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT added for connect timeout in non-block mode. + * Incompatible change in memcached_behavior_set() api. We now use a + uint64_t, instead of a pointer. 0.16 Mon Feb 18 00:30:25 PST 2008 * Work on the UDP protocol diff --git a/docs/memcached_behavior.pod b/docs/memcached_behavior.pod index 74a3a732..2268e845 100755 --- a/docs/memcached_behavior.pod +++ b/docs/memcached_behavior.pod @@ -10,14 +10,14 @@ C Client Library for memcached (libmemcached, -lmemcached) #include - unsigned long long + uint64_t memcached_behavior_get (memcached_st *ptr, memcached_behavior flag); memcached_return memcached_behavior_set (memcached_st *ptr, memcached_behavior flag, - void *data); + uint64_t data); =head1 DESCRIPTION @@ -111,6 +111,11 @@ memcached_behavior_get() returns either the current value of the get, or 0 or 1 on simple flag behaviors (1 being enabled). memcached_behavior_set() returns whether or not the behavior was enabled. +=head1 NOTES + +memcached_behavior_set() in version .17 was changed from taking a pointer +to data value, to taking a uin64_t. + =head1 HOME To find out more information please check: diff --git a/include/memcached.h b/include/memcached.h index 419f1949..2e363295 100644 --- a/include/memcached.h +++ b/include/memcached.h @@ -101,7 +101,6 @@ typedef enum { MEMCACHED_BEHAVIOR_POLL_TIMEOUT, MEMCACHED_BEHAVIOR_DISTRIBUTION, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, - MEMCACHED_BEHAVIOR_USER_DATA, MEMCACHED_BEHAVIOR_SORT_HOSTS, MEMCACHED_BEHAVIOR_VERIFY_KEY, MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT, @@ -262,7 +261,7 @@ memcached_return memcached_flush(memcached_st *ptr, time_t expiration); memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbosity); void memcached_quit(memcached_st *ptr); char *memcached_strerror(memcached_st *ptr, memcached_return rc); -memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavior flag, void *data); +memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavior flag, uint64_t data); unsigned long long memcached_behavior_get(memcached_st *ptr, memcached_behavior flag); /* All of the functions for adding data to the server */ diff --git a/lib/memcached_behavior.c b/lib/memcached_behavior.c index 15ee08c9..7c5db61d 100644 --- a/lib/memcached_behavior.c +++ b/lib/memcached_behavior.c @@ -9,24 +9,17 @@ We quit all connections so we can reset the sockets. */ -void set_behavior_flag(memcached_st *ptr, memcached_flags temp_flag, void *data) +void set_behavior_flag(memcached_st *ptr, memcached_flags temp_flag, uint64_t data) { - uint8_t truefalse; - if (data) - truefalse= *(unsigned int *)data; - else - truefalse= 0; - - if (truefalse) ptr->flags|= temp_flag; else - ptr->flags+= temp_flag; + ptr->flags&= ~temp_flag; } memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavior flag, - void *data) + uint64_t data) { switch (flag) { @@ -45,10 +38,10 @@ memcached_return memcached_behavior_set(memcached_st *ptr, memcached_quit(ptr); break; case MEMCACHED_BEHAVIOR_DISTRIBUTION: - ptr->distribution= *(memcached_server_distribution *)(data); + ptr->distribution= (memcached_server_distribution)data; break; case MEMCACHED_BEHAVIOR_HASH: - ptr->hash= *(memcached_hash *)(data); + ptr->hash= (memcached_hash)(data); break; case MEMCACHED_BEHAVIOR_CACHE_LOOKUPS: set_behavior_flag(ptr, MEM_USE_CACHE_LOOKUPS, data); @@ -63,32 +56,29 @@ memcached_return memcached_behavior_set(memcached_st *ptr, case MEMCACHED_BEHAVIOR_SORT_HOSTS: set_behavior_flag(ptr, MEM_USE_SORT_HOSTS, data); break; - case MEMCACHED_BEHAVIOR_USER_DATA: - ptr->user_data= data; - break; case MEMCACHED_BEHAVIOR_POLL_TIMEOUT: { - int32_t timeout= (*((int32_t *)data)); + int32_t timeout= (int32_t)data; ptr->poll_timeout= timeout; break; } case MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT: { - int32_t timeout= (*((int32_t *)data)); + int32_t timeout= (int32_t)data; ptr->connect_timeout= timeout; break; } case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE: { - ptr->send_size= (*((int *)data)); + ptr->send_size= data; memcached_quit(ptr); break; } case MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE: { - ptr->recv_size= (*((int *)data)); + ptr->recv_size= data; memcached_quit(ptr); break; } @@ -99,8 +89,8 @@ memcached_return memcached_behavior_set(memcached_st *ptr, return MEMCACHED_SUCCESS; } -unsigned long long memcached_behavior_get(memcached_st *ptr, - memcached_behavior flag) +uint64_t memcached_behavior_get(memcached_st *ptr, + memcached_behavior flag) { memcached_flags temp_flag= 0; @@ -134,8 +124,6 @@ unsigned long long memcached_behavior_get(memcached_st *ptr, case MEMCACHED_BEHAVIOR_SORT_HOSTS: temp_flag= MEM_USE_SORT_HOSTS; break; - case MEMCACHED_BEHAVIOR_USER_DATA: - return 0; case MEMCACHED_BEHAVIOR_POLL_TIMEOUT: { return (unsigned long long)ptr->poll_timeout; diff --git a/lib/memcached_io.c b/lib/memcached_io.c index 3b5b25af..b9261f3d 100644 --- a/lib/memcached_io.c +++ b/lib/memcached_io.c @@ -119,7 +119,6 @@ ssize_t memcached_io_read(memcached_server_st *ptr, } else { - WATCHPOINT_ASSERT(0); found_eof= 1; break; } diff --git a/src/memslap.c b/src/memslap.c index 899d8b81..72aec28f 100644 --- a/src/memslap.c +++ b/src/memslap.c @@ -150,9 +150,9 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion) { unsigned int value= 1; if (opt_non_blocking_io) - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, value); if (opt_tcp_nodelay) - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, value); } @@ -377,7 +377,7 @@ pairs_st *load_create_data(memcached_st *memc, unsigned int number_of, clone= memcached_clone(NULL, memc); /* We always used non-blocking IO for load since it is faster */ - memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_NO_BLOCK, NULL ); + memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); pairs= pairs_generate(number_of, 400); *actual_loaded= execute_set(clone, pairs, number_of); diff --git a/tests/atomsmasher.c b/tests/atomsmasher.c index c4378877..92b57b9a 100644 --- a/tests/atomsmasher.c +++ b/tests/atomsmasher.c @@ -113,7 +113,7 @@ infinite: memcached_return pre_nonblock(memcached_st *memc) { - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, NULL); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); return MEMCACHED_SUCCESS; } @@ -121,7 +121,7 @@ memcached_return pre_nonblock(memcached_st *memc) memcached_return pre_md5(memcached_st *memc) { memcached_hash value= MEMCACHED_HASH_MD5; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); return MEMCACHED_SUCCESS; } @@ -129,7 +129,7 @@ memcached_return pre_md5(memcached_st *memc) memcached_return pre_hsieh(memcached_st *memc) { memcached_hash value= MEMCACHED_HASH_HSIEH; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); return MEMCACHED_SUCCESS; } @@ -138,7 +138,7 @@ memcached_return enable_consistent(memcached_st *memc) { memcached_server_distribution value= MEMCACHED_DISTRIBUTION_CONSISTENT; memcached_hash hash; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, value); pre_hsieh(memc); value= (memcached_server_distribution)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION); diff --git a/tests/function.c b/tests/function.c index 6bbaa40c..2258757d 100644 --- a/tests/function.c +++ b/tests/function.c @@ -63,12 +63,10 @@ uint8_t server_list_null_test(memcached_st *ptr) uint8_t server_sort_test(memcached_st *ptr) { - unsigned int setting; memcached_server_st *server_list; memcached_return rc; - setting= 1; - memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_SORT_HOSTS, &setting); + memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_SORT_HOSTS, 1); server_list= memcached_server_list_append(NULL, "arg", 0, &rc); assert(server_list); @@ -269,7 +267,7 @@ uint8_t cas2_test(memcached_st *memc) rc= memcached_flush(memc, 0); assert(rc == MEMCACHED_SUCCESS); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, &set); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, set); for (x= 0; x < 3; x++) { @@ -312,7 +310,7 @@ uint8_t cas_test(memcached_st *memc) rc= memcached_flush(memc, 0); assert(rc == MEMCACHED_SUCCESS); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, &set); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, set); rc= memcached_set(memc, key, strlen(key), value, strlen(value), @@ -505,7 +503,7 @@ uint8_t bad_key_test(memcached_st *memc) clone= memcached_clone(NULL, memc); assert(clone); - (void)memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, &set); + (void)memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set); string= memcached_get(clone, key, strlen(key), &string_length, &flags, &rc); @@ -514,7 +512,7 @@ uint8_t bad_key_test(memcached_st *memc) assert(!string); set= 0; - (void)memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, &set); + (void)memcached_behavior_set(clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set); string= memcached_get(clone, key, strlen(key), &string_length, &flags, &rc); assert(rc == MEMCACHED_NOTFOUND); @@ -1124,36 +1122,36 @@ uint8_t behavior_test(memcached_st *memc) unsigned long long value; unsigned int set= 1; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, &set); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, set); value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK); assert(value == 1); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, &set); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, set); value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY); assert(value == 1); set= MEMCACHED_HASH_MD5; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &set); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set); value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH); assert(value == MEMCACHED_HASH_MD5); set= 0; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, &set); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, set); value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK); assert(value == 0); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, &set); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, set); value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY); assert(value == 0); set= MEMCACHED_HASH_DEFAULT; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &set); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set); value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH); assert(value == MEMCACHED_HASH_DEFAULT); set= MEMCACHED_HASH_CRC; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &set); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set); value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH); assert(value == MEMCACHED_HASH_CRC); @@ -1183,8 +1181,8 @@ uint8_t user_supplied_bug1(memcached_st *memc) /* We just keep looking at the same values over and over */ srandom(10); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, &setter); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, &setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter); /* add key */ @@ -1222,13 +1220,13 @@ uint8_t user_supplied_bug2(memcached_st *memc) unsigned long long total; setter= 1; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, &setter); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, &setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter); #ifdef NOT_YET setter = 20 * 1024576; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, &setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, setter); setter = 20 * 1024576; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, &setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, setter); getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE); getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE); @@ -1279,13 +1277,13 @@ uint8_t user_supplied_bug3(memcached_st *memc) size_t key_lengths[KEY_COUNT]; setter= 1; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, &setter); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, &setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter); #ifdef NOT_YET setter = 20 * 1024576; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, &setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, setter); setter = 20 * 1024576; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, &setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, setter); getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE); getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE); #endif @@ -1648,10 +1646,10 @@ uint8_t user_supplied_bug10(memcached_st *memc) memcached_st *mclone= memcached_clone(NULL, memc); int32_t timeout; - memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_NO_BLOCK, &set); - memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_TCP_NODELAY, &set); + memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_NO_BLOCK, set); + memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_TCP_NODELAY, set); timeout= 2; - memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, &timeout); + memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, timeout); value = (char*)malloc(value_length * sizeof(char)); @@ -1689,10 +1687,10 @@ uint8_t user_supplied_bug11(memcached_st *memc) int32_t timeout; memcached_st *mclone= memcached_clone(NULL, memc); - memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_NO_BLOCK, &set); - memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_TCP_NODELAY, &set); + memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_NO_BLOCK, set); + memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_TCP_NODELAY, set); timeout= -1; - memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, &timeout); + memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, timeout); timeout= (int32_t)memcached_behavior_get(mclone, MEMCACHED_BEHAVIOR_POLL_TIMEOUT); @@ -1797,7 +1795,7 @@ uint8_t user_supplied_bug13(memcached_st *memc) uint8_t user_supplied_bug14(memcached_st *memc) { int setter= 1; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, &setter); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter); memcached_return rc; char *key= "foo"; char *value; @@ -2003,7 +2001,7 @@ uint8_t generate_buffer_data(memcached_st *memc) int latch= 0; latch= 1; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, &latch); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, latch); generate_data(memc); return 0; @@ -2120,7 +2118,7 @@ uint8_t delete_buffer_generate(memcached_st *memc) unsigned int x; latch= 1; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, &latch); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, latch); for (x= 0; x < global_count; x++) { @@ -2171,7 +2169,7 @@ uint8_t add_host_test1(memcached_st *memc) memcached_return pre_nonblock(memcached_st *memc) { - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, NULL); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); return MEMCACHED_SUCCESS; } @@ -2179,7 +2177,7 @@ memcached_return pre_nonblock(memcached_st *memc) memcached_return pre_md5(memcached_st *memc) { memcached_hash value= MEMCACHED_HASH_MD5; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); return MEMCACHED_SUCCESS; } @@ -2187,7 +2185,7 @@ memcached_return pre_md5(memcached_st *memc) memcached_return pre_crc(memcached_st *memc) { memcached_hash value= MEMCACHED_HASH_CRC; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); return MEMCACHED_SUCCESS; } @@ -2195,7 +2193,7 @@ memcached_return pre_crc(memcached_st *memc) memcached_return pre_hsieh(memcached_st *memc) { memcached_hash value= MEMCACHED_HASH_HSIEH; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); return MEMCACHED_SUCCESS; } @@ -2203,7 +2201,7 @@ memcached_return pre_hsieh(memcached_st *memc) memcached_return pre_hash_fnv1_64(memcached_st *memc) { memcached_hash value= MEMCACHED_HASH_FNV1_64; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); return MEMCACHED_SUCCESS; } @@ -2211,7 +2209,7 @@ memcached_return pre_hash_fnv1_64(memcached_st *memc) memcached_return pre_hash_fnv1a_64(memcached_st *memc) { memcached_hash value= MEMCACHED_HASH_FNV1A_64; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); return MEMCACHED_SUCCESS; } @@ -2219,7 +2217,7 @@ memcached_return pre_hash_fnv1a_64(memcached_st *memc) memcached_return pre_hash_fnv1_32(memcached_st *memc) { memcached_hash value= MEMCACHED_HASH_FNV1_32; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); return MEMCACHED_SUCCESS; } @@ -2227,7 +2225,7 @@ memcached_return pre_hash_fnv1_32(memcached_st *memc) memcached_return pre_hash_fnv1a_32(memcached_st *memc) { memcached_hash value= MEMCACHED_HASH_FNV1A_32; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); return MEMCACHED_SUCCESS; } @@ -2235,7 +2233,7 @@ memcached_return pre_hash_fnv1a_32(memcached_st *memc) memcached_return pre_hash_ketama(memcached_st *memc) { memcached_hash value= MEMCACHED_HASH_KETAMA; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); return MEMCACHED_SUCCESS; } @@ -2297,7 +2295,7 @@ memcached_return enable_consistent(memcached_st *memc) { memcached_server_distribution value= MEMCACHED_DISTRIBUTION_CONSISTENT; memcached_hash hash; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, &value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, value); pre_hsieh(memc); value= (memcached_server_distribution)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION); @@ -2320,7 +2318,7 @@ memcached_return enable_cas(memcached_st *memc) memc->hosts[0].minor_version >= 2 && memc->hosts[0].micro_version >= 4) { - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, &set); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, set); return MEMCACHED_SUCCESS; } @@ -2375,8 +2373,8 @@ memcached_return pre_udp(memcached_st *memc) memcached_return pre_nodelay(memcached_st *memc) { - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, NULL); - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, NULL); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, 0); return MEMCACHED_SUCCESS; } @@ -2387,7 +2385,7 @@ memcached_return poll_timeout(memcached_st *memc) timeout= 100; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, &timeout); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, timeout); timeout= (int32_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT);