Merge lp://staging/~mordred/libmemcached/write-strings into lp://staging/~tangent-org/libmemcached/trunk
- write-strings
- Merge into trunk
Proposed by
Monty Taylor
Status: | Superseded |
---|---|
Proposed branch: | lp://staging/~mordred/libmemcached/write-strings |
Merge into: | lp://staging/~tangent-org/libmemcached/trunk |
Diff against target: | None lines |
To merge this branch: | bzr merge lp://staging/~mordred/libmemcached/write-strings |
Related bugs: |
This proposal supersedes a proposal from 2009-07-09.
This proposal has been superseded by a proposal from 2009-07-14.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Monty Taylor (mordred) wrote : Posted in a previous version of this proposal | # |
- 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_64bit.m4' |
373 | --- m4/pandora_64bit.m4 2009-07-08 07:37:38 +0000 |
374 | +++ m4/pandora_64bit.m4 2009-07-10 17:30:57 +0000 |
375 | @@ -8,34 +8,45 @@ |
376 | dnl --------------------------------------------------------------------------- |
377 | AC_DEFUN([PANDORA_64BIT],[ |
378 | |
379 | + AC_ARG_ENABLE([64bit],[ |
380 | + AS_HELP_STRING([--disable-64bit], |
381 | + [Build 64 bit binary @<:@default=on@:>@])], |
382 | + [ac_enable_64bit="$enableval"], |
383 | + [ac_enable_64bit="yes"]) |
384 | + |
385 | AC_CHECK_PROGS(ISAINFO, [isainfo], [no]) |
386 | AS_IF([test "x$ISAINFO" != "xno"], |
387 | [isainfo_b=`${ISAINFO} -b`], |
388 | [isainfo_b="x"]) |
389 | |
390 | - AS_IF([test "$isainfo_b" != "x"], |
391 | - [AC_ARG_ENABLE([64bit], |
392 | - [AS_HELP_STRING([--disable-64bit], |
393 | - [Build 64 bit binary @<:@default=on@:>@])], |
394 | - [ac_enable_64bit="$enableval"], |
395 | - [ac_enable_64bit="yes"])]) |
396 | - |
397 | - AS_IF([test "x$ac_enable_64bit" = "xyes"],[ |
398 | - if test "x$libdir" = "x\${exec_prefix}/lib" ; then |
399 | - # The user hasn't overridden the default libdir, so we'll |
400 | - # the dir suffix to match solaris 32/64-bit policy |
401 | - isainfo_k=`${ISAINFO} -k` |
402 | - libdir="${libdir}/${isainfo_k}" |
403 | - fi |
404 | - CPPFLAGS="-m64 ${CPPFLAGS}" |
405 | - LDFLAGS="-m64 ${LDFLAGS}" |
406 | - DTRACEFLAGS="${DTRACEFLAGS} -64" |
407 | - if test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes" |
408 | - then |
409 | - AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}" |
410 | - AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}" |
411 | - fi |
412 | - ],[DTRACEFLAGS="${DTRACEFLAGS} -32"]) |
413 | + AS_IF([test "$isainfo_b" != "x"],[ |
414 | + |
415 | + isainfo_k=`${ISAINFO} -k` |
416 | + DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_k}" |
417 | + |
418 | + AS_IF([test "x${ac_cv_env_CPPFLAGS_set}" = "x"],[ |
419 | + CPPFLAGS="-I/usr/local ${CPPFLAGS}" |
420 | + ]) |
421 | + |
422 | + AS_IF([test "x${ac_cv_env_LDFLAGS_set}" = "x"],[ |
423 | + LDFLAGS="-L/usr/local/lib/${isainfo_k} ${LDFLAGS}" |
424 | + ]) |
425 | + |
426 | + AS_IF([test "x$ac_enable_64bit" = "xyes"],[ |
427 | + AS_IF([test "x$libdir" = "x\${exec_prefix}/lib"],[ |
428 | + dnl The user hasn't overridden the default libdir, so we'll |
429 | + dnl the dir suffix to match solaris 32/64-bit policy |
430 | + libdir="${libdir}/${isainfo_k}" |
431 | + ]) |
432 | + |
433 | + CPPFLAGS="-m64 ${CPPFLAGS}" |
434 | + LDFLAGS="-m64 ${LDFLAGS}" |
435 | + AS_IF([test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"],[ |
436 | + AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}" |
437 | + AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}" |
438 | + ]) |
439 | + ]) |
440 | + ]) |
441 | ]) |
442 | dnl --------------------------------------------------------------------------- |
443 | dnl End Macro: PANDORA_64BIT |
444 | |
445 | === modified file 'm4/pandora_canonical.m4' |
446 | --- m4/pandora_canonical.m4 2009-07-08 23:05:36 +0000 |
447 | +++ m4/pandora_canonical.m4 2009-07-10 17:30:57 +0000 |
448 | @@ -4,7 +4,7 @@ |
449 | dnl with or without modifications, as long as this notice is preserved. |
450 | |
451 | dnl Which version of the canonical setup we're using |
452 | -AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.3]) |
453 | +AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.11]) |
454 | |
455 | AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[ |
456 | dnl Force dependency tracking on for Sun Studio builds |
457 | @@ -22,7 +22,8 @@ |
458 | m4_define([PCT_USE_GNULIB],[no]) |
459 | m4_define([PCT_REQUIRE_CXX],[no]) |
460 | m4_define([PCT_IGNORE_SHARED_PTR],[no]) |
461 | - m4_foreach([pct_arg],$*,[ |
462 | + m4_define([PCT_FORCE_GCC42],[no]) |
463 | + m4_foreach([pct_arg],[$*],[ |
464 | m4_case(pct_arg, |
465 | [use-gnulib], [ |
466 | m4_undefine([PCT_USE_GNULIB]) |
467 | @@ -35,6 +36,10 @@ |
468 | [ignore-shared-ptr], [ |
469 | m4_undefine([PCT_IGNORE_SHARED_PTR]) |
470 | m4_define([PCT_IGNORE_SHARED_PTR],[yes]) |
471 | + ], |
472 | + [force-gcc42], [ |
473 | + m4_undefine([PCT_FORCE_GCC42]) |
474 | + m4_define([PCT_FORCE_GCC42],[yes]) |
475 | ]) |
476 | ]) |
477 | |
478 | @@ -53,6 +58,7 @@ |
479 | m4_if(PCT_USE_GNULIB,yes,[ gl_EARLY ]) |
480 | |
481 | AC_REQUIRE([AC_PROG_CC]) |
482 | + AC_REQUIRE([PANDORA_MAC_GCC42]) |
483 | |
484 | dnl Once we can use a modern autoconf, we can use this |
485 | dnl AC_PROG_CC_C99 |
486 | @@ -61,6 +67,9 @@ |
487 | AM_PROG_CC_C_O |
488 | |
489 | gl_USE_SYSTEM_EXTENSIONS |
490 | + m4_if(PCT_FORCE_GCC42, [yes], [ |
491 | + AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION) |
492 | + ]) |
493 | |
494 | |
495 | PANDORA_LIBTOOL |
496 | @@ -99,15 +108,17 @@ |
497 | |
498 | AC_SYS_LARGEFILE |
499 | |
500 | + |
501 | PANDORA_CHECK_C_VERSION |
502 | PANDORA_CHECK_CXX_VERSION |
503 | |
504 | PANDORA_OPTIMIZE |
505 | PANDORA_64BIT |
506 | + |
507 | + gl_VISIBILITY |
508 | + |
509 | PANDORA_WARNINGS(PCT_ALL_ARGS) |
510 | |
511 | - gl_VISIBILITY |
512 | - |
513 | PANDORA_ENABLE_DTRACE |
514 | PANDORA_HEADER_ASSERT |
515 | |
516 | |
517 | === modified file 'm4/pandora_optimize.m4' |
518 | --- m4/pandora_optimize.m4 2009-07-08 07:37:38 +0000 |
519 | +++ m4/pandora_optimize.m4 2009-07-09 18:33:08 +0000 |
520 | @@ -39,12 +39,15 @@ |
521 | CXX="${CXX} -xlang=c99" |
522 | |
523 | AM_CFLAGS="-g -mt -xstrconst -Xa ${AM_CFLAGS}" |
524 | - AM_CXXFLAGS="-g -mt -compat=5 -library=stlport4 -template=no%extdef ${AM_CXXFLAGS}" |
525 | + AM_CXXFLAGS="-mt -compat=5 -library=stlport4 -template=no%extdef ${AM_CXXFLAGS}" |
526 | + |
527 | + DEBUG_CXXFLAGS="-g" |
528 | |
529 | dnl TODO: Make a test for -xO4 usability here |
530 | OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend -xbuiltin" |
531 | OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS}" |
532 | - OPTIMIZE_CXXFLAGS="${OPTIMIZE_FLAGS}" |
533 | + OPTIMIZE_CXXFLAGS="-g0 ${OPTIMIZE_FLAGS}" |
534 | + |
535 | ]) |
536 | |
537 | AC_ARG_WITH([debug], |
538 | |
539 | === modified file 'm4/pandora_warnings.m4' |
540 | --- m4/pandora_warnings.m4 2009-07-08 19:28:20 +0000 |
541 | +++ m4/pandora_warnings.m4 2009-07-10 17:30:57 +0000 |
542 | @@ -15,7 +15,7 @@ |
543 | m4_define([PW_WARN_ALWAYS_ON],[no]) |
544 | ifdef([m4_define],,[define([m4_define], defn([define]))]) |
545 | ifdef([m4_undefine],,[define([m4_undefine], defn([undefine]))]) |
546 | - m4_foreach([pw_arg],$*,[ |
547 | + m4_foreach([pw_arg],[$*],[ |
548 | m4_case(pw_arg, |
549 | [less-warnings],[ |
550 | m4_undefine([PW_LESS_WARNINGS]) |
551 | @@ -128,14 +128,14 @@ |
552 | NO_SHADOW="-Wno-shadow" |
553 | |
554 | m4_if(PW_LESS_WARNINGS,[no],[ |
555 | - BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing" |
556 | - CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum" |
557 | + BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing -Wuninitialized -Wparentheses -Wsequence-point" |
558 | + CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings" |
559 | CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast" |
560 | ],[ |
561 | BASE_WARNINGS_FULL="-Wformat ${NO_STRICT_ALIASING}" |
562 | ]) |
563 | |
564 | - BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wextra -Wundef -Wshadow -Wstrict-aliasing ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}" |
565 | + BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wextra -Wundef -Wshadow ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}" |
566 | CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}" |
567 | CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}" |
568 | |
569 | |
570 | === modified file 'tests/atomsmasher.c' |
571 | --- tests/atomsmasher.c 2009-07-07 21:57:24 +0000 |
572 | +++ tests/atomsmasher.c 2009-07-08 13:38:34 +0000 |
573 | @@ -156,8 +156,8 @@ |
574 | static test_return add_test(memcached_st *memc) |
575 | { |
576 | memcached_return rc; |
577 | - char *key= "foo"; |
578 | - char *value= "when we sanitize"; |
579 | + const char *key= "foo"; |
580 | + const char *value= "when we sanitize"; |
581 | unsigned long long setting_value; |
582 | |
583 | setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK); |
584 | |
585 | === modified file 'tests/function.c' |
586 | --- tests/function.c 2009-07-06 17:20:04 +0000 |
587 | +++ tests/function.c 2009-07-08 13:38:34 +0000 |
588 | @@ -38,7 +38,7 @@ |
589 | static uint32_t global_count; |
590 | |
591 | static pairs_st *global_pairs; |
592 | -static char *global_keys[GLOBAL_COUNT]; |
593 | +static const char *global_keys[GLOBAL_COUNT]; |
594 | static size_t global_keys_length[GLOBAL_COUNT]; |
595 | |
596 | static test_return init_test(memcached_st *not_used __attribute__((unused))) |
597 | @@ -299,8 +299,8 @@ |
598 | static test_return set_test(memcached_st *memc) |
599 | { |
600 | memcached_return rc; |
601 | - char *key= "foo"; |
602 | - char *value= "when we sanitize"; |
603 | + const char *key= "foo"; |
604 | + const char *value= "when we sanitize"; |
605 | |
606 | rc= memcached_set(memc, key, strlen(key), |
607 | value, strlen(value), |
608 | @@ -313,8 +313,9 @@ |
609 | static test_return append_test(memcached_st *memc) |
610 | { |
611 | memcached_return rc; |
612 | - char *key= "fig"; |
613 | - char *value= "we"; |
614 | + const char *key= "fig"; |
615 | + const char *in_value= "we"; |
616 | + char *out_value= NULL; |
617 | size_t value_length; |
618 | uint32_t flags; |
619 | |
620 | @@ -322,7 +323,7 @@ |
621 | assert(rc == MEMCACHED_SUCCESS); |
622 | |
623 | rc= memcached_set(memc, key, strlen(key), |
624 | - value, strlen(value), |
625 | + in_value, strlen(in_value), |
626 | (time_t)0, (uint32_t)0); |
627 | assert(rc == MEMCACHED_SUCCESS); |
628 | |
629 | @@ -336,12 +337,12 @@ |
630 | (time_t)0, (uint32_t)0); |
631 | assert(rc == MEMCACHED_SUCCESS); |
632 | |
633 | - value= memcached_get(memc, key, strlen(key), |
634 | + out_value= memcached_get(memc, key, strlen(key), |
635 | &value_length, &flags, &rc); |
636 | - assert(!memcmp(value, "we the people", strlen("we the people"))); |
637 | + assert(!memcmp(out_value, "we the people", strlen("we the people"))); |
638 | assert(strlen("we the people") == value_length); |
639 | assert(rc == MEMCACHED_SUCCESS); |
640 | - free(value); |
641 | + free(out_value); |
642 | |
643 | return 0; |
644 | } |
645 | @@ -349,7 +350,7 @@ |
646 | static test_return append_binary_test(memcached_st *memc) |
647 | { |
648 | memcached_return rc; |
649 | - char *key= "numbers"; |
650 | + const char *key= "numbers"; |
651 | unsigned int *store_ptr; |
652 | unsigned int store_list[] = { 23, 56, 499, 98, 32847, 0 }; |
653 | char *value; |
654 | @@ -395,9 +396,9 @@ |
655 | static test_return cas2_test(memcached_st *memc) |
656 | { |
657 | memcached_return rc; |
658 | - char *keys[]= {"fudge", "son", "food"}; |
659 | + const char *keys[]= {"fudge", "son", "food"}; |
660 | size_t key_length[]= {5, 3, 4}; |
661 | - char *value= "we the people"; |
662 | + const char *value= "we the people"; |
663 | size_t value_length= strlen("we the people"); |
664 | unsigned int x; |
665 | memcached_result_st results_obj; |
666 | @@ -442,7 +443,7 @@ |
667 | const char *key= "fun"; |
668 | size_t key_length= strlen(key); |
669 | const char *value= "we the people"; |
670 | - char* keys[2] = { (char*)key, NULL }; |
671 | + const char* keys[2] = { key, NULL }; |
672 | size_t keylengths[2] = { strlen(key), 0 }; |
673 | size_t value_length= strlen(value); |
674 | const char *value2= "change the value"; |
675 | @@ -499,8 +500,9 @@ |
676 | static test_return prepend_test(memcached_st *memc) |
677 | { |
678 | memcached_return rc; |
679 | - char *key= "fig"; |
680 | - char *value= "people"; |
681 | + const char *key= "fig"; |
682 | + const char *value= "people"; |
683 | + char *out_value= NULL; |
684 | size_t value_length; |
685 | uint32_t flags; |
686 | |
687 | @@ -522,12 +524,12 @@ |
688 | (time_t)0, (uint32_t)0); |
689 | assert(rc == MEMCACHED_SUCCESS); |
690 | |
691 | - value= memcached_get(memc, key, strlen(key), |
692 | + out_value= memcached_get(memc, key, strlen(key), |
693 | &value_length, &flags, &rc); |
694 | - assert(!memcmp(value, "we the people", strlen("we the people"))); |
695 | + assert(!memcmp(out_value, "we the people", strlen("we the people"))); |
696 | assert(strlen("we the people") == value_length); |
697 | assert(rc == MEMCACHED_SUCCESS); |
698 | - free(value); |
699 | + free(out_value); |
700 | |
701 | return 0; |
702 | } |
703 | @@ -539,8 +541,8 @@ |
704 | static test_return add_test(memcached_st *memc) |
705 | { |
706 | memcached_return rc; |
707 | - char *key= "foo"; |
708 | - char *value= "when we sanitize"; |
709 | + const char *key= "foo"; |
710 | + const char *value= "when we sanitize"; |
711 | unsigned long long setting_value; |
712 | |
713 | setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK); |
714 | @@ -587,9 +589,9 @@ |
715 | static test_return replace_test(memcached_st *memc) |
716 | { |
717 | memcached_return rc; |
718 | - char *key= "foo"; |
719 | - char *value= "when we sanitize"; |
720 | - char *original= "first we insert some data"; |
721 | + const char *key= "foo"; |
722 | + const char *value= "when we sanitize"; |
723 | + const char *original= "first we insert some data"; |
724 | |
725 | rc= memcached_set(memc, key, strlen(key), |
726 | original, strlen(original), |
727 | @@ -607,8 +609,8 @@ |
728 | static test_return delete_test(memcached_st *memc) |
729 | { |
730 | memcached_return rc; |
731 | - char *key= "foo"; |
732 | - char *value= "when we sanitize"; |
733 | + const char *key= "foo"; |
734 | + const char *value= "when we sanitize"; |
735 | |
736 | rc= memcached_set(memc, key, strlen(key), |
737 | value, strlen(value), |
738 | @@ -642,19 +644,19 @@ |
739 | |
740 | static test_return memcached_server_cursor_test(memcached_st *memc) |
741 | { |
742 | - char *context= "foo bad"; |
743 | + char context[8]; |
744 | + strcpy(context, "foo bad"); |
745 | memcached_server_function callbacks[1]; |
746 | |
747 | callbacks[0]= server_function; |
748 | memcached_server_cursor(memc, callbacks, context, 1); |
749 | - |
750 | return 0; |
751 | } |
752 | |
753 | static test_return bad_key_test(memcached_st *memc) |
754 | { |
755 | memcached_return rc; |
756 | - char *key= "foo bad"; |
757 | + const char *key= "foo bad"; |
758 | char *string; |
759 | size_t string_length; |
760 | uint32_t flags; |
761 | @@ -687,7 +689,7 @@ |
762 | assert(!string); |
763 | |
764 | /* Test multi key for bad keys */ |
765 | - char *keys[] = { "GoodKey", "Bad Key", "NotMine" }; |
766 | + const char *keys[] = { "GoodKey", "Bad Key", "NotMine" }; |
767 | size_t key_lengths[] = { 7, 7, 7 }; |
768 | set= 1; |
769 | rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set); |
770 | @@ -756,7 +758,7 @@ |
771 | static test_return read_through(memcached_st *memc) |
772 | { |
773 | memcached_return rc; |
774 | - char *key= "foo"; |
775 | + const char *key= "foo"; |
776 | char *string; |
777 | size_t string_length; |
778 | uint32_t flags; |
779 | @@ -817,7 +819,7 @@ |
780 | static test_return get_test(memcached_st *memc) |
781 | { |
782 | memcached_return rc; |
783 | - char *key= "foo"; |
784 | + const char *key= "foo"; |
785 | char *string; |
786 | size_t string_length; |
787 | uint32_t flags; |
788 | @@ -838,8 +840,8 @@ |
789 | static test_return get_test2(memcached_st *memc) |
790 | { |
791 | memcached_return rc; |
792 | - char *key= "foo"; |
793 | - char *value= "when we sanitize"; |
794 | + const char *key= "foo"; |
795 | + const char *value= "when we sanitize"; |
796 | char *string; |
797 | size_t string_length; |
798 | uint32_t flags; |
799 | @@ -865,8 +867,8 @@ |
800 | static test_return set_test2(memcached_st *memc) |
801 | { |
802 | memcached_return rc; |
803 | - char *key= "foo"; |
804 | - char *value= "train in the brain"; |
805 | + const char *key= "foo"; |
806 | + const char *value= "train in the brain"; |
807 | size_t value_length= strlen(value); |
808 | unsigned int x; |
809 | |
810 | @@ -915,7 +917,7 @@ |
811 | static test_return get_test3(memcached_st *memc) |
812 | { |
813 | memcached_return rc; |
814 | - char *key= "foo"; |
815 | + const char *key= "foo"; |
816 | char *value; |
817 | size_t value_length= 8191; |
818 | char *string; |
819 | @@ -951,7 +953,7 @@ |
820 | static test_return get_test4(memcached_st *memc) |
821 | { |
822 | memcached_return rc; |
823 | - char *key= "foo"; |
824 | + const char *key= "foo"; |
825 | char *value; |
826 | size_t value_length= 8191; |
827 | char *string; |
828 | @@ -998,7 +1000,7 @@ |
829 | ** Request the same key twice, to ensure that we hash to the same server |
830 | ** (so that we have multiple response values queued up) ;-) |
831 | */ |
832 | - char *keys[]= { "key", "key" }; |
833 | + const char *keys[]= { "key", "key" }; |
834 | size_t lengths[]= { 3, 3 }; |
835 | uint32_t flags; |
836 | size_t rlen; |
837 | @@ -1048,8 +1050,8 @@ |
838 | { |
839 | uint64_t new_number; |
840 | memcached_return rc; |
841 | - char *key= "number"; |
842 | - char *value= "0"; |
843 | + const char *key= "number"; |
844 | + const char *value= "0"; |
845 | |
846 | rc= memcached_set(memc, key, strlen(key), |
847 | value, strlen(value), |
848 | @@ -1075,7 +1077,7 @@ |
849 | { |
850 | uint64_t new_number; |
851 | memcached_return rc; |
852 | - char *key= "number"; |
853 | + const char *key= "number"; |
854 | uint64_t initial= 0; |
855 | |
856 | rc= memcached_increment_with_initial(memc, key, strlen(key), |
857 | @@ -1095,8 +1097,8 @@ |
858 | { |
859 | uint64_t new_number; |
860 | memcached_return rc; |
861 | - char *key= "number"; |
862 | - char *value= "3"; |
863 | + const char *key= "number"; |
864 | + const char *value= "3"; |
865 | |
866 | rc= memcached_set(memc, key, strlen(key), |
867 | value, strlen(value), |
868 | @@ -1122,7 +1124,7 @@ |
869 | { |
870 | uint64_t new_number; |
871 | memcached_return rc; |
872 | - char *key= "number"; |
873 | + const char *key= "number"; |
874 | uint64_t initial= 3; |
875 | |
876 | rc= memcached_decrement_with_initial(memc, key, strlen(key), |
877 | @@ -1141,8 +1143,8 @@ |
878 | static test_return quit_test(memcached_st *memc) |
879 | { |
880 | memcached_return rc; |
881 | - char *key= "fudge"; |
882 | - char *value= "sanford and sun"; |
883 | + const char *key= "fudge"; |
884 | + const char *value= "sanford and sun"; |
885 | |
886 | rc= memcached_set(memc, key, strlen(key), |
887 | value, strlen(value), |
888 | @@ -1161,7 +1163,7 @@ |
889 | static test_return mget_result_test(memcached_st *memc) |
890 | { |
891 | memcached_return rc; |
892 | - char *keys[]= {"fudge", "son", "food"}; |
893 | + const char *keys[]= {"fudge", "son", "food"}; |
894 | size_t key_length[]= {5, 3, 4}; |
895 | unsigned int x; |
896 | |
897 | @@ -1218,7 +1220,7 @@ |
898 | static test_return mget_result_alloc_test(memcached_st *memc) |
899 | { |
900 | memcached_return rc; |
901 | - char *keys[]= {"fudge", "son", "food"}; |
902 | + const char *keys[]= {"fudge", "son", "food"}; |
903 | size_t key_length[]= {5, 3, 4}; |
904 | unsigned int x; |
905 | |
906 | @@ -1280,7 +1282,7 @@ |
907 | static test_return mget_result_function(memcached_st *memc) |
908 | { |
909 | memcached_return rc; |
910 | - char *keys[]= {"fudge", "son", "food"}; |
911 | + const char *keys[]= {"fudge", "son", "food"}; |
912 | size_t key_length[]= {5, 3, 4}; |
913 | unsigned int x; |
914 | unsigned int counter; |
915 | @@ -1311,7 +1313,7 @@ |
916 | static test_return mget_test(memcached_st *memc) |
917 | { |
918 | memcached_return rc; |
919 | - char *keys[]= {"fudge", "son", "food"}; |
920 | + const char *keys[]= {"fudge", "son", "food"}; |
921 | size_t key_length[]= {5, 3, 4}; |
922 | unsigned int x; |
923 | uint32_t flags; |
924 | @@ -1695,7 +1697,7 @@ |
925 | key_lengths[x]= strlen(keys[x]); |
926 | } |
927 | |
928 | - rc= memcached_mget(memc, keys, key_lengths, KEY_COUNT); |
929 | + rc= memcached_mget(memc, (const char **)keys, key_lengths, KEY_COUNT); |
930 | assert(rc == MEMCACHED_SUCCESS); |
931 | |
932 | /* Turn this into a help function */ |
933 | @@ -1726,7 +1728,7 @@ |
934 | static test_return user_supplied_bug4(memcached_st *memc) |
935 | { |
936 | memcached_return rc; |
937 | - char *keys[]= {"fudge", "son", "food"}; |
938 | + const char *keys[]= {"fudge", "son", "food"}; |
939 | size_t key_length[]= {5, 3, 4}; |
940 | unsigned int x; |
941 | uint32_t flags; |
942 | @@ -1789,7 +1791,7 @@ |
943 | static test_return user_supplied_bug5(memcached_st *memc) |
944 | { |
945 | memcached_return rc; |
946 | - char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; |
947 | + const char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; |
948 | size_t key_length[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")}; |
949 | char return_key[MEMCACHED_MAX_KEY]; |
950 | size_t return_key_length; |
951 | @@ -1847,7 +1849,7 @@ |
952 | static test_return user_supplied_bug6(memcached_st *memc) |
953 | { |
954 | memcached_return rc; |
955 | - char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; |
956 | + const char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; |
957 | size_t key_length[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")}; |
958 | char return_key[MEMCACHED_MAX_KEY]; |
959 | size_t return_key_length; |
960 | @@ -1916,7 +1918,7 @@ |
961 | memcached_st *memc_clone; |
962 | |
963 | memcached_server_st *servers; |
964 | - 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"; |
965 | + 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"; |
966 | |
967 | servers= memcached_servers_parse(server_list); |
968 | assert(servers); |
969 | @@ -1943,8 +1945,8 @@ |
970 | static test_return user_supplied_bug7(memcached_st *memc) |
971 | { |
972 | memcached_return rc; |
973 | - char *keys= "036790384900"; |
974 | - size_t key_length= strlen("036790384900"); |
975 | + const char *keys= "036790384900"; |
976 | + size_t key_length= strlen(keys); |
977 | char return_key[MEMCACHED_MAX_KEY]; |
978 | size_t return_key_length; |
979 | char *value; |
980 | @@ -1987,7 +1989,7 @@ |
981 | static test_return user_supplied_bug9(memcached_st *memc) |
982 | { |
983 | memcached_return rc; |
984 | - char *keys[]= {"UDATA:edevil@sapo.pt", "fudge&*@#", "for^#@&$not"}; |
985 | + const char *keys[]= {"UDATA:edevil@sapo.pt", "fudge&*@#", "for^#@&$not"}; |
986 | size_t key_length[3]; |
987 | unsigned int x; |
988 | uint32_t flags; |
989 | @@ -2031,7 +2033,7 @@ |
990 | /* We are testing with aggressive timeout to get failures */ |
991 | static test_return user_supplied_bug10(memcached_st *memc) |
992 | { |
993 | - char *key= "foo"; |
994 | + const char *key= "foo"; |
995 | char *value; |
996 | size_t value_length= 512; |
997 | unsigned int x; |
998 | @@ -2074,7 +2076,7 @@ |
999 | */ |
1000 | static test_return user_supplied_bug11(memcached_st *memc) |
1001 | { |
1002 | - char *key= "foo"; |
1003 | + const char *key= "foo"; |
1004 | char *value; |
1005 | size_t value_length= 512; |
1006 | unsigned int x; |
1007 | @@ -2199,7 +2201,7 @@ |
1008 | size_t setter= 1; |
1009 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter); |
1010 | memcached_return rc; |
1011 | - char *key= "foo"; |
1012 | + const char *key= "foo"; |
1013 | char *value; |
1014 | size_t value_length= 18000; |
1015 | char *string; |
1016 | @@ -2243,7 +2245,7 @@ |
1017 | { |
1018 | uint32_t x; |
1019 | memcached_return rc; |
1020 | - char *key= "mykey"; |
1021 | + const char *key= "mykey"; |
1022 | char *value; |
1023 | size_t length; |
1024 | uint32_t flags; |
1025 | @@ -2280,7 +2282,7 @@ |
1026 | static test_return user_supplied_bug16(memcached_st *memc) |
1027 | { |
1028 | memcached_return rc; |
1029 | - char *key= "mykey"; |
1030 | + const char *key= "mykey"; |
1031 | char *value; |
1032 | size_t length; |
1033 | uint32_t flags; |
1034 | @@ -2306,8 +2308,8 @@ |
1035 | static test_return user_supplied_bug17(memcached_st *memc) |
1036 | { |
1037 | memcached_return rc; |
1038 | - char *key= "豆瓣"; |
1039 | - char *value="我们在炎热抑郁的夏天无法停止豆瓣"; |
1040 | + const char *key= "豆瓣"; |
1041 | + const char *value="我们在炎热抑郁的夏天无法停止豆瓣"; |
1042 | char *value2; |
1043 | size_t length; |
1044 | uint32_t flags; |
1045 | @@ -2358,9 +2360,9 @@ |
1046 | { |
1047 | memcached_return status; |
1048 | memcached_result_st *result, result_obj; |
1049 | - char *key = "abc"; |
1050 | + const char *key = "abc"; |
1051 | size_t key_len = strlen("abc"); |
1052 | - char *value = "foobar"; |
1053 | + const char *value = "foobar"; |
1054 | size_t value_len = strlen(value); |
1055 | |
1056 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, 1); |
1057 | @@ -3139,7 +3141,9 @@ |
1058 | |
1059 | /* Set to Zero, and then Set to something too large */ |
1060 | { |
1061 | - char *long_key; |
1062 | + char long_key[255]; |
1063 | + memset(long_key, 0, 255); |
1064 | + |
1065 | rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, NULL); |
1066 | assert(rc == MEMCACHED_SUCCESS); |
1067 | |
1068 | @@ -3149,13 +3153,13 @@ |
1069 | |
1070 | /* Test a long key for failure */ |
1071 | /* TODO, extend test to determine based on setting, what result should be */ |
1072 | - long_key= "Thisismorethentheallottednumberofcharacters"; |
1073 | + strcpy(long_key, "Thisismorethentheallottednumberofcharacters"); |
1074 | rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key); |
1075 | //assert(rc == MEMCACHED_BAD_KEY_PROVIDED); |
1076 | assert(rc == MEMCACHED_SUCCESS); |
1077 | |
1078 | /* Now test a key with spaces (which will fail from long key, since bad key is not set) */ |
1079 | - long_key= "This is more then the allotted number of characters"; |
1080 | + strcpy(long_key, "This is more then the allotted number of characters"); |
1081 | rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key); |
1082 | assert(rc == MEMCACHED_BAD_KEY_PROVIDED); |
1083 | |
1084 | @@ -3163,7 +3167,7 @@ |
1085 | rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_VERIFY_KEY, 1); |
1086 | assert(rc == MEMCACHED_SUCCESS); |
1087 | |
1088 | - long_key= "dog cat"; |
1089 | + strcpy(long_key, "dog cat"); |
1090 | rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key); |
1091 | assert(rc == MEMCACHED_BAD_KEY_PROVIDED); |
1092 | } |
1093 | @@ -3429,7 +3433,7 @@ |
1094 | /* Try setting an illegal cas value (should not return an error to |
1095 | * the caller (because we don't expect a return message from the server) |
1096 | */ |
1097 | - char* keys[]= {"0"}; |
1098 | + const char* keys[]= {"0"}; |
1099 | size_t lengths[]= {1}; |
1100 | size_t length; |
1101 | uint32_t flags; |
1102 | @@ -3668,7 +3672,7 @@ |
1103 | memcached_st *memc_clone= memcached_clone(NULL, memc); |
1104 | memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, 0); |
1105 | |
1106 | - char *keys[]= { "bubba", "key1", "key2", "key3" }; |
1107 | + const char *keys[]= { "bubba", "key1", "key2", "key3" }; |
1108 | size_t len[]= { 5, 4, 4, 4 }; |
1109 | |
1110 | for (int x=0; x< 4; ++x) |
1111 | @@ -3705,7 +3709,7 @@ |
1112 | |
1113 | for (int x= 'a'; x <= 'z'; ++x) |
1114 | { |
1115 | - char key[2]= { [0]= (char)x }; |
1116 | + const char key[2]= { [0]= (const char)x }; |
1117 | |
1118 | rc= memcached_mget_by_key(new_clone, key, 1, keys, len, 4); |
1119 | assert(rc == MEMCACHED_SUCCESS); |
1120 | @@ -3737,7 +3741,7 @@ |
1121 | MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS); |
1122 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, --repl); |
1123 | |
1124 | - char *keys[]= { "bubba", "key1", "key2", "key3" }; |
1125 | + const char *keys[]= { "bubba", "key1", "key2", "key3" }; |
1126 | size_t len[]= { 5, 4, 4, 4 }; |
1127 | |
1128 | for (int x=0; x< 4; ++x) |
1129 | @@ -3764,7 +3768,7 @@ |
1130 | { |
1131 | for (int x= 'a'; x <= 'z'; ++x) |
1132 | { |
1133 | - char key[2]= { [0]= (char)x }; |
1134 | + const char key[2]= { [0]= (const char)x }; |
1135 | |
1136 | rc= memcached_mget_by_key(memc_clone, key, 1, keys, len, 4); |
1137 | assert(rc == MEMCACHED_SUCCESS); |
1138 | @@ -3907,8 +3911,8 @@ |
1139 | for (x= 0; x < num_iters;x++) |
1140 | { |
1141 | memcached_return rc; |
1142 | - char *key= "foo"; |
1143 | - char *value= "when we sanitize"; |
1144 | + const char *key= "foo"; |
1145 | + const char *value= "when we sanitize"; |
1146 | uint16_t *expected_ids= get_udp_request_ids(memc); |
1147 | unsigned int server_key= memcached_generate_hash(memc,key,strlen(key)); |
1148 | size_t init_offset= memc->hosts[server_key].write_buffer_offset; |
1149 | @@ -3947,7 +3951,7 @@ |
1150 | static test_return udp_set_too_big_test(memcached_st *memc) |
1151 | { |
1152 | memcached_return rc; |
1153 | - char *key= "bar"; |
1154 | + const char *key= "bar"; |
1155 | char value[MAX_UDP_DATAGRAM_LENGTH]; |
1156 | uint16_t *expected_ids= get_udp_request_ids(memc); |
1157 | rc= memcached_set(memc, key, strlen(key), |
1158 | @@ -3964,7 +3968,7 @@ |
1159 | for (x= 0; x < num_iters;x++) |
1160 | { |
1161 | memcached_return rc; |
1162 | - char *key= "foo"; |
1163 | + const char *key= "foo"; |
1164 | uint16_t *expected_ids=get_udp_request_ids(memc); |
1165 | unsigned int server_key= memcached_generate_hash(memc, key, strlen(key)); |
1166 | size_t init_offset= memc->hosts[server_key].write_buffer_offset; |
1167 | @@ -4026,8 +4030,8 @@ |
1168 | static test_return udp_incr_test(memcached_st *memc) |
1169 | { |
1170 | memcached_return rc; |
1171 | - char *key= "incr"; |
1172 | - char *value= "1"; |
1173 | + const char *key= "incr"; |
1174 | + const char *value= "1"; |
1175 | rc= memcached_set(memc, key, strlen(key), |
1176 | value, strlen(value), |
1177 | (time_t)0, (uint32_t)0); |
1178 | @@ -4045,8 +4049,8 @@ |
1179 | static test_return udp_decr_test(memcached_st *memc) |
1180 | { |
1181 | memcached_return rc; |
1182 | - char *key= "decr"; |
1183 | - char *value= "1"; |
1184 | + const char *key= "decr"; |
1185 | + const char *value= "1"; |
1186 | rc= memcached_set(memc, key, strlen(key), |
1187 | value, strlen(value), |
1188 | (time_t)0, (uint32_t)0); |
1189 | @@ -4086,7 +4090,7 @@ |
1190 | static test_return udp_get_test(memcached_st *memc) |
1191 | { |
1192 | memcached_return rc; |
1193 | - char *key= "foo"; |
1194 | + const char *key= "foo"; |
1195 | size_t vlen; |
1196 | uint16_t *expected_ids = get_udp_request_ids(memc); |
1197 | char *val= memcached_get(memc, key, strlen(key), &vlen, (uint32_t)0, &rc); |
1198 | @@ -4130,7 +4134,7 @@ |
1199 | return TEST_SUCCESS; |
1200 | } |
1201 | |
1202 | -static char *list[]= |
1203 | +static const char *list[]= |
1204 | { |
1205 | "apple", |
1206 | "beat", |
1207 | @@ -4163,7 +4167,7 @@ |
1208 | static test_return md5_run (memcached_st *memc __attribute__((unused))) |
1209 | { |
1210 | uint32_t x; |
1211 | - char **ptr; |
1212 | + const char **ptr; |
1213 | uint32_t values[]= { 3195025439U, 2556848621U, 3724893440U, 3332385401U, |
1214 | 245758794U, 2550894432U, 121710495U, 3053817768U, |
1215 | 1250994555U, 1862072655U, 2631955953U, 2951528551U, |
1216 | @@ -4187,7 +4191,7 @@ |
1217 | static test_return crc_run (memcached_st *memc __attribute__((unused))) |
1218 | { |
1219 | uint32_t x; |
1220 | - char **ptr; |
1221 | + const char **ptr; |
1222 | uint32_t values[]= { 10542U, 22009U, 14526U, 19510U, 19432U, 10199U, 20634U, |
1223 | 9369U, 11511U, 10362U, 7893U, 31289U, 11313U, 9354U, |
1224 | 7621U, 30628U, 15218U, 25967U, 2695U, 9380U, |
1225 | @@ -4207,7 +4211,7 @@ |
1226 | static test_return fnv1_64_run (memcached_st *memc __attribute__((unused))) |
1227 | { |
1228 | uint32_t x; |
1229 | - char **ptr; |
1230 | + const char **ptr; |
1231 | uint32_t values[]= { 473199127U, 4148981457U, 3971873300U, 3257986707U, |
1232 | 1722477987U, 2991193800U, 4147007314U, 3633179701U, |
1233 | 1805162104U, 3503289120U, 3395702895U, 3325073042U, |
1234 | @@ -4230,7 +4234,7 @@ |
1235 | static test_return fnv1a_64_run (memcached_st *memc __attribute__((unused))) |
1236 | { |
1237 | uint32_t x; |
1238 | - char **ptr; |
1239 | + const char **ptr; |
1240 | uint32_t values[]= { 1488911807U, 2500855813U, 1510099634U, 1390325195U, |
1241 | 3647689787U, 3241528582U, 1669328060U, 2604311949U, |
1242 | 734810122U, 1516407546U, 560948863U, 1767346780U, |
1243 | @@ -4253,7 +4257,7 @@ |
1244 | static test_return fnv1_32_run (memcached_st *memc __attribute__((unused))) |
1245 | { |
1246 | uint32_t x; |
1247 | - char **ptr; |
1248 | + const char **ptr; |
1249 | uint32_t values[]= { 67176023U, 1190179409U, 2043204404U, 3221866419U, |
1250 | 2567703427U, 3787535528U, 4147287986U, 3500475733U, |
1251 | 344481048U, 3865235296U, 2181839183U, 119581266U, |
1252 | @@ -4277,7 +4281,7 @@ |
1253 | static test_return fnv1a_32_run (memcached_st *memc __attribute__((unused))) |
1254 | { |
1255 | uint32_t x; |
1256 | - char **ptr; |
1257 | + const char **ptr; |
1258 | uint32_t values[]= { 280767167U, 2421315013U, 3072375666U, 855001899U, |
1259 | 459261019U, 3521085446U, 18738364U, 1625305005U, |
1260 | 2162232970U, 777243802U, 3323728671U, 132336572U, |
1261 | @@ -4300,7 +4304,7 @@ |
1262 | static test_return hsieh_run (memcached_st *memc __attribute__((unused))) |
1263 | { |
1264 | uint32_t x; |
1265 | - char **ptr; |
1266 | + const char **ptr; |
1267 | #ifdef HAVE_HSIEH_HASH |
1268 | uint32_t values[]= { 3738850110, 3636226060, 3821074029, 3489929160, 3485772682, 80540287, |
1269 | 1805464076, 1895033657, 409795758, 979934958, 3634096985, 1284445480, |
1270 | @@ -4325,7 +4329,7 @@ |
1271 | static test_return murmur_run (memcached_st *memc __attribute__((unused))) |
1272 | { |
1273 | uint32_t x; |
1274 | - char **ptr; |
1275 | + const char **ptr; |
1276 | uint32_t values[]= { 473199127U, 4148981457U, 3971873300U, 3257986707U, |
1277 | 1722477987U, 2991193800U, 4147007314U, 3633179701U, |
1278 | 1805162104U, 3503289120U, 3395702895U, 3325073042U, |
1279 | @@ -4348,7 +4352,7 @@ |
1280 | static test_return jenkins_run (memcached_st *memc __attribute__((unused))) |
1281 | { |
1282 | uint32_t x; |
1283 | - char **ptr; |
1284 | + const char **ptr; |
1285 | uint32_t values[]= { 1442444624U, 4253821186U, 1885058256U, 2120131735U, |
1286 | 3261968576U, 3515188778U, 4232909173U, 4288625128U, |
1287 | 1812047395U, 3689182164U, 2502979932U, 1214050606U, |
1288 | |
1289 | === modified file 'tests/ketama_test_cases.h' |
1290 | --- tests/ketama_test_cases.h 2008-11-03 22:20:00 +0000 |
1291 | +++ tests/ketama_test_cases.h 2009-07-08 13:38:34 +0000 |
1292 | @@ -1,8 +1,8 @@ |
1293 | typedef struct { |
1294 | - char *key; |
1295 | + const char *key; |
1296 | unsigned long hash1; |
1297 | unsigned long hash2; |
1298 | - char *server; |
1299 | + const char *server; |
1300 | } TestCase; |
1301 | |
1302 | static TestCase test_cases[99] = { |
1303 | |
1304 | === modified file 'tests/udp.c' |
1305 | --- tests/udp.c 2008-08-19 18:07:14 +0000 |
1306 | +++ tests/udp.c 2009-07-08 13:38:34 +0000 |
1307 | @@ -22,8 +22,8 @@ |
1308 | test_return set_test(memcached_st *memc) |
1309 | { |
1310 | memcached_return rc; |
1311 | - char *key= "foo"; |
1312 | - char *value= "when we sanitize"; |
1313 | + const char *key= "foo"; |
1314 | + const char *value= "when we sanitize"; |
1315 | |
1316 | rc= memcached_set(memc, key, strlen(key), |
1317 | 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 *.