Merge lp:~mordred/libmemcached/write-strings into lp:~tangent-org/libmemcached/trunk
- write-strings
- Merge into trunk
Proposed by
Monty Taylor
Status: | Superseded |
---|---|
Proposed branch: | lp:~mordred/libmemcached/write-strings |
Merge into: | lp:~tangent-org/libmemcached/trunk |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~mordred/libmemcached/write-strings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Libmemcached-developers | Pending | ||
Review via email: mp+8482@code.launchpad.net |
This proposal has been superseded by a proposal from 2009-07-11.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Monty Taylor (mordred) wrote : | # |
- 557. By Monty Taylor
-
pandora-build v0.10
- 558. By Monty Taylor
-
Merged from myself.
- 559. By Monty Taylor
-
Merged from Padraig.
- 560. By Monty Taylor
-
Merged in a lost patch.
- 561. By Monty Taylor
-
pandora-build v0.20
Turned off inllargeuse warning in sun studio - 562. By Monty Taylor
-
Added macro files I missed earlier...
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'clients/memcp.c' |
2 | --- clients/memcp.c 2009-06-15 13:03:47 +0000 |
3 | +++ clients/memcp.c 2009-07-08 13:38:34 +0000 |
4 | @@ -91,7 +91,7 @@ |
5 | |
6 | if (opt_verbose) |
7 | { |
8 | - static char *opstr[] = { "set", "add", "replace" }; |
9 | + static const char *opstr[] = { "set", "add", "replace" }; |
10 | printf("op: %s\nsource file: %s\nlength: %zu\n" |
11 | "key: %s\nflags: %x\nexpires: %llu\n", |
12 | opstr[opt_method - OPT_SET], argv[optind], (size_t)sbuf.st_size, |
13 | |
14 | === modified file 'clients/utilities.c' |
15 | --- clients/utilities.c 2009-06-15 13:03:47 +0000 |
16 | +++ clients/utilities.c 2009-07-08 13:38:34 +0000 |
17 | @@ -16,13 +16,13 @@ |
18 | return s + us; |
19 | } |
20 | |
21 | -void version_command(char *command_name) |
22 | +void version_command(const char *command_name) |
23 | { |
24 | printf("%s v%u.%u\n", command_name, 1, 0); |
25 | exit(0); |
26 | } |
27 | |
28 | -static char *lookup_help(memcached_options option) |
29 | +static const char *lookup_help(memcached_options option) |
30 | { |
31 | switch (option) |
32 | { |
33 | @@ -54,7 +54,7 @@ |
34 | return "forgot to document this function :)"; |
35 | } |
36 | |
37 | -void help_command(char *command_name, char *description, |
38 | +void help_command(const char *command_name, const char *description, |
39 | const struct option *long_options, |
40 | memcached_programs_help_st *options __attribute__((unused))) |
41 | { |
42 | @@ -66,7 +66,7 @@ |
43 | |
44 | for (x= 0; long_options[x].name; x++) |
45 | { |
46 | - char *help_message; |
47 | + const char *help_message; |
48 | |
49 | printf("\t --%s%c\n", long_options[x].name, |
50 | long_options[x].has_arg ? '=' : ' '); |
51 | |
52 | === modified file 'clients/utilities.h' |
53 | --- clients/utilities.h 2008-04-20 22:49:37 +0000 |
54 | +++ clients/utilities.h 2009-07-08 13:38:34 +0000 |
55 | @@ -23,8 +23,8 @@ |
56 | char *strdup_cleanup(const char *str); |
57 | void cleanup(void); |
58 | long int timedif(struct timeval a, struct timeval b); |
59 | -void version_command(char *command_name); |
60 | -void help_command(char *command_name, char *description, |
61 | +void version_command(const char *command_name); |
62 | +void help_command(const char *command_name, const char *description, |
63 | const struct option *long_options, |
64 | memcached_programs_help_st *options); |
65 | void process_hash_option(memcached_st *memc, char *opt_hash); |
66 | |
67 | === modified file 'libmemcached/common.h' |
68 | --- libmemcached/common.h 2009-07-06 17:20:04 +0000 |
69 | +++ libmemcached/common.h 2009-07-08 13:38:34 +0000 |
70 | @@ -135,7 +135,7 @@ |
71 | void server_list_free(memcached_st *ptr, memcached_server_st *servers); |
72 | |
73 | LIBMEMCACHED_LOCAL |
74 | -memcached_return memcached_key_test(char **keys, size_t *key_length, |
75 | +memcached_return memcached_key_test(const char **keys, size_t *key_length, |
76 | unsigned int number_of_keys); |
77 | |
78 | |
79 | |
80 | === modified file 'libmemcached/memcached.h' |
81 | --- libmemcached/memcached.h 2009-07-06 17:20:04 +0000 |
82 | +++ libmemcached/memcached.h 2009-07-08 13:38:34 +0000 |
83 | @@ -172,7 +172,7 @@ |
84 | LIBMEMCACHED_API |
85 | void memcached_quit(memcached_st *ptr); |
86 | LIBMEMCACHED_API |
87 | -char *memcached_strerror(memcached_st *ptr, memcached_return rc); |
88 | +const char *memcached_strerror(memcached_st *ptr, memcached_return rc); |
89 | LIBMEMCACHED_API |
90 | memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavior flag, uint64_t data); |
91 | LIBMEMCACHED_API |
92 | |
93 | === modified file 'libmemcached/memcached.hh' |
94 | --- libmemcached/memcached.hh 2009-07-07 21:57:24 +0000 |
95 | +++ libmemcached/memcached.hh 2009-07-08 13:38:34 +0000 |
96 | @@ -46,7 +46,7 @@ |
97 | value_length, &flags, &rc); |
98 | } |
99 | |
100 | - memcached_return mget(char **keys, size_t *key_length, |
101 | + memcached_return mget(const char **keys, size_t *key_length, |
102 | unsigned int number_of_keys) |
103 | { |
104 | |
105 | |
106 | === modified file 'libmemcached/memcached_auto.c' |
107 | --- libmemcached/memcached_auto.c 2009-06-15 13:03:47 +0000 |
108 | +++ libmemcached/memcached_auto.c 2009-07-08 13:38:34 +0000 |
109 | @@ -15,7 +15,7 @@ |
110 | unlikely (ptr->hosts == NULL || ptr->number_of_hosts == 0) |
111 | return MEMCACHED_NO_SERVERS; |
112 | |
113 | - if ((ptr->flags & MEM_VERIFY_KEY) && (memcached_key_test((char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED)) |
114 | + if ((ptr->flags & MEM_VERIFY_KEY) && (memcached_key_test((const char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED)) |
115 | return MEMCACHED_BAD_KEY_PROVIDED; |
116 | |
117 | server_key= memcached_generate_hash(ptr, key, key_length); |
118 | |
119 | === modified file 'libmemcached/memcached_callback.c' |
120 | --- libmemcached/memcached_callback.c 2009-06-21 10:59:22 +0000 |
121 | +++ libmemcached/memcached_callback.c 2009-07-08 13:38:34 +0000 |
122 | @@ -21,7 +21,7 @@ |
123 | { |
124 | size_t key_length= strlen(key); |
125 | |
126 | - if (memcached_key_test((char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED) |
127 | + if (memcached_key_test((const char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED) |
128 | { |
129 | return MEMCACHED_BAD_KEY_PROVIDED; |
130 | } |
131 | |
132 | === modified file 'libmemcached/memcached_get.c' |
133 | --- libmemcached/memcached_get.c 2009-06-21 15:51:17 +0000 |
134 | +++ libmemcached/memcached_get.c 2009-07-08 13:38:34 +0000 |
135 | @@ -37,7 +37,7 @@ |
136 | *error= memcached_mget_by_key(ptr, |
137 | master_key, |
138 | master_key_length, |
139 | - (char **)&key, &key_length, 1); |
140 | + (const char **)&key, &key_length, 1); |
141 | |
142 | value= memcached_fetch(ptr, NULL, NULL, |
143 | value_length, flags, error); |
144 | @@ -102,7 +102,7 @@ |
145 | } |
146 | |
147 | memcached_return memcached_mget(memcached_st *ptr, |
148 | - char **keys, size_t *key_length, |
149 | + const char **keys, size_t *key_length, |
150 | unsigned int number_of_keys) |
151 | { |
152 | return memcached_mget_by_key(ptr, NULL, 0, keys, key_length, number_of_keys); |
153 | @@ -111,19 +111,19 @@ |
154 | static memcached_return binary_mget_by_key(memcached_st *ptr, |
155 | unsigned int master_server_key, |
156 | bool is_master_key_set, |
157 | - char **keys, size_t *key_length, |
158 | + const char **keys, size_t *key_length, |
159 | unsigned int number_of_keys); |
160 | |
161 | memcached_return memcached_mget_by_key(memcached_st *ptr, |
162 | const char *master_key, |
163 | size_t master_key_length, |
164 | - char **keys, |
165 | + const char **keys, |
166 | size_t *key_length, |
167 | unsigned int number_of_keys) |
168 | { |
169 | unsigned int x; |
170 | memcached_return rc= MEMCACHED_NOTFOUND; |
171 | - char *get_command= "get "; |
172 | + const char *get_command= "get "; |
173 | uint8_t get_command_length= 4; |
174 | unsigned int master_server_key= (unsigned int)-1; /* 0 is a valid server id! */ |
175 | bool is_master_key_set= false; |
176 | @@ -145,7 +145,7 @@ |
177 | |
178 | if (master_key && master_key_length) |
179 | { |
180 | - if ((ptr->flags & MEM_VERIFY_KEY) && (memcached_key_test((char **)&master_key, &master_key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED)) |
181 | + if ((ptr->flags & MEM_VERIFY_KEY) && (memcached_key_test((const char **)&master_key, &master_key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED)) |
182 | return MEMCACHED_BAD_KEY_PROVIDED; |
183 | master_server_key= memcached_generate_hash(ptr, master_key, master_key_length); |
184 | is_master_key_set= true; |
185 | @@ -259,7 +259,7 @@ |
186 | static memcached_return simple_binary_mget(memcached_st *ptr, |
187 | unsigned int master_server_key, |
188 | bool is_master_key_set, |
189 | - char **keys, size_t *key_length, |
190 | + const char **keys, size_t *key_length, |
191 | unsigned int number_of_keys) |
192 | { |
193 | memcached_return rc= MEMCACHED_NOTFOUND; |
194 | @@ -360,7 +360,7 @@ |
195 | |
196 | static memcached_return replication_binary_mget(memcached_st *ptr, |
197 | uint32_t* hash, bool* dead_servers, |
198 | - char **keys, size_t *key_length, |
199 | + const char **keys, size_t *key_length, |
200 | unsigned int number_of_keys) |
201 | { |
202 | memcached_return rc= MEMCACHED_NOTFOUND; |
203 | @@ -459,7 +459,7 @@ |
204 | static memcached_return binary_mget_by_key(memcached_st *ptr, |
205 | unsigned int master_server_key, |
206 | bool is_master_key_set, |
207 | - char **keys, size_t *key_length, |
208 | + const char **keys, size_t *key_length, |
209 | unsigned int number_of_keys) |
210 | { |
211 | memcached_return rc; |
212 | |
213 | === modified file 'libmemcached/memcached_get.h' |
214 | --- libmemcached/memcached_get.h 2009-07-06 17:20:04 +0000 |
215 | +++ libmemcached/memcached_get.h 2009-07-08 13:38:34 +0000 |
216 | @@ -23,7 +23,7 @@ |
217 | |
218 | LIBMEMCACHED_API |
219 | memcached_return memcached_mget(memcached_st *ptr, |
220 | - char **keys, size_t *key_length, |
221 | + const char **keys, size_t *key_length, |
222 | unsigned int number_of_keys); |
223 | |
224 | LIBMEMCACHED_API |
225 | @@ -38,7 +38,7 @@ |
226 | memcached_return memcached_mget_by_key(memcached_st *ptr, |
227 | const char *master_key, size_t |
228 | master_key_length, |
229 | - char **keys, |
230 | + const char **keys, |
231 | size_t *key_length, |
232 | unsigned int number_of_keys); |
233 | |
234 | |
235 | === modified file 'libmemcached/memcached_key.c' |
236 | --- libmemcached/memcached_key.c 2009-03-21 13:09:45 +0000 |
237 | +++ libmemcached/memcached_key.c 2009-07-08 13:38:34 +0000 |
238 | @@ -1,6 +1,6 @@ |
239 | #include "common.h" |
240 | |
241 | -memcached_return memcached_key_test(char **keys, size_t *key_length, |
242 | +memcached_return memcached_key_test(const char **keys, size_t *key_length, |
243 | unsigned int number_of_keys) |
244 | { |
245 | uint32_t x; |
246 | |
247 | === modified file 'libmemcached/memcached_result.c' |
248 | --- libmemcached/memcached_result.c 2009-06-10 10:29:06 +0000 |
249 | +++ libmemcached/memcached_result.c 2009-07-08 13:38:34 +0000 |
250 | @@ -40,7 +40,7 @@ |
251 | /* |
252 | NOTE turn into macro |
253 | */ |
254 | -memcached_return memcached_result_set_value(memcached_result_st *ptr, char *value, size_t length) |
255 | +memcached_return memcached_result_set_value(memcached_result_st *ptr, const char *value, size_t length) |
256 | { |
257 | return memcached_string_append(&ptr->value, value, length); |
258 | } |
259 | |
260 | === modified file 'libmemcached/memcached_result.h' |
261 | --- libmemcached/memcached_result.h 2009-07-06 17:20:04 +0000 |
262 | +++ libmemcached/memcached_result.h 2009-07-08 13:38:34 +0000 |
263 | @@ -48,7 +48,7 @@ |
264 | #define memcached_result_flags(A) (A)->flags |
265 | #define memcached_result_cas(A) (A)->cas |
266 | LIBMEMCACHED_API |
267 | -memcached_return memcached_result_set_value(memcached_result_st *ptr, char *value, size_t length); |
268 | +memcached_return memcached_result_set_value(memcached_result_st *ptr, const char *value, size_t length); |
269 | #define memcached_result_set_flags(A,B) (A)->flags=(B) |
270 | #define memcached_result_set_expiration(A,B) (A)->expiration=(B) |
271 | |
272 | |
273 | === modified file 'libmemcached/memcached_server.c' |
274 | --- libmemcached/memcached_server.c 2009-06-10 10:29:06 +0000 |
275 | +++ libmemcached/memcached_server.c 2009-07-08 13:38:34 +0000 |
276 | @@ -120,7 +120,7 @@ |
277 | return NULL; |
278 | } |
279 | |
280 | - if ((ptr->flags & MEM_VERIFY_KEY) && (memcached_key_test((char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED)) |
281 | + if ((ptr->flags & MEM_VERIFY_KEY) && (memcached_key_test((const char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED)) |
282 | { |
283 | *error= MEMCACHED_BAD_KEY_PROVIDED; |
284 | return NULL; |
285 | |
286 | === modified file 'libmemcached/memcached_stats.c' |
287 | --- libmemcached/memcached_stats.c 2009-06-14 21:24:48 +0000 |
288 | +++ libmemcached/memcached_stats.c 2009-07-08 13:38:34 +0000 |
289 | @@ -3,7 +3,7 @@ |
290 | |
291 | #include "common.h" |
292 | |
293 | -static char *memcached_stat_keys[] = { |
294 | +static const char *memcached_stat_keys[] = { |
295 | "pid", |
296 | "uptime", |
297 | "time", |
298 | |
299 | === modified file 'libmemcached/memcached_storage.c' |
300 | --- libmemcached/memcached_storage.c 2009-07-01 19:36:25 +0000 |
301 | +++ libmemcached/memcached_storage.c 2009-07-08 13:38:34 +0000 |
302 | @@ -19,7 +19,7 @@ |
303 | } memcached_storage_action; |
304 | |
305 | /* Inline this */ |
306 | -static char *storage_op_string(memcached_storage_action verb) |
307 | +static const char *storage_op_string(memcached_storage_action verb) |
308 | { |
309 | switch (verb) |
310 | { |
311 | @@ -79,7 +79,7 @@ |
312 | unlikely (ptr->number_of_hosts == 0) |
313 | return MEMCACHED_NO_SERVERS; |
314 | |
315 | - if ((ptr->flags & MEM_VERIFY_KEY) && (memcached_key_test((char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED)) |
316 | + if ((ptr->flags & MEM_VERIFY_KEY) && (memcached_key_test((const char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED)) |
317 | return MEMCACHED_BAD_KEY_PROVIDED; |
318 | |
319 | if (ptr->flags & MEM_BINARY_PROTOCOL) |
320 | |
321 | === modified file 'libmemcached/memcached_strerror.c' |
322 | --- libmemcached/memcached_strerror.c 2009-06-21 00:33:44 +0000 |
323 | +++ libmemcached/memcached_strerror.c 2009-07-08 13:38:34 +0000 |
324 | @@ -1,6 +1,6 @@ |
325 | #include "common.h" |
326 | |
327 | -char *memcached_strerror(memcached_st *ptr __attribute__((unused)), memcached_return rc) |
328 | +const char *memcached_strerror(memcached_st *ptr __attribute__((unused)), memcached_return rc) |
329 | { |
330 | switch (rc) |
331 | { |
332 | |
333 | === modified file 'libmemcached/memcached_string.c' |
334 | --- libmemcached/memcached_string.c 2009-06-10 10:29:06 +0000 |
335 | +++ libmemcached/memcached_string.c 2009-07-08 13:38:34 +0000 |
336 | @@ -79,7 +79,7 @@ |
337 | } |
338 | |
339 | memcached_return memcached_string_append(memcached_string_st *string, |
340 | - char *value, size_t length) |
341 | + const char *value, size_t length) |
342 | { |
343 | memcached_return rc; |
344 | |
345 | |
346 | === modified file 'libmemcached/memcached_string.h' |
347 | --- libmemcached/memcached_string.h 2009-07-06 17:20:04 +0000 |
348 | +++ libmemcached/memcached_string.h 2009-07-08 13:38:34 +0000 |
349 | @@ -40,7 +40,7 @@ |
350 | char character); |
351 | LIBMEMCACHED_API |
352 | memcached_return memcached_string_append(memcached_string_st *string, |
353 | - char *value, size_t length); |
354 | + const char *value, size_t length); |
355 | LIBMEMCACHED_API |
356 | memcached_return memcached_string_reset(memcached_string_st *string); |
357 | LIBMEMCACHED_API |
358 | |
359 | === modified file 'libmemcached/memcached_version.c' |
360 | --- libmemcached/memcached_version.c 2009-03-09 21:59:06 +0000 |
361 | +++ libmemcached/memcached_version.c 2009-07-08 13:38:34 +0000 |
362 | @@ -26,7 +26,7 @@ |
363 | memcached_return rc; |
364 | char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; |
365 | char *response_ptr; |
366 | - char *command= "version\r\n"; |
367 | + const char *command= "version\r\n"; |
368 | |
369 | send_length= strlen(command); |
370 | |
371 | |
372 | === modified file 'm4/pandora_canonical.m4' |
373 | --- m4/pandora_canonical.m4 2009-07-08 23:05:36 +0000 |
374 | +++ m4/pandora_canonical.m4 2009-07-09 18:33:08 +0000 |
375 | @@ -4,7 +4,7 @@ |
376 | dnl with or without modifications, as long as this notice is preserved. |
377 | |
378 | dnl Which version of the canonical setup we're using |
379 | -AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.3]) |
380 | +AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.9]) |
381 | |
382 | AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[ |
383 | dnl Force dependency tracking on for Sun Studio builds |
384 | @@ -22,7 +22,8 @@ |
385 | m4_define([PCT_USE_GNULIB],[no]) |
386 | m4_define([PCT_REQUIRE_CXX],[no]) |
387 | m4_define([PCT_IGNORE_SHARED_PTR],[no]) |
388 | - m4_foreach([pct_arg],$*,[ |
389 | + m4_define([PCT_FORCE_GCC42],[no]) |
390 | + m4_foreach([pct_arg],[$*],[ |
391 | m4_case(pct_arg, |
392 | [use-gnulib], [ |
393 | m4_undefine([PCT_USE_GNULIB]) |
394 | @@ -35,6 +36,10 @@ |
395 | [ignore-shared-ptr], [ |
396 | m4_undefine([PCT_IGNORE_SHARED_PTR]) |
397 | m4_define([PCT_IGNORE_SHARED_PTR],[yes]) |
398 | + ], |
399 | + [force-gcc42], [ |
400 | + m4_undefine([PCT_FORCE_GCC42]) |
401 | + m4_define([PCT_FORCE_GCC42],[yes]) |
402 | ]) |
403 | ]) |
404 | |
405 | @@ -53,6 +58,7 @@ |
406 | m4_if(PCT_USE_GNULIB,yes,[ gl_EARLY ]) |
407 | |
408 | AC_REQUIRE([AC_PROG_CC]) |
409 | + AC_REQUIRE([PANDORA_MAC_GCC42]) |
410 | |
411 | dnl Once we can use a modern autoconf, we can use this |
412 | dnl AC_PROG_CC_C99 |
413 | @@ -61,6 +67,9 @@ |
414 | AM_PROG_CC_C_O |
415 | |
416 | gl_USE_SYSTEM_EXTENSIONS |
417 | + m4_if(PCT_FORCE_GCC42, [yes], [ |
418 | + AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION) |
419 | + ]) |
420 | |
421 | |
422 | PANDORA_LIBTOOL |
423 | @@ -99,15 +108,17 @@ |
424 | |
425 | AC_SYS_LARGEFILE |
426 | |
427 | + |
428 | PANDORA_CHECK_C_VERSION |
429 | PANDORA_CHECK_CXX_VERSION |
430 | |
431 | PANDORA_OPTIMIZE |
432 | PANDORA_64BIT |
433 | + |
434 | + gl_VISIBILITY |
435 | + |
436 | PANDORA_WARNINGS(PCT_ALL_ARGS) |
437 | |
438 | - gl_VISIBILITY |
439 | - |
440 | PANDORA_ENABLE_DTRACE |
441 | PANDORA_HEADER_ASSERT |
442 | |
443 | |
444 | === modified file 'm4/pandora_optimize.m4' |
445 | --- m4/pandora_optimize.m4 2009-07-08 07:37:38 +0000 |
446 | +++ m4/pandora_optimize.m4 2009-07-09 18:33:08 +0000 |
447 | @@ -39,12 +39,15 @@ |
448 | CXX="${CXX} -xlang=c99" |
449 | |
450 | AM_CFLAGS="-g -mt -xstrconst -Xa ${AM_CFLAGS}" |
451 | - AM_CXXFLAGS="-g -mt -compat=5 -library=stlport4 -template=no%extdef ${AM_CXXFLAGS}" |
452 | + AM_CXXFLAGS="-mt -compat=5 -library=stlport4 -template=no%extdef ${AM_CXXFLAGS}" |
453 | + |
454 | + DEBUG_CXXFLAGS="-g" |
455 | |
456 | dnl TODO: Make a test for -xO4 usability here |
457 | OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend -xbuiltin" |
458 | OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS}" |
459 | - OPTIMIZE_CXXFLAGS="${OPTIMIZE_FLAGS}" |
460 | + OPTIMIZE_CXXFLAGS="-g0 ${OPTIMIZE_FLAGS}" |
461 | + |
462 | ]) |
463 | |
464 | AC_ARG_WITH([debug], |
465 | |
466 | === modified file 'm4/pandora_warnings.m4' |
467 | --- m4/pandora_warnings.m4 2009-07-08 19:28:20 +0000 |
468 | +++ m4/pandora_warnings.m4 2009-07-09 05:34:19 +0000 |
469 | @@ -15,7 +15,7 @@ |
470 | m4_define([PW_WARN_ALWAYS_ON],[no]) |
471 | ifdef([m4_define],,[define([m4_define], defn([define]))]) |
472 | ifdef([m4_undefine],,[define([m4_undefine], defn([undefine]))]) |
473 | - m4_foreach([pw_arg],$*,[ |
474 | + m4_foreach([pw_arg],[$*],[ |
475 | m4_case(pw_arg, |
476 | [less-warnings],[ |
477 | m4_undefine([PW_LESS_WARNINGS]) |
478 | @@ -129,13 +129,13 @@ |
479 | |
480 | m4_if(PW_LESS_WARNINGS,[no],[ |
481 | BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing" |
482 | - CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum" |
483 | + CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings" |
484 | CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast" |
485 | ],[ |
486 | BASE_WARNINGS_FULL="-Wformat ${NO_STRICT_ALIASING}" |
487 | ]) |
488 | |
489 | - BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wextra -Wundef -Wshadow -Wstrict-aliasing ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}" |
490 | + BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wextra -Wundef -Wshadow ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}" |
491 | CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}" |
492 | CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}" |
493 | |
494 | |
495 | === modified file 'tests/atomsmasher.c' |
496 | --- tests/atomsmasher.c 2009-07-07 21:57:24 +0000 |
497 | +++ tests/atomsmasher.c 2009-07-08 13:38:34 +0000 |
498 | @@ -156,8 +156,8 @@ |
499 | static test_return add_test(memcached_st *memc) |
500 | { |
501 | memcached_return rc; |
502 | - char *key= "foo"; |
503 | - char *value= "when we sanitize"; |
504 | + const char *key= "foo"; |
505 | + const char *value= "when we sanitize"; |
506 | unsigned long long setting_value; |
507 | |
508 | setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK); |
509 | |
510 | === modified file 'tests/function.c' |
511 | --- tests/function.c 2009-07-06 17:20:04 +0000 |
512 | +++ tests/function.c 2009-07-08 13:38:34 +0000 |
513 | @@ -38,7 +38,7 @@ |
514 | static uint32_t global_count; |
515 | |
516 | static pairs_st *global_pairs; |
517 | -static char *global_keys[GLOBAL_COUNT]; |
518 | +static const char *global_keys[GLOBAL_COUNT]; |
519 | static size_t global_keys_length[GLOBAL_COUNT]; |
520 | |
521 | static test_return init_test(memcached_st *not_used __attribute__((unused))) |
522 | @@ -299,8 +299,8 @@ |
523 | static test_return set_test(memcached_st *memc) |
524 | { |
525 | memcached_return rc; |
526 | - char *key= "foo"; |
527 | - char *value= "when we sanitize"; |
528 | + const char *key= "foo"; |
529 | + const char *value= "when we sanitize"; |
530 | |
531 | rc= memcached_set(memc, key, strlen(key), |
532 | value, strlen(value), |
533 | @@ -313,8 +313,9 @@ |
534 | static test_return append_test(memcached_st *memc) |
535 | { |
536 | memcached_return rc; |
537 | - char *key= "fig"; |
538 | - char *value= "we"; |
539 | + const char *key= "fig"; |
540 | + const char *in_value= "we"; |
541 | + char *out_value= NULL; |
542 | size_t value_length; |
543 | uint32_t flags; |
544 | |
545 | @@ -322,7 +323,7 @@ |
546 | assert(rc == MEMCACHED_SUCCESS); |
547 | |
548 | rc= memcached_set(memc, key, strlen(key), |
549 | - value, strlen(value), |
550 | + in_value, strlen(in_value), |
551 | (time_t)0, (uint32_t)0); |
552 | assert(rc == MEMCACHED_SUCCESS); |
553 | |
554 | @@ -336,12 +337,12 @@ |
555 | (time_t)0, (uint32_t)0); |
556 | assert(rc == MEMCACHED_SUCCESS); |
557 | |
558 | - value= memcached_get(memc, key, strlen(key), |
559 | + out_value= memcached_get(memc, key, strlen(key), |
560 | &value_length, &flags, &rc); |
561 | - assert(!memcmp(value, "we the people", strlen("we the people"))); |
562 | + assert(!memcmp(out_value, "we the people", strlen("we the people"))); |
563 | assert(strlen("we the people") == value_length); |
564 | assert(rc == MEMCACHED_SUCCESS); |
565 | - free(value); |
566 | + free(out_value); |
567 | |
568 | return 0; |
569 | } |
570 | @@ -349,7 +350,7 @@ |
571 | static test_return append_binary_test(memcached_st *memc) |
572 | { |
573 | memcached_return rc; |
574 | - char *key= "numbers"; |
575 | + const char *key= "numbers"; |
576 | unsigned int *store_ptr; |
577 | unsigned int store_list[] = { 23, 56, 499, 98, 32847, 0 }; |
578 | char *value; |
579 | @@ -395,9 +396,9 @@ |
580 | static test_return cas2_test(memcached_st *memc) |
581 | { |
582 | memcached_return rc; |
583 | - char *keys[]= {"fudge", "son", "food"}; |
584 | + const char *keys[]= {"fudge", "son", "food"}; |
585 | size_t key_length[]= {5, 3, 4}; |
586 | - char *value= "we the people"; |
587 | + const char *value= "we the people"; |
588 | size_t value_length= strlen("we the people"); |
589 | unsigned int x; |
590 | memcached_result_st results_obj; |
591 | @@ -442,7 +443,7 @@ |
592 | const char *key= "fun"; |
593 | size_t key_length= strlen(key); |
594 | const char *value= "we the people"; |
595 | - char* keys[2] = { (char*)key, NULL }; |
596 | + const char* keys[2] = { key, NULL }; |
597 | size_t keylengths[2] = { strlen(key), 0 }; |
598 | size_t value_length= strlen(value); |
599 | const char *value2= "change the value"; |
600 | @@ -499,8 +500,9 @@ |
601 | static test_return prepend_test(memcached_st *memc) |
602 | { |
603 | memcached_return rc; |
604 | - char *key= "fig"; |
605 | - char *value= "people"; |
606 | + const char *key= "fig"; |
607 | + const char *value= "people"; |
608 | + char *out_value= NULL; |
609 | size_t value_length; |
610 | uint32_t flags; |
611 | |
612 | @@ -522,12 +524,12 @@ |
613 | (time_t)0, (uint32_t)0); |
614 | assert(rc == MEMCACHED_SUCCESS); |
615 | |
616 | - value= memcached_get(memc, key, strlen(key), |
617 | + out_value= memcached_get(memc, key, strlen(key), |
618 | &value_length, &flags, &rc); |
619 | - assert(!memcmp(value, "we the people", strlen("we the people"))); |
620 | + assert(!memcmp(out_value, "we the people", strlen("we the people"))); |
621 | assert(strlen("we the people") == value_length); |
622 | assert(rc == MEMCACHED_SUCCESS); |
623 | - free(value); |
624 | + free(out_value); |
625 | |
626 | return 0; |
627 | } |
628 | @@ -539,8 +541,8 @@ |
629 | static test_return add_test(memcached_st *memc) |
630 | { |
631 | memcached_return rc; |
632 | - char *key= "foo"; |
633 | - char *value= "when we sanitize"; |
634 | + const char *key= "foo"; |
635 | + const char *value= "when we sanitize"; |
636 | unsigned long long setting_value; |
637 | |
638 | setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK); |
639 | @@ -587,9 +589,9 @@ |
640 | static test_return replace_test(memcached_st *memc) |
641 | { |
642 | memcached_return rc; |
643 | - char *key= "foo"; |
644 | - char *value= "when we sanitize"; |
645 | - char *original= "first we insert some data"; |
646 | + const char *key= "foo"; |
647 | + const char *value= "when we sanitize"; |
648 | + const char *original= "first we insert some data"; |
649 | |
650 | rc= memcached_set(memc, key, strlen(key), |
651 | original, strlen(original), |
652 | @@ -607,8 +609,8 @@ |
653 | static test_return delete_test(memcached_st *memc) |
654 | { |
655 | memcached_return rc; |
656 | - char *key= "foo"; |
657 | - char *value= "when we sanitize"; |
658 | + const char *key= "foo"; |
659 | + const char *value= "when we sanitize"; |
660 | |
661 | rc= memcached_set(memc, key, strlen(key), |
662 | value, strlen(value), |
663 | @@ -642,19 +644,19 @@ |
664 | |
665 | static test_return memcached_server_cursor_test(memcached_st *memc) |
666 | { |
667 | - char *context= "foo bad"; |
668 | + char context[8]; |
669 | + strcpy(context, "foo bad"); |
670 | memcached_server_function callbacks[1]; |
671 | |
672 | callbacks[0]= server_function; |
673 | memcached_server_cursor(memc, callbacks, context, 1); |
674 | - |
675 | return 0; |
676 | } |
677 | |
678 | static test_return bad_key_test(memcached_st *memc) |
679 | { |
680 | memcached_return rc; |
681 | - char *key= "foo bad"; |
682 | + const char *key= "foo bad"; |
683 | char *string; |
684 | size_t string_length; |
685 | uint32_t flags; |
686 | @@ -687,7 +689,7 @@ |
687 | assert(!string); |
688 | |
689 | /* Test multi key for bad keys */ |
690 | - char *keys[] = { "GoodKey", "Bad Key", "NotMine" }; |
691 | + const char *keys[] = { "GoodKey", "Bad Key", "NotMine" }; |
692 | size_t key_lengths[] = { 7, 7, 7 }; |
693 | set= 1; |
694 | rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set); |
695 | @@ -756,7 +758,7 @@ |
696 | static test_return read_through(memcached_st *memc) |
697 | { |
698 | memcached_return rc; |
699 | - char *key= "foo"; |
700 | + const char *key= "foo"; |
701 | char *string; |
702 | size_t string_length; |
703 | uint32_t flags; |
704 | @@ -817,7 +819,7 @@ |
705 | static test_return get_test(memcached_st *memc) |
706 | { |
707 | memcached_return rc; |
708 | - char *key= "foo"; |
709 | + const char *key= "foo"; |
710 | char *string; |
711 | size_t string_length; |
712 | uint32_t flags; |
713 | @@ -838,8 +840,8 @@ |
714 | static test_return get_test2(memcached_st *memc) |
715 | { |
716 | memcached_return rc; |
717 | - char *key= "foo"; |
718 | - char *value= "when we sanitize"; |
719 | + const char *key= "foo"; |
720 | + const char *value= "when we sanitize"; |
721 | char *string; |
722 | size_t string_length; |
723 | uint32_t flags; |
724 | @@ -865,8 +867,8 @@ |
725 | static test_return set_test2(memcached_st *memc) |
726 | { |
727 | memcached_return rc; |
728 | - char *key= "foo"; |
729 | - char *value= "train in the brain"; |
730 | + const char *key= "foo"; |
731 | + const char *value= "train in the brain"; |
732 | size_t value_length= strlen(value); |
733 | unsigned int x; |
734 | |
735 | @@ -915,7 +917,7 @@ |
736 | static test_return get_test3(memcached_st *memc) |
737 | { |
738 | memcached_return rc; |
739 | - char *key= "foo"; |
740 | + const char *key= "foo"; |
741 | char *value; |
742 | size_t value_length= 8191; |
743 | char *string; |
744 | @@ -951,7 +953,7 @@ |
745 | static test_return get_test4(memcached_st *memc) |
746 | { |
747 | memcached_return rc; |
748 | - char *key= "foo"; |
749 | + const char *key= "foo"; |
750 | char *value; |
751 | size_t value_length= 8191; |
752 | char *string; |
753 | @@ -998,7 +1000,7 @@ |
754 | ** Request the same key twice, to ensure that we hash to the same server |
755 | ** (so that we have multiple response values queued up) ;-) |
756 | */ |
757 | - char *keys[]= { "key", "key" }; |
758 | + const char *keys[]= { "key", "key" }; |
759 | size_t lengths[]= { 3, 3 }; |
760 | uint32_t flags; |
761 | size_t rlen; |
762 | @@ -1048,8 +1050,8 @@ |
763 | { |
764 | uint64_t new_number; |
765 | memcached_return rc; |
766 | - char *key= "number"; |
767 | - char *value= "0"; |
768 | + const char *key= "number"; |
769 | + const char *value= "0"; |
770 | |
771 | rc= memcached_set(memc, key, strlen(key), |
772 | value, strlen(value), |
773 | @@ -1075,7 +1077,7 @@ |
774 | { |
775 | uint64_t new_number; |
776 | memcached_return rc; |
777 | - char *key= "number"; |
778 | + const char *key= "number"; |
779 | uint64_t initial= 0; |
780 | |
781 | rc= memcached_increment_with_initial(memc, key, strlen(key), |
782 | @@ -1095,8 +1097,8 @@ |
783 | { |
784 | uint64_t new_number; |
785 | memcached_return rc; |
786 | - char *key= "number"; |
787 | - char *value= "3"; |
788 | + const char *key= "number"; |
789 | + const char *value= "3"; |
790 | |
791 | rc= memcached_set(memc, key, strlen(key), |
792 | value, strlen(value), |
793 | @@ -1122,7 +1124,7 @@ |
794 | { |
795 | uint64_t new_number; |
796 | memcached_return rc; |
797 | - char *key= "number"; |
798 | + const char *key= "number"; |
799 | uint64_t initial= 3; |
800 | |
801 | rc= memcached_decrement_with_initial(memc, key, strlen(key), |
802 | @@ -1141,8 +1143,8 @@ |
803 | static test_return quit_test(memcached_st *memc) |
804 | { |
805 | memcached_return rc; |
806 | - char *key= "fudge"; |
807 | - char *value= "sanford and sun"; |
808 | + const char *key= "fudge"; |
809 | + const char *value= "sanford and sun"; |
810 | |
811 | rc= memcached_set(memc, key, strlen(key), |
812 | value, strlen(value), |
813 | @@ -1161,7 +1163,7 @@ |
814 | static test_return mget_result_test(memcached_st *memc) |
815 | { |
816 | memcached_return rc; |
817 | - char *keys[]= {"fudge", "son", "food"}; |
818 | + const char *keys[]= {"fudge", "son", "food"}; |
819 | size_t key_length[]= {5, 3, 4}; |
820 | unsigned int x; |
821 | |
822 | @@ -1218,7 +1220,7 @@ |
823 | static test_return mget_result_alloc_test(memcached_st *memc) |
824 | { |
825 | memcached_return rc; |
826 | - char *keys[]= {"fudge", "son", "food"}; |
827 | + const char *keys[]= {"fudge", "son", "food"}; |
828 | size_t key_length[]= {5, 3, 4}; |
829 | unsigned int x; |
830 | |
831 | @@ -1280,7 +1282,7 @@ |
832 | static test_return mget_result_function(memcached_st *memc) |
833 | { |
834 | memcached_return rc; |
835 | - char *keys[]= {"fudge", "son", "food"}; |
836 | + const char *keys[]= {"fudge", "son", "food"}; |
837 | size_t key_length[]= {5, 3, 4}; |
838 | unsigned int x; |
839 | unsigned int counter; |
840 | @@ -1311,7 +1313,7 @@ |
841 | static test_return mget_test(memcached_st *memc) |
842 | { |
843 | memcached_return rc; |
844 | - char *keys[]= {"fudge", "son", "food"}; |
845 | + const char *keys[]= {"fudge", "son", "food"}; |
846 | size_t key_length[]= {5, 3, 4}; |
847 | unsigned int x; |
848 | uint32_t flags; |
849 | @@ -1695,7 +1697,7 @@ |
850 | key_lengths[x]= strlen(keys[x]); |
851 | } |
852 | |
853 | - rc= memcached_mget(memc, keys, key_lengths, KEY_COUNT); |
854 | + rc= memcached_mget(memc, (const char **)keys, key_lengths, KEY_COUNT); |
855 | assert(rc == MEMCACHED_SUCCESS); |
856 | |
857 | /* Turn this into a help function */ |
858 | @@ -1726,7 +1728,7 @@ |
859 | static test_return user_supplied_bug4(memcached_st *memc) |
860 | { |
861 | memcached_return rc; |
862 | - char *keys[]= {"fudge", "son", "food"}; |
863 | + const char *keys[]= {"fudge", "son", "food"}; |
864 | size_t key_length[]= {5, 3, 4}; |
865 | unsigned int x; |
866 | uint32_t flags; |
867 | @@ -1789,7 +1791,7 @@ |
868 | static test_return user_supplied_bug5(memcached_st *memc) |
869 | { |
870 | memcached_return rc; |
871 | - char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; |
872 | + const char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; |
873 | size_t key_length[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")}; |
874 | char return_key[MEMCACHED_MAX_KEY]; |
875 | size_t return_key_length; |
876 | @@ -1847,7 +1849,7 @@ |
877 | static test_return user_supplied_bug6(memcached_st *memc) |
878 | { |
879 | memcached_return rc; |
880 | - char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; |
881 | + const char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; |
882 | size_t key_length[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")}; |
883 | char return_key[MEMCACHED_MAX_KEY]; |
884 | size_t return_key_length; |
885 | @@ -1916,7 +1918,7 @@ |
886 | memcached_st *memc_clone; |
887 | |
888 | memcached_server_st *servers; |
889 | - 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"; |
890 | + 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"; |
891 | |
892 | servers= memcached_servers_parse(server_list); |
893 | assert(servers); |
894 | @@ -1943,8 +1945,8 @@ |
895 | static test_return user_supplied_bug7(memcached_st *memc) |
896 | { |
897 | memcached_return rc; |
898 | - char *keys= "036790384900"; |
899 | - size_t key_length= strlen("036790384900"); |
900 | + const char *keys= "036790384900"; |
901 | + size_t key_length= strlen(keys); |
902 | char return_key[MEMCACHED_MAX_KEY]; |
903 | size_t return_key_length; |
904 | char *value; |
905 | @@ -1987,7 +1989,7 @@ |
906 | static test_return user_supplied_bug9(memcached_st *memc) |
907 | { |
908 | memcached_return rc; |
909 | - char *keys[]= {"UDATA:edevil@sapo.pt", "fudge&*@#", "for^#@&$not"}; |
910 | + const char *keys[]= {"UDATA:edevil@sapo.pt", "fudge&*@#", "for^#@&$not"}; |
911 | size_t key_length[3]; |
912 | unsigned int x; |
913 | uint32_t flags; |
914 | @@ -2031,7 +2033,7 @@ |
915 | /* We are testing with aggressive timeout to get failures */ |
916 | static test_return user_supplied_bug10(memcached_st *memc) |
917 | { |
918 | - char *key= "foo"; |
919 | + const char *key= "foo"; |
920 | char *value; |
921 | size_t value_length= 512; |
922 | unsigned int x; |
923 | @@ -2074,7 +2076,7 @@ |
924 | */ |
925 | static test_return user_supplied_bug11(memcached_st *memc) |
926 | { |
927 | - char *key= "foo"; |
928 | + const char *key= "foo"; |
929 | char *value; |
930 | size_t value_length= 512; |
931 | unsigned int x; |
932 | @@ -2199,7 +2201,7 @@ |
933 | size_t setter= 1; |
934 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter); |
935 | memcached_return rc; |
936 | - char *key= "foo"; |
937 | + const char *key= "foo"; |
938 | char *value; |
939 | size_t value_length= 18000; |
940 | char *string; |
941 | @@ -2243,7 +2245,7 @@ |
942 | { |
943 | uint32_t x; |
944 | memcached_return rc; |
945 | - char *key= "mykey"; |
946 | + const char *key= "mykey"; |
947 | char *value; |
948 | size_t length; |
949 | uint32_t flags; |
950 | @@ -2280,7 +2282,7 @@ |
951 | static test_return user_supplied_bug16(memcached_st *memc) |
952 | { |
953 | memcached_return rc; |
954 | - char *key= "mykey"; |
955 | + const char *key= "mykey"; |
956 | char *value; |
957 | size_t length; |
958 | uint32_t flags; |
959 | @@ -2306,8 +2308,8 @@ |
960 | static test_return user_supplied_bug17(memcached_st *memc) |
961 | { |
962 | memcached_return rc; |
963 | - char *key= "豆瓣"; |
964 | - char *value="我们在炎热抑郁的夏天无法停止豆瓣"; |
965 | + const char *key= "豆瓣"; |
966 | + const char *value="我们在炎热抑郁的夏天无法停止豆瓣"; |
967 | char *value2; |
968 | size_t length; |
969 | uint32_t flags; |
970 | @@ -2358,9 +2360,9 @@ |
971 | { |
972 | memcached_return status; |
973 | memcached_result_st *result, result_obj; |
974 | - char *key = "abc"; |
975 | + const char *key = "abc"; |
976 | size_t key_len = strlen("abc"); |
977 | - char *value = "foobar"; |
978 | + const char *value = "foobar"; |
979 | size_t value_len = strlen(value); |
980 | |
981 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, 1); |
982 | @@ -3139,7 +3141,9 @@ |
983 | |
984 | /* Set to Zero, and then Set to something too large */ |
985 | { |
986 | - char *long_key; |
987 | + char long_key[255]; |
988 | + memset(long_key, 0, 255); |
989 | + |
990 | rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, NULL); |
991 | assert(rc == MEMCACHED_SUCCESS); |
992 | |
993 | @@ -3149,13 +3153,13 @@ |
994 | |
995 | /* Test a long key for failure */ |
996 | /* TODO, extend test to determine based on setting, what result should be */ |
997 | - long_key= "Thisismorethentheallottednumberofcharacters"; |
998 | + strcpy(long_key, "Thisismorethentheallottednumberofcharacters"); |
999 | rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key); |
1000 | //assert(rc == MEMCACHED_BAD_KEY_PROVIDED); |
1001 | assert(rc == MEMCACHED_SUCCESS); |
1002 | |
1003 | /* Now test a key with spaces (which will fail from long key, since bad key is not set) */ |
1004 | - long_key= "This is more then the allotted number of characters"; |
1005 | + strcpy(long_key, "This is more then the allotted number of characters"); |
1006 | rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key); |
1007 | assert(rc == MEMCACHED_BAD_KEY_PROVIDED); |
1008 | |
1009 | @@ -3163,7 +3167,7 @@ |
1010 | rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_VERIFY_KEY, 1); |
1011 | assert(rc == MEMCACHED_SUCCESS); |
1012 | |
1013 | - long_key= "dog cat"; |
1014 | + strcpy(long_key, "dog cat"); |
1015 | rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key); |
1016 | assert(rc == MEMCACHED_BAD_KEY_PROVIDED); |
1017 | } |
1018 | @@ -3429,7 +3433,7 @@ |
1019 | /* Try setting an illegal cas value (should not return an error to |
1020 | * the caller (because we don't expect a return message from the server) |
1021 | */ |
1022 | - char* keys[]= {"0"}; |
1023 | + const char* keys[]= {"0"}; |
1024 | size_t lengths[]= {1}; |
1025 | size_t length; |
1026 | uint32_t flags; |
1027 | @@ -3668,7 +3672,7 @@ |
1028 | memcached_st *memc_clone= memcached_clone(NULL, memc); |
1029 | memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, 0); |
1030 | |
1031 | - char *keys[]= { "bubba", "key1", "key2", "key3" }; |
1032 | + const char *keys[]= { "bubba", "key1", "key2", "key3" }; |
1033 | size_t len[]= { 5, 4, 4, 4 }; |
1034 | |
1035 | for (int x=0; x< 4; ++x) |
1036 | @@ -3705,7 +3709,7 @@ |
1037 | |
1038 | for (int x= 'a'; x <= 'z'; ++x) |
1039 | { |
1040 | - char key[2]= { [0]= (char)x }; |
1041 | + const char key[2]= { [0]= (const char)x }; |
1042 | |
1043 | rc= memcached_mget_by_key(new_clone, key, 1, keys, len, 4); |
1044 | assert(rc == MEMCACHED_SUCCESS); |
1045 | @@ -3737,7 +3741,7 @@ |
1046 | MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS); |
1047 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, --repl); |
1048 | |
1049 | - char *keys[]= { "bubba", "key1", "key2", "key3" }; |
1050 | + const char *keys[]= { "bubba", "key1", "key2", "key3" }; |
1051 | size_t len[]= { 5, 4, 4, 4 }; |
1052 | |
1053 | for (int x=0; x< 4; ++x) |
1054 | @@ -3764,7 +3768,7 @@ |
1055 | { |
1056 | for (int x= 'a'; x <= 'z'; ++x) |
1057 | { |
1058 | - char key[2]= { [0]= (char)x }; |
1059 | + const char key[2]= { [0]= (const char)x }; |
1060 | |
1061 | rc= memcached_mget_by_key(memc_clone, key, 1, keys, len, 4); |
1062 | assert(rc == MEMCACHED_SUCCESS); |
1063 | @@ -3907,8 +3911,8 @@ |
1064 | for (x= 0; x < num_iters;x++) |
1065 | { |
1066 | memcached_return rc; |
1067 | - char *key= "foo"; |
1068 | - char *value= "when we sanitize"; |
1069 | + const char *key= "foo"; |
1070 | + const char *value= "when we sanitize"; |
1071 | uint16_t *expected_ids= get_udp_request_ids(memc); |
1072 | unsigned int server_key= memcached_generate_hash(memc,key,strlen(key)); |
1073 | size_t init_offset= memc->hosts[server_key].write_buffer_offset; |
1074 | @@ -3947,7 +3951,7 @@ |
1075 | static test_return udp_set_too_big_test(memcached_st *memc) |
1076 | { |
1077 | memcached_return rc; |
1078 | - char *key= "bar"; |
1079 | + const char *key= "bar"; |
1080 | char value[MAX_UDP_DATAGRAM_LENGTH]; |
1081 | uint16_t *expected_ids= get_udp_request_ids(memc); |
1082 | rc= memcached_set(memc, key, strlen(key), |
1083 | @@ -3964,7 +3968,7 @@ |
1084 | for (x= 0; x < num_iters;x++) |
1085 | { |
1086 | memcached_return rc; |
1087 | - char *key= "foo"; |
1088 | + const char *key= "foo"; |
1089 | uint16_t *expected_ids=get_udp_request_ids(memc); |
1090 | unsigned int server_key= memcached_generate_hash(memc, key, strlen(key)); |
1091 | size_t init_offset= memc->hosts[server_key].write_buffer_offset; |
1092 | @@ -4026,8 +4030,8 @@ |
1093 | static test_return udp_incr_test(memcached_st *memc) |
1094 | { |
1095 | memcached_return rc; |
1096 | - char *key= "incr"; |
1097 | - char *value= "1"; |
1098 | + const char *key= "incr"; |
1099 | + const char *value= "1"; |
1100 | rc= memcached_set(memc, key, strlen(key), |
1101 | value, strlen(value), |
1102 | (time_t)0, (uint32_t)0); |
1103 | @@ -4045,8 +4049,8 @@ |
1104 | static test_return udp_decr_test(memcached_st *memc) |
1105 | { |
1106 | memcached_return rc; |
1107 | - char *key= "decr"; |
1108 | - char *value= "1"; |
1109 | + const char *key= "decr"; |
1110 | + const char *value= "1"; |
1111 | rc= memcached_set(memc, key, strlen(key), |
1112 | value, strlen(value), |
1113 | (time_t)0, (uint32_t)0); |
1114 | @@ -4086,7 +4090,7 @@ |
1115 | static test_return udp_get_test(memcached_st *memc) |
1116 | { |
1117 | memcached_return rc; |
1118 | - char *key= "foo"; |
1119 | + const char *key= "foo"; |
1120 | size_t vlen; |
1121 | uint16_t *expected_ids = get_udp_request_ids(memc); |
1122 | char *val= memcached_get(memc, key, strlen(key), &vlen, (uint32_t)0, &rc); |
1123 | @@ -4130,7 +4134,7 @@ |
1124 | return TEST_SUCCESS; |
1125 | } |
1126 | |
1127 | -static char *list[]= |
1128 | +static const char *list[]= |
1129 | { |
1130 | "apple", |
1131 | "beat", |
1132 | @@ -4163,7 +4167,7 @@ |
1133 | static test_return md5_run (memcached_st *memc __attribute__((unused))) |
1134 | { |
1135 | uint32_t x; |
1136 | - char **ptr; |
1137 | + const char **ptr; |
1138 | uint32_t values[]= { 3195025439U, 2556848621U, 3724893440U, 3332385401U, |
1139 | 245758794U, 2550894432U, 121710495U, 3053817768U, |
1140 | 1250994555U, 1862072655U, 2631955953U, 2951528551U, |
1141 | @@ -4187,7 +4191,7 @@ |
1142 | static test_return crc_run (memcached_st *memc __attribute__((unused))) |
1143 | { |
1144 | uint32_t x; |
1145 | - char **ptr; |
1146 | + const char **ptr; |
1147 | uint32_t values[]= { 10542U, 22009U, 14526U, 19510U, 19432U, 10199U, 20634U, |
1148 | 9369U, 11511U, 10362U, 7893U, 31289U, 11313U, 9354U, |
1149 | 7621U, 30628U, 15218U, 25967U, 2695U, 9380U, |
1150 | @@ -4207,7 +4211,7 @@ |
1151 | static test_return fnv1_64_run (memcached_st *memc __attribute__((unused))) |
1152 | { |
1153 | uint32_t x; |
1154 | - char **ptr; |
1155 | + const char **ptr; |
1156 | uint32_t values[]= { 473199127U, 4148981457U, 3971873300U, 3257986707U, |
1157 | 1722477987U, 2991193800U, 4147007314U, 3633179701U, |
1158 | 1805162104U, 3503289120U, 3395702895U, 3325073042U, |
1159 | @@ -4230,7 +4234,7 @@ |
1160 | static test_return fnv1a_64_run (memcached_st *memc __attribute__((unused))) |
1161 | { |
1162 | uint32_t x; |
1163 | - char **ptr; |
1164 | + const char **ptr; |
1165 | uint32_t values[]= { 1488911807U, 2500855813U, 1510099634U, 1390325195U, |
1166 | 3647689787U, 3241528582U, 1669328060U, 2604311949U, |
1167 | 734810122U, 1516407546U, 560948863U, 1767346780U, |
1168 | @@ -4253,7 +4257,7 @@ |
1169 | static test_return fnv1_32_run (memcached_st *memc __attribute__((unused))) |
1170 | { |
1171 | uint32_t x; |
1172 | - char **ptr; |
1173 | + const char **ptr; |
1174 | uint32_t values[]= { 67176023U, 1190179409U, 2043204404U, 3221866419U, |
1175 | 2567703427U, 3787535528U, 4147287986U, 3500475733U, |
1176 | 344481048U, 3865235296U, 2181839183U, 119581266U, |
1177 | @@ -4277,7 +4281,7 @@ |
1178 | static test_return fnv1a_32_run (memcached_st *memc __attribute__((unused))) |
1179 | { |
1180 | uint32_t x; |
1181 | - char **ptr; |
1182 | + const char **ptr; |
1183 | uint32_t values[]= { 280767167U, 2421315013U, 3072375666U, 855001899U, |
1184 | 459261019U, 3521085446U, 18738364U, 1625305005U, |
1185 | 2162232970U, 777243802U, 3323728671U, 132336572U, |
1186 | @@ -4300,7 +4304,7 @@ |
1187 | static test_return hsieh_run (memcached_st *memc __attribute__((unused))) |
1188 | { |
1189 | uint32_t x; |
1190 | - char **ptr; |
1191 | + const char **ptr; |
1192 | #ifdef HAVE_HSIEH_HASH |
1193 | uint32_t values[]= { 3738850110, 3636226060, 3821074029, 3489929160, 3485772682, 80540287, |
1194 | 1805464076, 1895033657, 409795758, 979934958, 3634096985, 1284445480, |
1195 | @@ -4325,7 +4329,7 @@ |
1196 | static test_return murmur_run (memcached_st *memc __attribute__((unused))) |
1197 | { |
1198 | uint32_t x; |
1199 | - char **ptr; |
1200 | + const char **ptr; |
1201 | uint32_t values[]= { 473199127U, 4148981457U, 3971873300U, 3257986707U, |
1202 | 1722477987U, 2991193800U, 4147007314U, 3633179701U, |
1203 | 1805162104U, 3503289120U, 3395702895U, 3325073042U, |
1204 | @@ -4348,7 +4352,7 @@ |
1205 | static test_return jenkins_run (memcached_st *memc __attribute__((unused))) |
1206 | { |
1207 | uint32_t x; |
1208 | - char **ptr; |
1209 | + const char **ptr; |
1210 | uint32_t values[]= { 1442444624U, 4253821186U, 1885058256U, 2120131735U, |
1211 | 3261968576U, 3515188778U, 4232909173U, 4288625128U, |
1212 | 1812047395U, 3689182164U, 2502979932U, 1214050606U, |
1213 | |
1214 | === modified file 'tests/ketama_test_cases.h' |
1215 | --- tests/ketama_test_cases.h 2008-11-03 22:20:00 +0000 |
1216 | +++ tests/ketama_test_cases.h 2009-07-08 13:38:34 +0000 |
1217 | @@ -1,8 +1,8 @@ |
1218 | typedef struct { |
1219 | - char *key; |
1220 | + const char *key; |
1221 | unsigned long hash1; |
1222 | unsigned long hash2; |
1223 | - char *server; |
1224 | + const char *server; |
1225 | } TestCase; |
1226 | |
1227 | static TestCase test_cases[99] = { |
1228 | |
1229 | === modified file 'tests/udp.c' |
1230 | --- tests/udp.c 2008-08-19 18:07:14 +0000 |
1231 | +++ tests/udp.c 2009-07-08 13:38:34 +0000 |
1232 | @@ -22,8 +22,8 @@ |
1233 | test_return set_test(memcached_st *memc) |
1234 | { |
1235 | memcached_return rc; |
1236 | - char *key= "foo"; |
1237 | - char *value= "when we sanitize"; |
1238 | + const char *key= "foo"; |
1239 | + const char *value= "when we sanitize"; |
1240 | |
1241 | rc= memcached_set(memc, key, strlen(key), |
1242 | value, strlen(value), |
Updated to latest pandora-build macros.
Fixed warnings related to -Wwrite-strings - which are treating string literals as char * instead of const char *.