Merge lp:~mordred/libmemcached/write-strings into lp:~tangent-org/libmemcached/trunk

Proposed by Monty Taylor
Status: Merged
Merged at revision: not available
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
Reviewer Review Type Date Requested Status
Brian Aker Pending
Review via email: mp+8774@code.launchpad.net

This proposal supersedes a proposal from 2009-07-11.

To post a comment you must log in.
Revision history for this message
Monty Taylor (mordred) wrote : Posted in a previous version of this proposal

Updated to latest pandora-build macros.
Fixed warnings related to -Wwrite-strings - which are treating string literals as char * instead of const char *.

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

Subscribers

People subscribed via source and target branches

to all changes: