Merge lp:~trond-norbye/libmemcached/misc-fixes into lp:~tangent-org/libmemcached/trunk
- misc-fixes
- Merge into trunk
Proposed by
Trond Norbye
Status: | Merged |
---|---|
Merged at revision: | 918 |
Proposed branch: | lp:~trond-norbye/libmemcached/misc-fixes |
Merge into: | lp:~tangent-org/libmemcached/trunk |
Diff against target: |
1387 lines (+214/-146) 23 files modified
clients/memdump.c (+3/-2) clients/utilities.c (+2/-1) configure.ac (+0/-1) example/memcached_light.c (+4/-4) example/storage.c (+2/-1) libhashkit/crc32.c (+2/-1) libhashkit/fnv.c (+8/-4) libhashkit/jenkins.c (+5/-4) libhashkit/md5.c (+4/-3) libhashkit/murmur.c (+10/-9) libhashkit/one_at_a_time.c (+2/-1) libhashkit/strerror.c (+2/-1) libmemcached/include.am (+1/-1) libmemcached/stats.c (+2/-1) libmemcached/storage.c (+2/-2) libmemcached/strerror.c (+2/-1) libmemcached/util/version.c (+3/-2) libmemcached/verbosity.c (+4/-3) m4/pandora_64bit.m4 (+3/-3) support/libmemcached.pc.in (+1/-1) tests/atomsmasher.c (+17/-12) tests/hashkit_functions.c (+28/-17) tests/mem_functions.c (+107/-71) |
To merge this branch: | bzr merge lp:~trond-norbye/libmemcached/misc-fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Libmemcached-developers | Pending | ||
Review via email: mp+50751@code.launchpad.net |
Commit message
Description of the change
Misc fixes I need in order to build libmemcached on Solaris:
* Sun Studio don't like __attribute_
* We always try to default to 64 bit builds on solaris (even if the system reports that it only supports 32 bit)
* The SASL problem from the mailing list
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'clients/memdump.c' |
2 | --- clients/memdump.c 2010-06-29 06:39:40 +0000 |
3 | +++ clients/memdump.c 2011-02-22 14:04:31 +0000 |
4 | @@ -43,10 +43,11 @@ |
5 | static char *opt_passwd; |
6 | |
7 | /* Print the keys and counter how many were found */ |
8 | -static memcached_return_t key_printer(const memcached_st *ptr __attribute__((unused)), |
9 | +static memcached_return_t key_printer(const memcached_st *ptr, |
10 | const char *key, size_t key_length, |
11 | - void *context __attribute__((unused))) |
12 | + void *context) |
13 | { |
14 | + (void)ptr;(void)context; |
15 | printf("%.*s\n", (uint32_t)key_length, key); |
16 | |
17 | return MEMCACHED_SUCCESS; |
18 | |
19 | === modified file 'clients/utilities.c' |
20 | --- clients/utilities.c 2010-07-28 20:59:36 +0000 |
21 | +++ clients/utilities.c 2011-02-22 14:04:31 +0000 |
22 | @@ -71,9 +71,10 @@ |
23 | |
24 | void help_command(const char *command_name, const char *description, |
25 | const struct option *long_options, |
26 | - memcached_programs_help_st *options __attribute__((unused))) |
27 | + memcached_programs_help_st *options) |
28 | { |
29 | unsigned int x; |
30 | + (void)options; |
31 | |
32 | printf("%s v%u.%u\n\n", command_name, 1U, 0U); |
33 | printf("\t%s\n\n", description); |
34 | |
35 | === modified file 'configure.ac' |
36 | --- configure.ac 2011-02-14 18:35:59 +0000 |
37 | +++ configure.ac 2011-02-22 14:04:31 +0000 |
38 | @@ -79,7 +79,6 @@ |
39 | #define closesocket(a) close(a) |
40 | #define get_socket_errno() errno |
41 | #endif |
42 | - |
43 | #endif |
44 | ]) |
45 | |
46 | |
47 | === modified file 'example/memcached_light.c' |
48 | --- example/memcached_light.c 2010-07-28 18:48:18 +0000 |
49 | +++ example/memcached_light.c 2011-02-22 14:04:31 +0000 |
50 | @@ -287,8 +287,8 @@ |
51 | /** |
52 | * Print out the command we are about to execute |
53 | */ |
54 | -static void pre_execute(const void *cookie __attribute__((unused)), |
55 | - protocol_binary_request_header *header __attribute__((unused))) |
56 | +static void pre_execute(const void *cookie, |
57 | + protocol_binary_request_header *header) |
58 | { |
59 | if (verbose) |
60 | { |
61 | @@ -303,8 +303,8 @@ |
62 | /** |
63 | * Print out the command we just executed |
64 | */ |
65 | -static void post_execute(const void *cookie __attribute__((unused)), |
66 | - protocol_binary_request_header *header __attribute__((unused))) |
67 | +static void post_execute(const void *cookie, |
68 | + protocol_binary_request_header *header) |
69 | { |
70 | if (verbose) |
71 | { |
72 | |
73 | === modified file 'example/storage.c' |
74 | --- example/storage.c 2009-10-05 17:53:47 +0000 |
75 | +++ example/storage.c 2011-02-22 14:04:31 +0000 |
76 | @@ -165,7 +165,8 @@ |
77 | item->cas= ++cas; |
78 | } |
79 | |
80 | -void release_item(struct item* item __attribute__((unused))) |
81 | +void release_item(struct item* item) |
82 | { |
83 | + (void)item; |
84 | /* EMPTY */ |
85 | } |
86 | |
87 | === modified file 'libhashkit/crc32.c' |
88 | --- libhashkit/crc32.c 2010-01-19 23:39:13 +0000 |
89 | +++ libhashkit/crc32.c 2011-02-22 14:04:31 +0000 |
90 | @@ -73,10 +73,11 @@ |
91 | 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, |
92 | }; |
93 | |
94 | -uint32_t hashkit_crc32(const char *key, size_t key_length, void *context __attribute__((unused))) |
95 | +uint32_t hashkit_crc32(const char *key, size_t key_length, void *context) |
96 | { |
97 | uint64_t x; |
98 | uint32_t crc= UINT32_MAX; |
99 | + (void)context; |
100 | |
101 | for (x= 0; x < key_length; x++) |
102 | crc= (crc >> 8) ^ crc32tab[(crc ^ (uint64_t)key[x]) & 0xff]; |
103 | |
104 | === modified file 'libhashkit/fnv.c' |
105 | --- libhashkit/fnv.c 2010-01-19 23:39:13 +0000 |
106 | +++ libhashkit/fnv.c 2011-02-22 14:04:31 +0000 |
107 | @@ -14,10 +14,11 @@ |
108 | static uint32_t FNV_32_INIT= 2166136261UL; |
109 | static uint32_t FNV_32_PRIME= 16777619; |
110 | |
111 | -uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context __attribute__((unused))) |
112 | +uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context) |
113 | { |
114 | /* Thanks to pierre@demartines.com for the pointer */ |
115 | uint64_t hash= FNV_64_INIT; |
116 | + (void)context; |
117 | |
118 | for (size_t x= 0; x < key_length; x++) |
119 | { |
120 | @@ -28,9 +29,10 @@ |
121 | return (uint32_t)hash; |
122 | } |
123 | |
124 | -uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context __attribute__((unused))) |
125 | +uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context) |
126 | { |
127 | uint32_t hash= (uint32_t) FNV_64_INIT; |
128 | + (void)context; |
129 | |
130 | for (size_t x= 0; x < key_length; x++) |
131 | { |
132 | @@ -42,9 +44,10 @@ |
133 | return hash; |
134 | } |
135 | |
136 | -uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context __attribute__((unused))) |
137 | +uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context) |
138 | { |
139 | uint32_t hash= FNV_32_INIT; |
140 | + (void)context; |
141 | |
142 | for (size_t x= 0; x < key_length; x++) |
143 | { |
144 | @@ -56,9 +59,10 @@ |
145 | return hash; |
146 | } |
147 | |
148 | -uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void *context __attribute__((unused))) |
149 | +uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void *context) |
150 | { |
151 | uint32_t hash= FNV_32_INIT; |
152 | + (void)context; |
153 | |
154 | for (size_t x= 0; x < key_length; x++) |
155 | { |
156 | |
157 | === modified file 'libhashkit/jenkins.c' |
158 | --- libhashkit/jenkins.c 2010-01-19 23:39:13 +0000 |
159 | +++ libhashkit/jenkins.c 2011-02-22 14:04:31 +0000 |
160 | @@ -56,10 +56,11 @@ |
161 | In which case, the hash table should have hashsize(10) elements. |
162 | */ |
163 | |
164 | -uint32_t hashkit_jenkins(const char *key, size_t length, void *context __attribute__((unused))) |
165 | +uint32_t hashkit_jenkins(const char *key, size_t length, void *context) |
166 | { |
167 | uint32_t a,b,c; /* internal state */ |
168 | union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ |
169 | + (void)context; |
170 | |
171 | /* Set up the internal state */ |
172 | a = b = c = 0xdeadbeef + ((uint32_t)length) + JENKINS_INITVAL; |
173 | @@ -82,7 +83,7 @@ |
174 | } |
175 | |
176 | /*----------------------------- handle the last (probably partial) block */ |
177 | - /* |
178 | + /* |
179 | * "k[2]&0xffffff" actually reads beyond the end of the string, but |
180 | * then masks off the part it's not allowed to read. Because the |
181 | * string is aligned, the masked-off tail is in the same word as the |
182 | @@ -109,7 +110,7 @@ |
183 | default: return c; |
184 | } |
185 | |
186 | - } |
187 | + } |
188 | else if ((u.i & 0x1) == 0) |
189 | { |
190 | const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ |
191 | @@ -159,7 +160,7 @@ |
192 | default: return c; |
193 | } |
194 | |
195 | - } |
196 | + } |
197 | else |
198 | { /* need to read the key one byte at a time */ |
199 | #endif /* little endian */ |
200 | |
201 | === modified file 'libhashkit/md5.c' |
202 | --- libhashkit/md5.c 2010-01-22 01:16:04 +0000 |
203 | +++ libhashkit/md5.c 2011-02-22 14:04:31 +0000 |
204 | @@ -1,5 +1,5 @@ |
205 | /* |
206 | - This Library has been modified from its original form by |
207 | + This Library has been modified from its original form by |
208 | Brian Aker (brian@tangent.org) |
209 | |
210 | See below for original Copyright. |
211 | @@ -125,7 +125,7 @@ |
212 | } |
213 | |
214 | |
215 | -/* |
216 | +/* |
217 | Just a simple method for getting the signature |
218 | result must be == 16 |
219 | */ |
220 | @@ -352,9 +352,10 @@ |
221 | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); |
222 | } |
223 | |
224 | -uint32_t hashkit_md5(const char *key, size_t key_length, void *context __attribute__((unused))) |
225 | +uint32_t hashkit_md5(const char *key, size_t key_length, void *context) |
226 | { |
227 | unsigned char results[16]; |
228 | + (void)context; |
229 | |
230 | md5_signature((unsigned char*)key, (unsigned int)key_length, results); |
231 | |
232 | |
233 | === modified file 'libhashkit/murmur.c' |
234 | --- libhashkit/murmur.c 2010-01-19 23:39:13 +0000 |
235 | +++ libhashkit/murmur.c 2011-02-22 14:04:31 +0000 |
236 | @@ -1,4 +1,4 @@ |
237 | -/* |
238 | +/* |
239 | "Murmur" hash provided by Austin, tanjent@gmail.com |
240 | http://murmurhash.googlepages.com/ |
241 | |
242 | @@ -17,9 +17,9 @@ |
243 | |
244 | #include "common.h" |
245 | |
246 | -uint32_t hashkit_murmur(const char *key, size_t length, void *context __attribute__((unused))) |
247 | +uint32_t hashkit_murmur(const char *key, size_t length, void *context) |
248 | { |
249 | - /* |
250 | + /* |
251 | 'm' and 'r' are mixing constants generated offline. They're not |
252 | really 'magic', they just happen to work well. |
253 | */ |
254 | @@ -36,16 +36,17 @@ |
255 | // Mix 4 bytes at a time into the hash |
256 | |
257 | const unsigned char * data= (const unsigned char *)key; |
258 | + (void)context; |
259 | |
260 | while(length >= 4) |
261 | { |
262 | unsigned int k = *(unsigned int *)data; |
263 | |
264 | - k *= m; |
265 | - k ^= k >> r; |
266 | - k *= m; |
267 | + k *= m; |
268 | + k ^= k >> r; |
269 | + k *= m; |
270 | |
271 | - h *= m; |
272 | + h *= m; |
273 | h ^= k; |
274 | |
275 | data += 4; |
276 | @@ -63,9 +64,9 @@ |
277 | default: break; |
278 | }; |
279 | |
280 | - /* |
281 | + /* |
282 | Do a few final mixes of the hash to ensure the last few bytes are |
283 | - well-incorporated. |
284 | + well-incorporated. |
285 | */ |
286 | |
287 | h ^= h >> 13; |
288 | |
289 | === modified file 'libhashkit/one_at_a_time.c' |
290 | --- libhashkit/one_at_a_time.c 2010-01-19 23:39:13 +0000 |
291 | +++ libhashkit/one_at_a_time.c 2011-02-22 14:04:31 +0000 |
292 | @@ -13,10 +13,11 @@ |
293 | |
294 | #include "common.h" |
295 | |
296 | -uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void *context __attribute__((unused))) |
297 | +uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void *context) |
298 | { |
299 | const char *ptr= key; |
300 | uint32_t value= 0; |
301 | + (void)context; |
302 | |
303 | while (key_length--) |
304 | { |
305 | |
306 | === modified file 'libhashkit/strerror.c' |
307 | --- libhashkit/strerror.c 2009-12-17 17:28:30 +0000 |
308 | +++ libhashkit/strerror.c 2011-02-22 14:04:31 +0000 |
309 | @@ -8,8 +8,9 @@ |
310 | |
311 | #include "common.h" |
312 | |
313 | -const char *hashkit_strerror(hashkit_st *ptr __attribute__((unused)), hashkit_return_t rc) |
314 | +const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc) |
315 | { |
316 | + (void)ptr; |
317 | switch (rc) |
318 | { |
319 | case HASHKIT_SUCCESS: |
320 | |
321 | === modified file 'libmemcached/include.am' |
322 | --- libmemcached/include.am 2010-12-23 17:52:04 +0000 |
323 | +++ libmemcached/include.am 2011-02-22 14:04:31 +0000 |
324 | @@ -149,7 +149,7 @@ |
325 | endif |
326 | |
327 | if HAVE_SASL |
328 | -libmemcached_libmemcached_la_LDFLAGS+= $(LIBSASL) |
329 | +libmemcached_libmemcached_la_LDFLAGS+= $(LTLIBSASL) $(LTLIBSASL2) |
330 | libmemcached_libmemcached_la_SOURCES += libmemcached/sasl.c |
331 | endif |
332 | |
333 | |
334 | === modified file 'libmemcached/stats.c' |
335 | --- libmemcached/stats.c 2011-02-10 18:43:18 +0000 |
336 | +++ libmemcached/stats.c 2011-02-22 14:04:31 +0000 |
337 | @@ -162,7 +162,8 @@ |
338 | strcmp("reclaimed", key) == 0)) |
339 | { |
340 | WATCHPOINT_STRING(key); |
341 | - return MEMCACHED_UNKNOWN_STAT_KEY; |
342 | + /* return MEMCACHED_UNKNOWN_STAT_KEY; */ |
343 | + return MEMCACHED_SUCCESS; |
344 | } |
345 | |
346 | return MEMCACHED_SUCCESS; |
347 | |
348 | === modified file 'libmemcached/storage.c' |
349 | --- libmemcached/storage.c 2011-02-10 19:14:07 +0000 |
350 | +++ libmemcached/storage.c 2011-02-22 14:04:31 +0000 |
351 | @@ -310,8 +310,8 @@ |
352 | } |
353 | |
354 | memcached_return_t memcached_set_by_key(memcached_st *ptr, |
355 | - const char *master_key __attribute__((unused)), |
356 | - size_t master_key_length __attribute__((unused)), |
357 | + const char *master_key, |
358 | + size_t master_key_length, |
359 | const char *key, size_t key_length, |
360 | const char *value, size_t value_length, |
361 | time_t expiration, |
362 | |
363 | === modified file 'libmemcached/strerror.c' |
364 | --- libmemcached/strerror.c 2010-03-03 10:50:13 +0000 |
365 | +++ libmemcached/strerror.c 2011-02-22 14:04:31 +0000 |
366 | @@ -1,7 +1,8 @@ |
367 | #include "common.h" |
368 | |
369 | -const char *memcached_strerror(memcached_st *ptr __attribute__((unused)), memcached_return_t rc) |
370 | +const char *memcached_strerror(memcached_st *ptr, memcached_return_t rc) |
371 | { |
372 | + (void)ptr; |
373 | switch (rc) |
374 | { |
375 | case MEMCACHED_SUCCESS: |
376 | |
377 | === modified file 'libmemcached/util/version.c' |
378 | --- libmemcached/util/version.c 2011-02-10 23:20:54 +0000 |
379 | +++ libmemcached/util/version.c 2011-02-22 14:04:31 +0000 |
380 | @@ -22,12 +22,13 @@ |
381 | bool truth; |
382 | }; |
383 | |
384 | -static memcached_return_t check_server_version(const memcached_st *ptr __attribute__((unused)), |
385 | +static memcached_return_t check_server_version(const memcached_st *ptr, |
386 | const memcached_server_st *instance, |
387 | void *context) |
388 | { |
389 | /* Do Nothing */ |
390 | struct local_context *check= (struct local_context *)context; |
391 | + (void)ptr; |
392 | |
393 | if (instance->major_version != UINT8_MAX && |
394 | instance->major_version >= check->major_version && |
395 | @@ -42,7 +43,7 @@ |
396 | return MEMCACHED_FAILURE; |
397 | } |
398 | |
399 | -bool libmemcached_util_version_check(memcached_st *memc, |
400 | +bool libmemcached_util_version_check(memcached_st *memc, |
401 | uint8_t major_version, |
402 | uint8_t minor_version, |
403 | uint8_t micro_version) |
404 | |
405 | === modified file 'libmemcached/verbosity.c' |
406 | --- libmemcached/verbosity.c 2011-02-10 18:43:18 +0000 |
407 | +++ libmemcached/verbosity.c 2011-02-22 14:04:31 +0000 |
408 | @@ -1,12 +1,12 @@ |
409 | #include "common.h" |
410 | |
411 | -struct context_st |
412 | +struct context_st |
413 | { |
414 | size_t length; |
415 | const char *buffer; |
416 | }; |
417 | |
418 | -static memcached_return_t _set_verbosity(const memcached_st *ptr __attribute__((unused)), |
419 | +static memcached_return_t _set_verbosity(const memcached_st *ptr, |
420 | const memcached_server_st *server, |
421 | void *context) |
422 | { |
423 | @@ -16,6 +16,7 @@ |
424 | char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; |
425 | |
426 | struct context_st *execute= (struct context_st *)context; |
427 | + (void)ptr; |
428 | |
429 | memc_ptr= memcached_create(&local_memc); |
430 | |
431 | @@ -46,7 +47,7 @@ |
432 | |
433 | char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; |
434 | |
435 | - send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, |
436 | + send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, |
437 | "verbosity %u\r\n", verbosity); |
438 | if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE || send_length < 0) |
439 | return MEMCACHED_WRITE_FAILURE; |
440 | |
441 | === modified file 'm4/pandora_64bit.m4' |
442 | --- m4/pandora_64bit.m4 2010-12-23 19:33:20 +0000 |
443 | +++ m4/pandora_64bit.m4 2011-02-22 14:04:31 +0000 |
444 | @@ -20,9 +20,9 @@ |
445 | [isainfo_b=`${ISAINFO} -b`], |
446 | [isainfo_b="x"]) |
447 | |
448 | - AS_IF([test "$isainfo_b" != "x"],[ |
449 | + AS_IF([test "$isainfo_b" != "x" -a "$isainfo_b" != "32"],[ |
450 | |
451 | - isainfo_k=`${ISAINFO} -k` |
452 | + isainfo_k=`${ISAINFO} -k` |
453 | DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_b}" |
454 | |
455 | AS_IF([test "x$ac_enable_64bit" = "xyes"],[ |
456 | @@ -32,7 +32,7 @@ |
457 | ]) |
458 | |
459 | AS_IF([test "x$libdir" = "x\${exec_prefix}/lib"],[ |
460 | - dnl The user hasn't overridden the default libdir, so we'll |
461 | + dnl The user hasn't overridden the default libdir, so we'll |
462 | dnl the dir suffix to match solaris 32/64-bit policy |
463 | libdir="${libdir}/${isainfo_k}" |
464 | ]) |
465 | |
466 | === modified file 'support/libmemcached.pc.in' |
467 | --- support/libmemcached.pc.in 2008-03-09 01:45:19 +0000 |
468 | +++ support/libmemcached.pc.in 2011-02-22 14:04:31 +0000 |
469 | @@ -6,5 +6,5 @@ |
470 | Name: libmemcached |
471 | Description: libmemcached C library. |
472 | Version: @VERSION@ |
473 | -Libs: -L${libdir} -lmemcached |
474 | +Libs: @LTLIBSASL@ @LTLIBSASL2@ -L${libdir} -lmemcached |
475 | Cflags: -I${includedir} |
476 | |
477 | === modified file 'tests/atomsmasher.c' |
478 | --- tests/atomsmasher.c 2010-06-29 06:49:58 +0000 |
479 | +++ tests/atomsmasher.c 2011-02-22 14:04:31 +0000 |
480 | @@ -43,21 +43,23 @@ |
481 | static char *global_keys[GLOBAL_COUNT]; |
482 | static size_t global_keys_length[GLOBAL_COUNT]; |
483 | |
484 | -static test_return_t cleanup_pairs(memcached_st *memc __attribute__((unused))) |
485 | +static test_return_t cleanup_pairs(memcached_st *memc) |
486 | { |
487 | + (void)memc; |
488 | pairs_free(global_pairs); |
489 | |
490 | return 0; |
491 | } |
492 | |
493 | -static test_return_t generate_pairs(memcached_st *memc __attribute__((unused))) |
494 | +static test_return_t generate_pairs(memcached_st *memc) |
495 | { |
496 | + (void)memc; |
497 | global_pairs= pairs_generate(GLOBAL_COUNT, 400); |
498 | global_count= GLOBAL_COUNT; |
499 | |
500 | for (size_t x= 0; x < global_count; x++) |
501 | { |
502 | - global_keys[x]= global_pairs[x].key; |
503 | + global_keys[x]= global_pairs[x].key; |
504 | global_keys_length[x]= global_pairs[x].key_length; |
505 | } |
506 | |
507 | @@ -97,12 +99,12 @@ |
508 | WATCHPOINT_ERROR(rc); |
509 | WATCHPOINT_ASSERT(rc); |
510 | } |
511 | - } |
512 | + } |
513 | else |
514 | { |
515 | - rc= memcached_set(memc, global_pairs[test_bit].key, |
516 | + rc= memcached_set(memc, global_pairs[test_bit].key, |
517 | global_pairs[test_bit].key_length, |
518 | - global_pairs[test_bit].value, |
519 | + global_pairs[test_bit].value, |
520 | global_pairs[test_bit].value_length, |
521 | 0, 0); |
522 | if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_BUFFERED) |
523 | @@ -126,7 +128,7 @@ |
524 | return TEST_SUCCESS; |
525 | } |
526 | |
527 | -/* |
528 | +/* |
529 | Set the value, then quit to make sure it is flushed. |
530 | Come back in and test that add fails. |
531 | */ |
532 | @@ -139,12 +141,12 @@ |
533 | |
534 | setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK); |
535 | |
536 | - rc= memcached_set(memc, key, strlen(key), |
537 | + rc= memcached_set(memc, key, strlen(key), |
538 | value, strlen(value), |
539 | (time_t)0, (uint32_t)0); |
540 | test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
541 | memcached_quit(memc); |
542 | - rc= memcached_add(memc, key, strlen(key), |
543 | + rc= memcached_add(memc, key, strlen(key), |
544 | value, strlen(value), |
545 | (time_t)0, (uint32_t)0); |
546 | |
547 | @@ -192,8 +194,9 @@ |
548 | memcached_st *clone; |
549 | } benchmark_state; |
550 | |
551 | -static test_return_t memcached_create_benchmark(memcached_st *memc __attribute__((unused))) |
552 | +static test_return_t memcached_create_benchmark(memcached_st *memc) |
553 | { |
554 | + (void)memc; |
555 | benchmark_state.create_init= true; |
556 | |
557 | for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++) |
558 | @@ -222,8 +225,9 @@ |
559 | return TEST_SUCCESS; |
560 | } |
561 | |
562 | -static test_return_t pre_allocate(memcached_st *memc __attribute__((unused))) |
563 | +static test_return_t pre_allocate(memcached_st *memc) |
564 | { |
565 | + (void)memc; |
566 | memset(&benchmark_state, 0, sizeof(benchmark_state)); |
567 | |
568 | benchmark_state.create= (memcached_st *)calloc(BENCHMARK_TEST_LOOP, sizeof(memcached_st)); |
569 | @@ -234,8 +238,9 @@ |
570 | return TEST_SUCCESS; |
571 | } |
572 | |
573 | -static test_return_t post_allocate(memcached_st *memc __attribute__((unused))) |
574 | +static test_return_t post_allocate(memcached_st *memc) |
575 | { |
576 | + (void)memc; |
577 | for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++) |
578 | { |
579 | if (benchmark_state.create_init) |
580 | |
581 | === modified file 'tests/hashkit_functions.c' |
582 | --- tests/hashkit_functions.c 2010-06-29 06:49:58 +0000 |
583 | +++ tests/hashkit_functions.c 2011-02-22 14:04:31 +0000 |
584 | @@ -31,10 +31,11 @@ |
585 | bool _unused; |
586 | }; |
587 | |
588 | -static test_return_t init_test(void *not_used __attribute__((unused))) |
589 | +static test_return_t init_test(void *not_used) |
590 | { |
591 | hashkit_st hashk; |
592 | hashkit_st *hashk_ptr; |
593 | + (void)not_used; |
594 | |
595 | hashk_ptr= hashkit_create(&hashk); |
596 | test_true(hashk_ptr); |
597 | @@ -46,9 +47,10 @@ |
598 | return TEST_SUCCESS; |
599 | } |
600 | |
601 | -static test_return_t allocation_test(void *not_used __attribute__((unused))) |
602 | +static test_return_t allocation_test(void *not_used) |
603 | { |
604 | hashkit_st *hashk_ptr; |
605 | + (void)not_used; |
606 | |
607 | hashk_ptr= hashkit_create(NULL); |
608 | test_true(hashk_ptr); |
609 | @@ -115,10 +117,11 @@ |
610 | return TEST_SUCCESS; |
611 | } |
612 | |
613 | -static test_return_t one_at_a_time_run (hashkit_st *hashk __attribute__((unused))) |
614 | +static test_return_t one_at_a_time_run (hashkit_st *hashk) |
615 | { |
616 | uint32_t x; |
617 | const char **ptr; |
618 | + (void)hashk; |
619 | |
620 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
621 | { |
622 | @@ -131,10 +134,11 @@ |
623 | return TEST_SUCCESS; |
624 | } |
625 | |
626 | -static test_return_t md5_run (hashkit_st *hashk __attribute__((unused))) |
627 | +static test_return_t md5_run (hashkit_st *hashk) |
628 | { |
629 | uint32_t x; |
630 | const char **ptr; |
631 | + (void)hashk; |
632 | |
633 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
634 | { |
635 | @@ -147,10 +151,11 @@ |
636 | return TEST_SUCCESS; |
637 | } |
638 | |
639 | -static test_return_t crc_run (hashkit_st *hashk __attribute__((unused))) |
640 | +static test_return_t crc_run (hashkit_st *hashk) |
641 | { |
642 | uint32_t x; |
643 | const char **ptr; |
644 | + (void)hashk; |
645 | |
646 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
647 | { |
648 | @@ -163,10 +168,11 @@ |
649 | return TEST_SUCCESS; |
650 | } |
651 | |
652 | -static test_return_t fnv1_64_run (hashkit_st *hashk __attribute__((unused))) |
653 | +static test_return_t fnv1_64_run (hashkit_st *hashk) |
654 | { |
655 | uint32_t x; |
656 | const char **ptr; |
657 | + (void)hashk; |
658 | |
659 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
660 | { |
661 | @@ -179,10 +185,11 @@ |
662 | return TEST_SUCCESS; |
663 | } |
664 | |
665 | -static test_return_t fnv1a_64_run (hashkit_st *hashk __attribute__((unused))) |
666 | +static test_return_t fnv1a_64_run (hashkit_st *hashk) |
667 | { |
668 | uint32_t x; |
669 | const char **ptr; |
670 | + (void)hashk; |
671 | |
672 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
673 | { |
674 | @@ -195,11 +202,11 @@ |
675 | return TEST_SUCCESS; |
676 | } |
677 | |
678 | -static test_return_t fnv1_32_run (hashkit_st *hashk __attribute__((unused))) |
679 | +static test_return_t fnv1_32_run (hashkit_st *hashk) |
680 | { |
681 | uint32_t x; |
682 | const char **ptr; |
683 | - |
684 | + (void)hashk; |
685 | |
686 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
687 | { |
688 | @@ -212,10 +219,11 @@ |
689 | return TEST_SUCCESS; |
690 | } |
691 | |
692 | -static test_return_t fnv1a_32_run (hashkit_st *hashk __attribute__((unused))) |
693 | +static test_return_t fnv1a_32_run (hashkit_st *hashk) |
694 | { |
695 | uint32_t x; |
696 | const char **ptr; |
697 | + (void)hashk; |
698 | |
699 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
700 | { |
701 | @@ -228,10 +236,11 @@ |
702 | return TEST_SUCCESS; |
703 | } |
704 | |
705 | -static test_return_t hsieh_run (hashkit_st *hashk __attribute__((unused))) |
706 | +static test_return_t hsieh_run (hashkit_st *hashk) |
707 | { |
708 | uint32_t x; |
709 | const char **ptr; |
710 | + (void)hashk; |
711 | |
712 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
713 | { |
714 | @@ -248,8 +257,10 @@ |
715 | return TEST_SUCCESS; |
716 | } |
717 | |
718 | -static test_return_t murmur_run (hashkit_st *hashk __attribute__((unused))) |
719 | +static test_return_t murmur_run (hashkit_st *hashk) |
720 | { |
721 | + (void)hashk; |
722 | + |
723 | #ifdef WORDS_BIGENDIAN |
724 | return TEST_SKIPPED; |
725 | #else |
726 | @@ -268,11 +279,11 @@ |
727 | #endif |
728 | } |
729 | |
730 | -static test_return_t jenkins_run (hashkit_st *hashk __attribute__((unused))) |
731 | +static test_return_t jenkins_run (hashkit_st *hashk) |
732 | { |
733 | uint32_t x; |
734 | const char **ptr; |
735 | - |
736 | + (void)hashk; |
737 | |
738 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
739 | { |
740 | @@ -309,7 +320,7 @@ |
741 | |
742 | static test_return_t hashkit_set_function_test(hashkit_st *hashk) |
743 | { |
744 | - for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) |
745 | + for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) |
746 | { |
747 | hashkit_return_t rc; |
748 | uint32_t x; |
749 | @@ -415,7 +426,7 @@ |
750 | |
751 | static test_return_t hashkit_set_distribution_function_test(hashkit_st *hashk) |
752 | { |
753 | - for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) |
754 | + for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) |
755 | { |
756 | hashkit_return_t rc; |
757 | |
758 | @@ -447,7 +458,7 @@ |
759 | |
760 | static test_return_t hashkit_get_function_test(hashkit_st *hashk) |
761 | { |
762 | - for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) |
763 | + for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++) |
764 | { |
765 | hashkit_return_t rc; |
766 | |
767 | |
768 | === modified file 'tests/mem_functions.c' |
769 | --- tests/mem_functions.c 2011-02-12 10:33:44 +0000 |
770 | +++ tests/mem_functions.c 2011-02-22 14:04:31 +0000 |
771 | @@ -55,9 +55,10 @@ |
772 | static test_return_t pre_binary(memcached_st *memc); |
773 | |
774 | |
775 | -static test_return_t init_test(memcached_st *not_used __attribute__((unused))) |
776 | +static test_return_t init_test(memcached_st *not_used) |
777 | { |
778 | memcached_st memc; |
779 | + (void)not_used; |
780 | |
781 | (void)memcached_create(&memc); |
782 | memcached_free(&memc); |
783 | @@ -65,10 +66,11 @@ |
784 | return TEST_SUCCESS; |
785 | } |
786 | |
787 | -static test_return_t server_list_null_test(memcached_st *ptr __attribute__((unused))) |
788 | +static test_return_t server_list_null_test(memcached_st *ptr) |
789 | { |
790 | memcached_server_st *server_list; |
791 | memcached_return_t rc; |
792 | + (void)ptr; |
793 | |
794 | server_list= memcached_server_list_append_with_weight(NULL, NULL, 0, 0, NULL); |
795 | test_true(server_list == NULL); |
796 | @@ -85,26 +87,28 @@ |
797 | #define TEST_PORT_COUNT 7 |
798 | in_port_t test_ports[TEST_PORT_COUNT]; |
799 | |
800 | -static memcached_return_t server_display_function(const memcached_st *ptr __attribute__((unused)), |
801 | +static memcached_return_t server_display_function(const memcached_st *ptr, |
802 | const memcached_server_st *server, |
803 | void *context) |
804 | { |
805 | /* Do Nothing */ |
806 | size_t bigger= *((size_t *)(context)); |
807 | + (void)ptr; |
808 | assert(bigger <= memcached_server_port(server)); |
809 | *((size_t *)(context))= memcached_server_port(server); |
810 | |
811 | return MEMCACHED_SUCCESS; |
812 | } |
813 | |
814 | -static memcached_return_t dump_server_information(const memcached_st *ptr __attribute__((unused)), |
815 | +static memcached_return_t dump_server_information(const memcached_st *ptr, |
816 | const memcached_server_st *instance, |
817 | void *context) |
818 | { |
819 | /* Do Nothing */ |
820 | FILE *stream= (FILE *)context; |
821 | + (void)ptr; |
822 | |
823 | - fprintf(stream, "Memcached Server: %s %u Version %u.%u.%u\n", |
824 | + fprintf(stream, "Memcached Server: %s %u Version %u.%u.%u\n", |
825 | memcached_server_name(instance), |
826 | memcached_server_port(instance), |
827 | instance->major_version, |
828 | @@ -114,13 +118,14 @@ |
829 | return MEMCACHED_SUCCESS; |
830 | } |
831 | |
832 | -static test_return_t server_sort_test(memcached_st *ptr __attribute__((unused))) |
833 | +static test_return_t server_sort_test(memcached_st *ptr) |
834 | { |
835 | size_t bigger= 0; /* Prime the value for the test_true in server_display_function */ |
836 | |
837 | memcached_return_t rc; |
838 | memcached_server_fn callbacks[1]; |
839 | memcached_st *local_memc; |
840 | + (void)ptr; |
841 | |
842 | local_memc= memcached_create(NULL); |
843 | test_true(local_memc); |
844 | @@ -146,13 +151,14 @@ |
845 | return TEST_SUCCESS; |
846 | } |
847 | |
848 | -static test_return_t server_sort2_test(memcached_st *ptr __attribute__((unused))) |
849 | +static test_return_t server_sort2_test(memcached_st *ptr) |
850 | { |
851 | size_t bigger= 0; /* Prime the value for the test_true in server_display_function */ |
852 | memcached_return_t rc; |
853 | memcached_server_fn callbacks[1]; |
854 | memcached_st *local_memc; |
855 | memcached_server_instance_st instance; |
856 | + (void)ptr; |
857 | |
858 | local_memc= memcached_create(NULL); |
859 | test_true(local_memc); |
860 | @@ -182,11 +188,13 @@ |
861 | return TEST_SUCCESS; |
862 | } |
863 | |
864 | -static memcached_return_t server_print_callback(const memcached_st *ptr __attribute__((unused)), |
865 | +static memcached_return_t server_print_callback(const memcached_st *ptr, |
866 | const memcached_server_st *server, |
867 | - void *context __attribute__((unused))) |
868 | + void *context) |
869 | { |
870 | (void)server; // Just in case we aren't printing. |
871 | + (void)ptr; |
872 | + (void)context; |
873 | |
874 | #if 0 |
875 | fprintf(stderr, "%s(%d)", memcached_server_name(server), memcached_server_port(server)); |
876 | @@ -195,7 +203,7 @@ |
877 | return MEMCACHED_SUCCESS; |
878 | } |
879 | |
880 | -static test_return_t memcached_server_remove_test(memcached_st *ptr __attribute__((unused))) |
881 | +static test_return_t memcached_server_remove_test(memcached_st *ptr) |
882 | { |
883 | memcached_return_t rc; |
884 | memcached_st local_memc; |
885 | @@ -204,6 +212,7 @@ |
886 | memcached_server_fn callbacks[1]; |
887 | |
888 | const char *server_string= "localhost:4444, localhost:4445, localhost:4446, localhost:4447, localhost, memcache1.memcache.bk.sapo.pt:11211, memcache1.memcache.bk.sapo.pt:11212, memcache1.memcache.bk.sapo.pt:11213, memcache1.memcache.bk.sapo.pt:11214, memcache2.memcache.bk.sapo.pt:11211, memcache2.memcache.bk.sapo.pt:11212, memcache2.memcache.bk.sapo.pt:11213, memcache2.memcache.bk.sapo.pt:11214"; |
889 | + (void)ptr; |
890 | |
891 | memc= memcached_create(&local_memc); |
892 | |
893 | @@ -220,12 +229,13 @@ |
894 | return TEST_SUCCESS; |
895 | } |
896 | |
897 | -static memcached_return_t server_display_unsort_function(const memcached_st *ptr __attribute__((unused)), |
898 | +static memcached_return_t server_display_unsort_function(const memcached_st *ptr, |
899 | const memcached_server_st *server, |
900 | void *context) |
901 | { |
902 | /* Do Nothing */ |
903 | uint32_t x= *((uint32_t *)(context)); |
904 | + (void)ptr; |
905 | |
906 | assert(test_ports[x] == server->port); |
907 | *((uint32_t *)(context))= ++x; |
908 | @@ -233,13 +243,14 @@ |
909 | return MEMCACHED_SUCCESS; |
910 | } |
911 | |
912 | -static test_return_t server_unsort_test(memcached_st *ptr __attribute__((unused))) |
913 | +static test_return_t server_unsort_test(memcached_st *ptr) |
914 | { |
915 | size_t counter= 0; /* Prime the value for the test_true in server_display_function */ |
916 | size_t bigger= 0; /* Prime the value for the test_true in server_display_function */ |
917 | memcached_return_t rc; |
918 | memcached_server_fn callbacks[1]; |
919 | memcached_st *local_memc; |
920 | + (void)ptr; |
921 | |
922 | local_memc= memcached_create(NULL); |
923 | test_true(local_memc); |
924 | @@ -269,8 +280,9 @@ |
925 | return TEST_SUCCESS; |
926 | } |
927 | |
928 | -static test_return_t allocation_test(memcached_st *not_used __attribute__((unused))) |
929 | +static test_return_t allocation_test(memcached_st *not_used) |
930 | { |
931 | + (void)not_used; |
932 | memcached_st *memc; |
933 | memc= memcached_create(NULL); |
934 | test_true(memc); |
935 | @@ -759,10 +771,11 @@ |
936 | return TEST_SUCCESS; |
937 | } |
938 | |
939 | -static memcached_return_t server_function(const memcached_st *ptr __attribute__((unused)), |
940 | - const memcached_server_st *server __attribute__((unused)), |
941 | - void *context __attribute__((unused))) |
942 | +static memcached_return_t server_function(const memcached_st *ptr, |
943 | + const memcached_server_st *server, |
944 | + void *context) |
945 | { |
946 | + (void)ptr; (void)server; (void)context; |
947 | /* Do Nothing */ |
948 | |
949 | return MEMCACHED_SUCCESS; |
950 | @@ -876,12 +889,12 @@ |
951 | } |
952 | |
953 | #define READ_THROUGH_VALUE "set for me" |
954 | -static memcached_return_t read_through_trigger(memcached_st *memc __attribute__((unused)), |
955 | - char *key __attribute__((unused)), |
956 | - size_t key_length __attribute__((unused)), |
957 | +static memcached_return_t read_through_trigger(memcached_st *memc, |
958 | + char *key, |
959 | + size_t key_length, |
960 | memcached_result_st *result) |
961 | { |
962 | - |
963 | + (void)memc;(void)key;(void)key_length; |
964 | return memcached_result_set_value(result, READ_THROUGH_VALUE, strlen(READ_THROUGH_VALUE)); |
965 | } |
966 | |
967 | @@ -924,10 +937,11 @@ |
968 | return TEST_SUCCESS; |
969 | } |
970 | |
971 | -static memcached_return_t delete_trigger(memcached_st *ptr __attribute__((unused)), |
972 | +static memcached_return_t delete_trigger(memcached_st *ptr, |
973 | const char *key, |
974 | - size_t key_length __attribute__((unused))) |
975 | + size_t key_length) |
976 | { |
977 | + (void)ptr;(void)key_length; |
978 | assert(key); |
979 | |
980 | return MEMCACHED_SUCCESS; |
981 | @@ -1575,10 +1589,11 @@ |
982 | } |
983 | |
984 | /* Count the results */ |
985 | -static memcached_return_t callback_counter(const memcached_st *ptr __attribute__((unused)), |
986 | - memcached_result_st *result __attribute__((unused)), |
987 | +static memcached_return_t callback_counter(const memcached_st *ptr, |
988 | + memcached_result_st *result, |
989 | void *context) |
990 | { |
991 | + (void)ptr; (void)result; |
992 | size_t *counter= (size_t *)context; |
993 | |
994 | *counter= *counter + 1; |
995 | @@ -1805,9 +1820,10 @@ |
996 | return TEST_SUCCESS; |
997 | } |
998 | |
999 | -static test_return_t version_string_test(memcached_st *memc __attribute__((unused))) |
1000 | +static test_return_t version_string_test(memcached_st *memc) |
1001 | { |
1002 | const char *version_string; |
1003 | + (void)memc; |
1004 | |
1005 | version_string= memcached_lib_version(); |
1006 | |
1007 | @@ -1875,13 +1891,15 @@ |
1008 | return TEST_SUCCESS; |
1009 | } |
1010 | |
1011 | -static memcached_return_t clone_test_callback(memcached_st *parent __attribute__((unused)), memcached_st *memc_clone __attribute__((unused))) |
1012 | +static memcached_return_t clone_test_callback(memcached_st *parent, memcached_st *memc_clone) |
1013 | { |
1014 | + (void)parent;(void)memc_clone; |
1015 | return MEMCACHED_SUCCESS; |
1016 | } |
1017 | |
1018 | -static memcached_return_t cleanup_test_callback(memcached_st *ptr __attribute__((unused))) |
1019 | +static memcached_return_t cleanup_test_callback(memcached_st *ptr) |
1020 | { |
1021 | + (void)ptr; |
1022 | return MEMCACHED_SUCCESS; |
1023 | } |
1024 | |
1025 | @@ -2407,7 +2425,7 @@ |
1026 | return TEST_SUCCESS; |
1027 | } |
1028 | |
1029 | -static test_return_t user_supplied_bug8(memcached_st *memc __attribute__((unused))) |
1030 | +static test_return_t user_supplied_bug8(memcached_st *memc) |
1031 | { |
1032 | memcached_return_t rc; |
1033 | memcached_st *mine; |
1034 | @@ -2416,6 +2434,7 @@ |
1035 | memcached_server_st *servers; |
1036 | const char *server_list= "memcache1.memcache.bk.sapo.pt:11211, memcache1.memcache.bk.sapo.pt:11212, memcache1.memcache.bk.sapo.pt:11213, memcache1.memcache.bk.sapo.pt:11214, memcache2.memcache.bk.sapo.pt:11211, memcache2.memcache.bk.sapo.pt:11212, memcache2.memcache.bk.sapo.pt:11213, memcache2.memcache.bk.sapo.pt:11214"; |
1037 | |
1038 | + (void)memc; |
1039 | servers= memcached_servers_parse(server_list); |
1040 | test_true(servers); |
1041 | |
1042 | @@ -2960,8 +2979,9 @@ |
1043 | */ |
1044 | |
1045 | /* sighandler_t function that always asserts false */ |
1046 | -static void fail(int unused __attribute__((unused))) |
1047 | +static void fail(int unused) |
1048 | { |
1049 | + (void)unused; |
1050 | assert(0); |
1051 | } |
1052 | |
1053 | @@ -3329,15 +3349,17 @@ |
1054 | return TEST_SUCCESS; |
1055 | } |
1056 | |
1057 | -static test_return_t cleanup_pairs(memcached_st *memc __attribute__((unused))) |
1058 | +static test_return_t cleanup_pairs(memcached_st *memc) |
1059 | { |
1060 | + (void)memc; |
1061 | pairs_free(global_pairs); |
1062 | |
1063 | return TEST_SUCCESS; |
1064 | } |
1065 | |
1066 | -static test_return_t generate_pairs(memcached_st *memc __attribute__((unused))) |
1067 | +static test_return_t generate_pairs(memcached_st *memc) |
1068 | { |
1069 | + (void)memc; |
1070 | global_pairs= pairs_generate(GLOBAL_COUNT, 400); |
1071 | global_count= GLOBAL_COUNT; |
1072 | |
1073 | @@ -3350,8 +3372,9 @@ |
1074 | return TEST_SUCCESS; |
1075 | } |
1076 | |
1077 | -static test_return_t generate_large_pairs(memcached_st *memc __attribute__((unused))) |
1078 | +static test_return_t generate_large_pairs(memcached_st *memc) |
1079 | { |
1080 | + (void)memc; |
1081 | global_pairs= pairs_generate(GLOBAL2_COUNT, MEMCACHED_MAX_BUFFER+10); |
1082 | global_count= GLOBAL2_COUNT; |
1083 | |
1084 | @@ -3851,9 +3874,10 @@ |
1085 | } |
1086 | |
1087 | |
1088 | -static void my_free(const memcached_st *ptr __attribute__((unused)), void *mem, void *context) |
1089 | +static void my_free(const memcached_st *ptr, void *mem, void *context) |
1090 | { |
1091 | - (void) context; |
1092 | + (void)context; |
1093 | + (void)ptr; |
1094 | #ifdef HARD_MALLOC_TESTS |
1095 | void *real_ptr= (mem == NULL) ? mem : (void*)((caddr_t)mem - 8); |
1096 | free(real_ptr); |
1097 | @@ -3863,9 +3887,10 @@ |
1098 | } |
1099 | |
1100 | |
1101 | -static void *my_malloc(const memcached_st *ptr __attribute__((unused)), const size_t size, void *context) |
1102 | +static void *my_malloc(const memcached_st *ptr, const size_t size, void *context) |
1103 | { |
1104 | (void)context; |
1105 | + (void)ptr; |
1106 | #ifdef HARD_MALLOC_TESTS |
1107 | void *ret= malloc(size + 8); |
1108 | if (ret != NULL) |
1109 | @@ -3885,7 +3910,7 @@ |
1110 | } |
1111 | |
1112 | |
1113 | -static void *my_realloc(const memcached_st *ptr __attribute__((unused)), void *mem, const size_t size, void *context) |
1114 | +static void *my_realloc(const memcached_st *ptr, void *mem, const size_t size, void *context) |
1115 | { |
1116 | (void)context; |
1117 | #ifdef HARD_MALLOC_TESTS |
1118 | @@ -3900,12 +3925,13 @@ |
1119 | |
1120 | return ret; |
1121 | #else |
1122 | + (void)ptr; |
1123 | return realloc(mem, size); |
1124 | #endif |
1125 | } |
1126 | |
1127 | |
1128 | -static void *my_calloc(const memcached_st *ptr __attribute__((unused)), size_t nelem, const size_t size, void *context) |
1129 | +static void *my_calloc(const memcached_st *ptr, size_t nelem, const size_t size, void *context) |
1130 | { |
1131 | (void)context; |
1132 | #ifdef HARD_MALLOC_TESTS |
1133 | @@ -3917,6 +3943,7 @@ |
1134 | |
1135 | return mem; |
1136 | #else |
1137 | + (void)ptr; |
1138 | return calloc(nelem, size); |
1139 | #endif |
1140 | } |
1141 | @@ -4343,11 +4370,12 @@ |
1142 | } |
1143 | |
1144 | /* Count the objects */ |
1145 | -static memcached_return_t callback_dump_counter(const memcached_st *ptr __attribute__((unused)), |
1146 | - const char *key __attribute__((unused)), |
1147 | - size_t key_length __attribute__((unused)), |
1148 | +static memcached_return_t callback_dump_counter(const memcached_st *ptr, |
1149 | + const char *key, |
1150 | + size_t key_length, |
1151 | void *context) |
1152 | { |
1153 | + (void)ptr; (void)key; (void)key_length; |
1154 | size_t *counter= (size_t *)context; |
1155 | |
1156 | *counter= *counter + 1; |
1157 | @@ -4831,10 +4859,11 @@ |
1158 | return TEST_SUCCESS; |
1159 | } |
1160 | |
1161 | -static test_return_t one_at_a_time_run (memcached_st *memc __attribute__((unused))) |
1162 | +static test_return_t one_at_a_time_run (memcached_st *memc) |
1163 | { |
1164 | uint32_t x; |
1165 | const char **ptr; |
1166 | + (void)memc; |
1167 | |
1168 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
1169 | { |
1170 | @@ -4847,10 +4876,11 @@ |
1171 | return TEST_SUCCESS; |
1172 | } |
1173 | |
1174 | -static test_return_t md5_run (memcached_st *memc __attribute__((unused))) |
1175 | +static test_return_t md5_run (memcached_st *memc) |
1176 | { |
1177 | uint32_t x; |
1178 | const char **ptr; |
1179 | + (void)memc; |
1180 | |
1181 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
1182 | { |
1183 | @@ -4863,10 +4893,11 @@ |
1184 | return TEST_SUCCESS; |
1185 | } |
1186 | |
1187 | -static test_return_t crc_run (memcached_st *memc __attribute__((unused))) |
1188 | +static test_return_t crc_run (memcached_st *memc) |
1189 | { |
1190 | uint32_t x; |
1191 | const char **ptr; |
1192 | + (void)memc; |
1193 | |
1194 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
1195 | { |
1196 | @@ -4879,10 +4910,11 @@ |
1197 | return TEST_SUCCESS; |
1198 | } |
1199 | |
1200 | -static test_return_t fnv1_64_run (memcached_st *memc __attribute__((unused))) |
1201 | +static test_return_t fnv1_64_run (memcached_st *memc) |
1202 | { |
1203 | uint32_t x; |
1204 | const char **ptr; |
1205 | + (void)memc; |
1206 | |
1207 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
1208 | { |
1209 | @@ -4895,10 +4927,11 @@ |
1210 | return TEST_SUCCESS; |
1211 | } |
1212 | |
1213 | -static test_return_t fnv1a_64_run (memcached_st *memc __attribute__((unused))) |
1214 | +static test_return_t fnv1a_64_run (memcached_st *memc) |
1215 | { |
1216 | uint32_t x; |
1217 | const char **ptr; |
1218 | + (void)memc; |
1219 | |
1220 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
1221 | { |
1222 | @@ -4911,11 +4944,11 @@ |
1223 | return TEST_SUCCESS; |
1224 | } |
1225 | |
1226 | -static test_return_t fnv1_32_run (memcached_st *memc __attribute__((unused))) |
1227 | +static test_return_t fnv1_32_run (memcached_st *memc) |
1228 | { |
1229 | uint32_t x; |
1230 | const char **ptr; |
1231 | - |
1232 | + (void)memc; |
1233 | |
1234 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
1235 | { |
1236 | @@ -4928,10 +4961,11 @@ |
1237 | return TEST_SUCCESS; |
1238 | } |
1239 | |
1240 | -static test_return_t fnv1a_32_run (memcached_st *memc __attribute__((unused))) |
1241 | +static test_return_t fnv1a_32_run (memcached_st *memc) |
1242 | { |
1243 | uint32_t x; |
1244 | const char **ptr; |
1245 | + (void)memc; |
1246 | |
1247 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
1248 | { |
1249 | @@ -4944,10 +4978,11 @@ |
1250 | return TEST_SUCCESS; |
1251 | } |
1252 | |
1253 | -static test_return_t hsieh_run (memcached_st *memc __attribute__((unused))) |
1254 | +static test_return_t hsieh_run (memcached_st *memc) |
1255 | { |
1256 | uint32_t x; |
1257 | const char **ptr; |
1258 | + (void)memc; |
1259 | |
1260 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
1261 | { |
1262 | @@ -4960,13 +4995,14 @@ |
1263 | return TEST_SUCCESS; |
1264 | } |
1265 | |
1266 | -static test_return_t murmur_run (memcached_st *memc __attribute__((unused))) |
1267 | +static test_return_t murmur_run (memcached_st *memc) |
1268 | { |
1269 | #ifdef WORDS_BIGENDIAN |
1270 | return TEST_SKIPPED; |
1271 | #else |
1272 | uint32_t x; |
1273 | const char **ptr; |
1274 | + (void)memc; |
1275 | |
1276 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
1277 | { |
1278 | @@ -4980,11 +5016,11 @@ |
1279 | #endif |
1280 | } |
1281 | |
1282 | -static test_return_t jenkins_run (memcached_st *memc __attribute__((unused))) |
1283 | +static test_return_t jenkins_run (memcached_st *memc) |
1284 | { |
1285 | uint32_t x; |
1286 | const char **ptr; |
1287 | - |
1288 | + (void)memc; |
1289 | |
1290 | for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
1291 | { |
1292 | @@ -5079,9 +5115,9 @@ |
1293 | } |
1294 | |
1295 | /* |
1296 | - Test case adapted from John Gorman <johngorman2@gmail.com> |
1297 | + Test case adapted from John Gorman <johngorman2@gmail.com> |
1298 | |
1299 | - We are testing the error condition when we connect to a server via memcached_get() |
1300 | + We are testing the error condition when we connect to a server via memcached_get() |
1301 | but find that the server is not available. |
1302 | */ |
1303 | static test_return_t memcached_get_MEMCACHED_ERRNO(memcached_st *memc) |
1304 | @@ -5114,7 +5150,7 @@ |
1305 | return TEST_SUCCESS; |
1306 | } |
1307 | |
1308 | -/* |
1309 | +/* |
1310 | We connect to a server which exists, but search for a key that does not exist. |
1311 | */ |
1312 | static test_return_t memcached_get_MEMCACHED_NOTFOUND(memcached_st *memc) |
1313 | @@ -5136,9 +5172,9 @@ |
1314 | } |
1315 | |
1316 | /* |
1317 | - Test case adapted from John Gorman <johngorman2@gmail.com> |
1318 | + Test case adapted from John Gorman <johngorman2@gmail.com> |
1319 | |
1320 | - We are testing the error condition when we connect to a server via memcached_get_by_key() |
1321 | + We are testing the error condition when we connect to a server via memcached_get_by_key() |
1322 | but find that the server is not available. |
1323 | */ |
1324 | static test_return_t memcached_get_by_key_MEMCACHED_ERRNO(memcached_st *memc) |
1325 | @@ -5171,7 +5207,7 @@ |
1326 | return TEST_SUCCESS; |
1327 | } |
1328 | |
1329 | -/* |
1330 | +/* |
1331 | We connect to a server which exists, but search for a key that does not exist. |
1332 | */ |
1333 | static test_return_t memcached_get_by_key_MEMCACHED_NOTFOUND(memcached_st *memc) |
1334 | @@ -5625,16 +5661,16 @@ |
1335 | |
1336 | static test_return_t regression_bug_463297(memcached_st *memc) |
1337 | { |
1338 | - memcached_st *memc_clone= memcached_clone(NULL, memc); |
1339 | - test_true(memc_clone != NULL); |
1340 | - test_true(memcached_version(memc_clone) == MEMCACHED_SUCCESS); |
1341 | - |
1342 | - memcached_server_instance_st instance= |
1343 | - memcached_server_instance_by_position(memc_clone, 0); |
1344 | - |
1345 | - if (instance->major_version > 1 || |
1346 | - (instance->major_version == 1 && |
1347 | - instance->minor_version > 2)) |
1348 | + memcached_st *memc_clone= memcached_clone(NULL, memc); |
1349 | + test_true(memc_clone != NULL); |
1350 | + test_true(memcached_version(memc_clone) == MEMCACHED_SUCCESS); |
1351 | + |
1352 | + memcached_server_instance_st instance= |
1353 | + memcached_server_instance_by_position(memc_clone, 0); |
1354 | + |
1355 | + if (instance->major_version > 1 || |
1356 | + (instance->major_version == 1 && |
1357 | + instance->minor_version > 2)) |
1358 | { |
1359 | /* Binary protocol doesn't support deferred delete */ |
1360 | memcached_st *bin_clone= memcached_clone(NULL, memc); |
1361 | @@ -5653,7 +5689,7 @@ |
1362 | memcached_return_t rc= memcached_delete(memc, "foo", 3, 1); |
1363 | |
1364 | /* but there is a bug in some of the memcached servers (1.4) that treats |
1365 | - * the counter as noreply so it doesn't send the proper error message |
1366 | + * the counter as noreply so it doesn't send the proper error message |
1367 | */ |
1368 | test_true_got(rc == MEMCACHED_PROTOCOL_ERROR || rc == MEMCACHED_NOTFOUND || rc == MEMCACHED_CLIENT_ERROR || rc == MEMCACHED_INVALID_ARGUMENTS, memcached_strerror(NULL, rc)); |
1369 | |
1370 | @@ -6049,7 +6085,7 @@ |
1371 | return TEST_SKIPPED; |
1372 | } |
1373 | |
1374 | - for (uint32_t x= 0; x < TEST_CONSTANT_CREATION; x++) |
1375 | + for (uint32_t x= 0; x < TEST_CONSTANT_CREATION; x++) |
1376 | { |
1377 | memcached_st* mc= memcached_create(NULL); |
1378 | memcached_return rc; |
1379 | @@ -6079,7 +6115,7 @@ |
1380 | |
1381 | if (rc == MEMCACHED_SUCCESS) |
1382 | { |
1383 | - if (x > 0) |
1384 | + if (x > 0) |
1385 | { |
1386 | size_t get_value_len; |
1387 | char *get_value; |