Merge lp:~trond-norbye/libmemcached/mingw32 into lp:~tangent-org/libmemcached/trunk

Proposed by Trond Norbye
Status: Merged
Merged at revision: 897
Proposed branch: lp:~trond-norbye/libmemcached/mingw32
Merge into: lp:~tangent-org/libmemcached/trunk
Diff against target: 811 lines (+160/-109) (has conflicts)
20 files modified
.bzrignore (+1/-0)
clients/memcapable.c (+51/-5)
configure.ac (+4/-0)
libhashkit/common.h (+4/-4)
libmemcached/auto.c (+3/-3)
libmemcached/connect.c (+1/-2)
libmemcached/delete.c (+2/-2)
libmemcached/do.c (+3/-3)
libmemcached/do.h (+2/-2)
libmemcached/get.c (+12/-12)
libmemcached/include.am (+1/-1)
libmemcached/io.c (+1/-1)
libmemcached/io.h (+2/-2)
libmemcached/memcached.c (+4/-3)
libmemcached/memcached.h (+1/-1)
libmemcached/sasl.c (+41/-54)
libmemcached/stats.c (+3/-3)
libmemcached/storage.c (+4/-4)
libmemcached/watchpoint.h (+15/-6)
tests/include.am (+5/-1)
Text conflict in configure.ac
To merge this branch: bzr merge lp:~trond-norbye/libmemcached/mingw32
Reviewer Review Type Date Requested Status
Libmemcached-developers Pending
Review via email: mp+31511@code.launchpad.net

Description of the change

Changes required to build libmemcached on win64 (using cross compiliation)

To post a comment you must log in.
895. By Trond Norbye

Fix ntohll test.. we need to link, not just compile ;-)

896. By Trond Norbye

Remove impossible assert

The Sun Studio compiler generates an error because it's impossible to get
there.

897. By Trond Norbye

Add option -P and -T to memcapable

The two options come in handy if you're trying to debug a failing test case

898. By Trond Norbye

Update memcapable quiet command test to work with servers that cork

899. By Trond Norbye <trond@ubuntu>

Check the return code from fgets in memcapable

900. By Trond Norbye

Fixed test in memcached_set_sasl_auth_data

901. By Trond Norbye

Fixed SASL authentication bits

902. By Trond Norbye

Refactor: rename __write_vector_st

Symbol names with double underscores generate a compile warning on
some platforms causing a build break. Renamed to
libmemcached_io_vector_st.

903. By Trond Norbye

Don't include system headers within an extern C block

904. By Trond Norbye

Refactor: Renamed internal stack dump function

Some compilers generate a warning for symbols starting with double
underscores causing a build break. Renamed the function to
libmemcached_stack_dump instead, and added an implementation for
Solaris while I'm touching the code

905. By Trond Norbye

Update libmemcached version number due to change of struct size

906. By Trond Norbye

Fixed dtrace enabled compilations

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2010-08-01 21:13:16 +0000
3+++ .bzrignore 2010-09-14 07:57:51 +0000
4@@ -72,6 +72,7 @@
5 libmemcached-?.??/
6 libmemcached.pop
7 libmemcached/configure.h
8+libmemcached/dtrace_probes.h
9 libmemcached/memcached_configure.h
10 libmemcached_examples.pop
11 libmemcachedutil.pop
12
13=== modified file 'clients/memcapable.c'
14--- clients/memcapable.c 2010-07-28 18:48:18 +0000
15+++ clients/memcapable.c 2010-09-14 07:57:51 +0000
16@@ -303,6 +303,7 @@
17 ssize_t nr= timeout_io_op(sock, POLLIN, ((char*) buf) + offset, len - offset);
18 switch (nr) {
19 case -1 :
20+ fprintf(stderr, "Errno: %d %s\n", get_socket_errno(), strerror(errno));
21 verify(get_socket_errno() == EINTR || get_socket_errno() == EAGAIN);
22 break;
23 case 0:
24@@ -321,7 +322,7 @@
25 */
26 static enum test_return recv_packet(response *rsp)
27 {
28- execute(retry_read(rsp, sizeof (protocol_binary_response_no_extras)));
29+ execute(retry_read(rsp, sizeof(protocol_binary_response_no_extras)));
30
31 /* Fix the byte order in the packet header */
32 rsp->plain.message.header.response.keylen=
33@@ -693,10 +694,12 @@
34 cmd.plain.message.header.request.cas=
35 htonll(rsp.plain.message.header.response.cas - 1);
36 execute(resend_packet(&cmd));
37+ execute(send_binary_noop());
38 execute(recv_packet(&rsp));
39 verify(validate_response_header(&rsp, cc, PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS));
40+ execute(receive_binary_noop());
41
42- return test_binary_noop();
43+ return TEST_PASS;
44 }
45
46 static enum test_return test_binary_set(void)
47@@ -733,7 +736,9 @@
48 else
49 expected_result= PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS;
50
51+ execute(send_binary_noop());
52 execute(recv_packet(&rsp));
53+ execute(receive_binary_noop());
54 verify(validate_response_header(&rsp, cc, expected_result));
55 }
56 else
57@@ -790,7 +795,9 @@
58 else
59 expected_result=PROTOCOL_BINARY_RESPONSE_SUCCESS;
60
61+ execute(send_binary_noop());
62 execute(recv_packet(&rsp));
63+ execute(receive_binary_noop());
64 verify(validate_response_header(&rsp, cc, expected_result));
65
66 if (ii == 0)
67@@ -817,7 +824,9 @@
68 cmd.plain.message.header.request.cas=
69 htonll(rsp.plain.message.header.response.cas - 1);
70 execute(resend_packet(&cmd));
71+ execute(send_binary_noop());
72 execute(recv_packet(&rsp));
73+ execute(receive_binary_noop());
74 verify(validate_response_header(&rsp, cc, PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS));
75
76 return TEST_PASS;
77@@ -841,8 +850,10 @@
78
79 /* The delete shouldn't work the first time, because the item isn't there */
80 execute(send_packet(&cmd));
81+ execute(send_binary_noop());
82 execute(recv_packet(&rsp));
83 verify(validate_response_header(&rsp, cc, PROTOCOL_BINARY_RESPONSE_KEY_ENOENT));
84+ execute(receive_binary_noop());
85 execute(binary_set_item(key, key));
86
87 /* The item should be present now, resend*/
88@@ -1869,8 +1880,10 @@
89 const char *hostname= "localhost";
90 const char *port= "11211";
91 int cmd;
92+ bool prompt= false;
93+ const char *testname= NULL;
94
95- while ((cmd= getopt(argc, argv, "t:vch:p:?")) != EOF)
96+ while ((cmd= getopt(argc, argv, "t:vch:p:PT:?")) != EOF)
97 {
98 switch (cmd) {
99 case 't':
100@@ -1889,11 +1902,21 @@
101 break;
102 case 'p': port= optarg;
103 break;
104+ case 'P': prompt= true;
105+ break;
106+ case 'T': testname= optarg;
107+ break;
108 default:
109- fprintf(stderr, "Usage: %s [-h hostname] [-p port] [-c] [-v] [-t n]\n"
110+ fprintf(stderr, "Usage: %s [-h hostname] [-p port] [-c] [-v] [-t n]"
111+ " [-P] [-T testname]'\n"
112 "\t-c\tGenerate coredump if a test fails\n"
113 "\t-v\tVerbose test output (print out the assertion)\n"
114- "\t-t n\tSet the timeout for io-operations to n seconds\n",
115+ "\t-t n\tSet the timeout for io-operations to n seconds\n"
116+ "\t-P\tPrompt the user before starting a test.\n"
117+ "\t\t\t\"skip\" will skip the test\n"
118+ "\t\t\t\"quit\" will terminate memcapable\n"
119+ "\t\t\tEverything else will start the test\n"
120+ "\t-T n\tJust run the test named n\n",
121 argv[0]);
122 return 1;
123 }
124@@ -1910,10 +1933,33 @@
125
126 for (int ii= 0; testcases[ii].description != NULL; ++ii)
127 {
128+ if (testname != NULL && strcmp(testcases[ii].description, testname) != 0)
129+ continue;
130+
131 ++total;
132 fprintf(stdout, "%-40s", testcases[ii].description);
133 fflush(stdout);
134
135+ if (prompt)
136+ {
137+ fprintf(stdout, "\nPress <return> when you are ready? ");
138+ char buffer[80] = {0};
139+ if (fgets(buffer, sizeof(buffer), stdin) != NULL) {
140+ if (strncmp(buffer, "skip", 4) == 0)
141+ {
142+ fprintf(stdout, "%-40s%s\n", testcases[ii].description,
143+ status_msg[TEST_SKIP]);
144+ fflush(stdout);
145+ continue;
146+ }
147+ if (strncmp(buffer, "quit", 4) == 0)
148+ exit(0);
149+ }
150+
151+ fprintf(stdout, "%-40s", testcases[ii].description);
152+ fflush(stdout);
153+ }
154+
155 bool reconnect= false;
156 enum test_return ret= testcases[ii].function();
157 if (ret == TEST_FAIL)
158
159=== modified file 'configure.ac'
160--- configure.ac 2010-08-02 18:33:16 +0000
161+++ configure.ac 2010-09-14 07:57:51 +0000
162@@ -16,7 +16,11 @@
163 #shared library versioning
164 MEMCACHED_UTIL_LIBRARY_VERSION=1:0:0
165 MEMCACHED_PROTOCAL_LIBRARY_VERSION=0:0:0
166+<<<<<<< TREE
167 MEMCACHED_LIBRARY_VERSION=5:2:0
168+=======
169+MEMCACHED_LIBRARY_VERSION=6:0:0
170+>>>>>>> MERGE-SOURCE
171 # | | |
172 # +------+ | +---+
173 # | | |
174
175=== modified file 'libhashkit/common.h'
176--- libhashkit/common.h 2010-01-21 02:06:18 +0000
177+++ libhashkit/common.h 2010-09-14 07:57:51 +0000
178@@ -9,10 +9,6 @@
179 #ifndef HASHKIT_COMMON_H
180 #define HASHKIT_COMMON_H
181
182-#ifdef __cplusplus
183-extern "C" {
184-#endif
185-
186 #include "config.h"
187
188 #include <assert.h>
189@@ -23,6 +19,10 @@
190
191 #include "hashkit.h"
192
193+#ifdef __cplusplus
194+extern "C" {
195+#endif
196+
197 HASHKIT_LOCAL
198 void md5_signature(const unsigned char *key, unsigned int length, unsigned char *result);
199
200
201=== modified file 'libmemcached/auto.c'
202--- libmemcached/auto.c 2010-04-02 19:55:21 +0000
203+++ libmemcached/auto.c 2010-09-14 07:57:51 +0000
204@@ -60,7 +60,7 @@
205 {
206 *value= 0;
207 rc= MEMCACHED_PROTOCOL_ERROR;
208- }
209+ }
210 else if (! strncmp(buffer, "CLIENT_ERROR\r\n", 14))
211 {
212 *value= 0;
213@@ -116,12 +116,12 @@
214 request.message.body.initial= htonll(initial);
215 request.message.body.expiration= htonl((uint32_t) expiration);
216
217- struct __write_vector_st vector[]=
218+ struct libmemcached_io_vector_st vector[]=
219 {
220 { .length= sizeof(request.bytes), .buffer= request.bytes },
221 { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
222 { .length= key_length, .buffer= key }
223- };
224+ };
225
226 memcached_return_t rc;
227 if ((rc= memcached_vdo(instance, vector, 3, true)) != MEMCACHED_SUCCESS)
228
229=== modified file 'libmemcached/connect.c'
230--- libmemcached/connect.c 2010-07-27 22:38:51 +0000
231+++ libmemcached/connect.c 2010-09-14 07:57:51 +0000
232@@ -80,7 +80,6 @@
233 return MEMCACHED_ERRNO;
234 }
235 }
236- WATCHPOINT_ASSERT(0); // Programming error
237 }
238
239 // This should only be possible from ERESTART or EINTR;
240@@ -537,7 +536,7 @@
241 case MEMCACHED_CONNECTION_TCP:
242 rc= network_connect(ptr);
243 #ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
244- if (ptr->fd != INVALID_SOCKET && ptr->root->sasl && ptr->root->sasl->callbacks)
245+ if (ptr->fd != INVALID_SOCKET && ptr->root->sasl.callbacks)
246 {
247 rc= memcached_sasl_authenticate_connection(ptr);
248 if (rc != MEMCACHED_SUCCESS)
249
250=== modified file 'libmemcached/delete.c'
251--- libmemcached/delete.c 2010-06-29 06:06:33 +0000
252+++ libmemcached/delete.c 2010-09-14 07:57:51 +0000
253@@ -175,12 +175,12 @@
254 memcached_io_write(instance, NULL, 0, true);
255 }
256
257- struct __write_vector_st vector[]=
258+ struct libmemcached_io_vector_st vector[]=
259 {
260 { .length= sizeof(request.bytes), .buffer= request.bytes},
261 { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
262 { .length= key_length, .buffer= key },
263- };
264+ };
265
266 memcached_return_t rc= MEMCACHED_SUCCESS;
267
268
269=== modified file 'libmemcached/do.c'
270--- libmemcached/do.c 2010-04-21 03:14:19 +0000
271+++ libmemcached/do.c 2010-09-14 07:57:51 +0000
272@@ -5,13 +5,13 @@
273 * Use and distribution licensed under the BSD license. See
274 * the COPYING file in the parent directory for full text.
275 *
276- * Summary:
277+ * Summary:
278 *
279 */
280
281 #include "common.h"
282
283-memcached_return_t memcached_do(memcached_server_write_instance_st ptr, const void *command,
284+memcached_return_t memcached_do(memcached_server_write_instance_st ptr, const void *command,
285 size_t command_length, bool with_flush)
286 {
287 memcached_return_t rc;
288@@ -51,7 +51,7 @@
289 }
290
291 memcached_return_t memcached_vdo(memcached_server_write_instance_st ptr,
292- const struct __write_vector_st *vector, size_t count,
293+ const struct libmemcached_io_vector_st *vector, size_t count,
294 bool with_flush)
295 {
296 memcached_return_t rc;
297
298=== modified file 'libmemcached/do.h'
299--- libmemcached/do.h 2010-04-02 19:55:21 +0000
300+++ libmemcached/do.h 2010-09-14 07:57:51 +0000
301@@ -17,14 +17,14 @@
302 #endif
303
304 LIBMEMCACHED_LOCAL
305-memcached_return_t memcached_do(memcached_server_write_instance_st ptr,
306+memcached_return_t memcached_do(memcached_server_write_instance_st ptr,
307 const void *commmand,
308 size_t command_length,
309 bool with_flush);
310
311 LIBMEMCACHED_LOCAL
312 memcached_return_t memcached_vdo(memcached_server_write_instance_st ptr,
313- const struct __write_vector_st *vector, size_t count,
314+ const struct libmemcached_io_vector_st *vector, size_t count,
315 bool with_flush);
316
317 #ifdef __cplusplus
318
319=== modified file 'libmemcached/get.c'
320--- libmemcached/get.c 2010-04-02 05:40:32 +0000
321+++ libmemcached/get.c 2010-09-14 07:57:51 +0000
322@@ -1,5 +1,5 @@
323 /* LibMemcached
324- * Copyright (C) 2006-2009 Brian Aker
325+ * Copyright (C) 2006-2009 Brian Aker
326 * All rights reserved.
327 *
328 * Use and distribution licensed under the BSD license. See
329@@ -227,13 +227,13 @@
330
331 instance= memcached_server_instance_fetch(ptr, server_key);
332
333- struct __write_vector_st vector[]=
334- {
335- { .length= get_command_length, .buffer= get_command },
336- { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
337- { .length= key_length[x], .buffer= keys[x] },
338- { .length= 1, .buffer= " " }
339- };
340+ struct libmemcached_io_vector_st vector[]=
341+ {
342+ { .length= get_command_length, .buffer= get_command },
343+ { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
344+ { .length= key_length[x], .buffer= keys[x] },
345+ { .length= 1, .buffer= " " }
346+ };
347
348
349 if (memcached_server_response_count(instance) == 0)
350@@ -399,12 +399,12 @@
351 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
352 request.message.header.request.bodylen= htonl((uint32_t)( key_length[x] + ptr->prefix_key_length));
353
354- struct __write_vector_st vector[]=
355+ struct libmemcached_io_vector_st vector[]=
356 {
357 { .length= sizeof(request.bytes), .buffer= request.bytes },
358 { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
359 { .length= key_length[x], .buffer= keys[x] }
360- };
361+ };
362
363 if (memcached_io_writev(instance, vector, 3, flush) == -1)
364 {
365@@ -533,12 +533,12 @@
366 * that we might have processed some of the responses etc. For now,
367 * just make sure we work _correctly_
368 */
369- struct __write_vector_st vector[]=
370+ struct libmemcached_io_vector_st vector[]=
371 {
372 { .length= sizeof(request.bytes), .buffer= request.bytes },
373 { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
374 { .length= key_length[x], .buffer= keys[x] }
375- };
376+ };
377
378 if (memcached_io_writev(instance, vector, 3, true) == -1)
379 {
380
381=== modified file 'libmemcached/include.am'
382--- libmemcached/include.am 2010-07-28 17:42:50 +0000
383+++ libmemcached/include.am 2010-09-14 07:57:51 +0000
384@@ -172,5 +172,5 @@
385 libmemcached/libmemcached_probes.o: libmemcached/libmemcached_probes.d ${libmemcached_libmemcached_la_OBJECTS} config.h
386
387 .d.o:
388- $(DTRACE) $(DTRACEFLAGS) -o libmemcached/libmemcached_probes.o -G -s ${top_srcdir}/libmemcached/libmemcached_probes.d `grep '^pic_object' ${top_builddir}/libmemcached/*.lo | cut -f 2 -d\' | sed "s/^/${top_builddir}\//"`
389+ $(DTRACE) $(DTRACEFLAGS) -o libmemcached/libmemcached_probes.o -G -s ${top_srcdir}/libmemcached/libmemcached_probes.d `grep '^pic_object' ${top_builddir}/libmemcached/*.lo | cut -f 2 -d\' | sed "s/^/${top_builddir}\/libmemcached\//"`
390
391
392=== modified file 'libmemcached/io.c'
393--- libmemcached/io.c 2010-08-03 03:54:30 +0000
394+++ libmemcached/io.c 2010-09-14 07:57:51 +0000
395@@ -440,7 +440,7 @@
396 }
397
398 ssize_t memcached_io_writev(memcached_server_write_instance_st ptr,
399- const struct __write_vector_st *vector,
400+ const struct libmemcached_io_vector_st *vector,
401 size_t number_of, bool with_flush)
402 {
403 ssize_t total= 0;
404
405=== modified file 'libmemcached/io.h'
406--- libmemcached/io.h 2010-04-22 00:49:09 +0000
407+++ libmemcached/io.h 2010-09-14 07:57:51 +0000
408@@ -40,7 +40,7 @@
409 uint16_t reserved;
410 };
411
412-struct __write_vector_st
413+struct libmemcached_io_vector_st
414 {
415 size_t length;
416 const void *buffer;
417@@ -48,7 +48,7 @@
418
419 LIBMEMCACHED_LOCAL
420 ssize_t memcached_io_writev(memcached_server_write_instance_st ptr,
421- const struct __write_vector_st *vector,
422+ const struct libmemcached_io_vector_st *vector,
423 size_t number_of, bool with_flush);
424
425 LIBMEMCACHED_LOCAL
426
427=== modified file 'libmemcached/memcached.c'
428--- libmemcached/memcached.c 2010-04-21 03:14:19 +0000
429+++ libmemcached/memcached.c 2010-09-14 07:57:51 +0000
430@@ -92,7 +92,8 @@
431 self->get_key_failure= NULL;
432 self->delete_trigger= NULL;
433 self->callbacks= NULL;
434- self->sasl= NULL;
435+ self->sasl.callbacks= NULL;
436+ self->sasl.is_allocated= false;
437
438 return true;
439 }
440@@ -176,7 +177,7 @@
441 if (ptr->continuum)
442 libmemcached_free(ptr, ptr->continuum);
443
444- if (ptr->sasl)
445+ if (ptr->sasl.callbacks)
446 {
447 #ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
448 memcached_destroy_sasl_auth_data(ptr);
449@@ -273,7 +274,7 @@
450 }
451
452 #ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
453- if (source->sasl && source->sasl->callbacks)
454+ if (source->sasl.callbacks)
455 {
456 if (memcached_clone_sasl(new_clone, source) != MEMCACHED_SUCCESS)
457 {
458
459=== modified file 'libmemcached/memcached.h'
460--- libmemcached/memcached.h 2010-07-27 22:38:51 +0000
461+++ libmemcached/memcached.h 2010-09-14 07:57:51 +0000
462@@ -124,7 +124,7 @@
463 memcached_trigger_key_fn get_key_failure;
464 memcached_trigger_delete_key_fn delete_trigger;
465 memcached_callback_st *callbacks;
466- struct memcached_sasl_st *sasl;
467+ struct memcached_sasl_st sasl;
468 char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE];
469 struct {
470 bool is_allocated:1;
471
472=== modified file 'libmemcached/sasl.c'
473--- libmemcached/sasl.c 2010-06-13 21:04:20 +0000
474+++ libmemcached/sasl.c 2010-09-14 07:57:51 +0000
475@@ -14,16 +14,13 @@
476 void memcached_set_sasl_callbacks(memcached_st *ptr,
477 const sasl_callback_t *callbacks)
478 {
479- ptr->sasl->callbacks= callbacks;
480- ptr->sasl->is_allocated= false;
481+ ptr->sasl.callbacks= callbacks;
482+ ptr->sasl.is_allocated= false;
483 }
484
485 const sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr)
486 {
487- if (ptr->sasl)
488- return ptr->sasl->callbacks;
489-
490- return NULL;
491+ return ptr->sasl.callbacks;
492 }
493
494 /**
495@@ -119,7 +116,7 @@
496
497 sasl_conn_t *conn;
498 int ret= sasl_client_new("memcached", server->hostname, laddr, raddr,
499- server->root->sasl->callbacks, 0, &conn);
500+ server->root->sasl.callbacks, 0, &conn);
501 if (ret != SASL_OK)
502 {
503 return MEMCACHED_AUTH_PROBLEM;
504@@ -144,12 +141,12 @@
505 do {
506 /* send the packet */
507
508- struct __write_vector_st vector[]=
509- {
510- { .length= sizeof(request.bytes), .buffer= request.bytes },
511- { .length= keylen, .buffer= chosenmech },
512- { .length= len, .buffer= data }
513- };
514+ struct libmemcached_io_vector_st vector[]=
515+ {
516+ { .length= sizeof(request.bytes), .buffer= request.bytes },
517+ { .length= keylen, .buffer= chosenmech },
518+ { .length= len, .buffer= data }
519+ };
520
521 if (memcached_io_writev(server, vector, 3, true) == -1)
522 {
523@@ -221,7 +218,7 @@
524 const char *password)
525 {
526 if (ptr == NULL || username == NULL ||
527- password == NULL || ptr->sasl->callbacks != NULL)
528+ password == NULL || ptr->sasl.callbacks != NULL)
529 {
530 return MEMCACHED_FAILURE;
531 }
532@@ -252,62 +249,52 @@
533 cb[2].context= secret;
534 cb[3].id= SASL_CB_LIST_END;
535
536- ptr->sasl->callbacks= cb;
537- ptr->sasl->is_allocated= true;
538+ ptr->sasl.callbacks= cb;
539+ ptr->sasl.is_allocated= true;
540
541 return MEMCACHED_SUCCESS;
542 }
543
544 memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *ptr)
545 {
546- if (ptr == NULL || ptr->sasl->callbacks == NULL)
547+ if (ptr == NULL || ptr->sasl.callbacks == NULL)
548 {
549 return MEMCACHED_FAILURE;
550 }
551
552- if (ptr->sasl->is_allocated)
553+ if (ptr->sasl.is_allocated)
554 {
555- libmemcached_free(ptr, ptr->sasl->callbacks[0].context);
556- libmemcached_free(ptr, ptr->sasl->callbacks[2].context);
557- libmemcached_free(ptr, (void*)ptr->sasl->callbacks);
558- ptr->sasl->is_allocated= false;
559+ libmemcached_free(ptr, ptr->sasl.callbacks[0].context);
560+ libmemcached_free(ptr, ptr->sasl.callbacks[2].context);
561+ libmemcached_free(ptr, (void*)ptr->sasl.callbacks);
562+ ptr->sasl.is_allocated= false;
563 }
564
565- ptr->sasl->callbacks= NULL;
566- libmemcached_free(ptr, ptr->sasl);
567- ptr->sasl= NULL;
568+ ptr->sasl.callbacks= NULL;
569
570 return MEMCACHED_SUCCESS;
571 }
572
573 memcached_return_t memcached_clone_sasl(memcached_st *clone, const memcached_st *source)
574 {
575- if (source->sasl == NULL)
576+
577+ if (source->sasl.callbacks == NULL)
578 {
579 return MEMCACHED_SUCCESS;
580 }
581- else
582- {
583- clone->sasl= libmemcached_malloc(source, sizeof(struct memcached_sasl_st));
584-
585- if (clone->sasl == NULL)
586- {
587- return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
588- }
589- }
590
591 /* Hopefully we are using our own callback mechanisms.. */
592- if (source->sasl->callbacks[0].id == SASL_CB_USER &&
593- source->sasl->callbacks[0].proc == get_username &&
594- source->sasl->callbacks[1].id == SASL_CB_AUTHNAME &&
595- source->sasl->callbacks[1].proc == get_username &&
596- source->sasl->callbacks[2].id == SASL_CB_PASS &&
597- source->sasl->callbacks[2].proc == get_password &&
598- source->sasl->callbacks[3].id == SASL_CB_LIST_END)
599+ if (source->sasl.callbacks[0].id == SASL_CB_USER &&
600+ source->sasl.callbacks[0].proc == get_username &&
601+ source->sasl.callbacks[1].id == SASL_CB_AUTHNAME &&
602+ source->sasl.callbacks[1].proc == get_username &&
603+ source->sasl.callbacks[2].id == SASL_CB_PASS &&
604+ source->sasl.callbacks[2].proc == get_password &&
605+ source->sasl.callbacks[3].id == SASL_CB_LIST_END)
606 {
607- sasl_secret_t *secret= source->sasl->callbacks[2].context;
608+ sasl_secret_t *secret= source->sasl.callbacks[2].context;
609 return memcached_set_sasl_auth_data(clone,
610- source->sasl->callbacks[0].context,
611+ source->sasl.callbacks[0].context,
612 (const char*)secret->data);
613 }
614
615@@ -318,9 +305,9 @@
616 */
617 size_t total= 0;
618
619- while (source->sasl->callbacks[total].id != SASL_CB_LIST_END)
620+ while (source->sasl.callbacks[total].id != SASL_CB_LIST_END)
621 {
622- switch (source->sasl->callbacks[total].id)
623+ switch (source->sasl.callbacks[total].id)
624 {
625 case SASL_CB_USER:
626 case SASL_CB_AUTHNAME:
627@@ -339,38 +326,38 @@
628 {
629 return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
630 }
631- memcpy(cb, source->sasl->callbacks, (total + 1) * sizeof(sasl_callback_t));
632+ memcpy(cb, source->sasl.callbacks, (total + 1) * sizeof(sasl_callback_t));
633
634 /* Now update the context... */
635 for (size_t x= 0; x < total; ++x)
636 {
637 if (cb[x].id == SASL_CB_USER || cb[x].id == SASL_CB_AUTHNAME)
638 {
639- cb[x].context= libmemcached_malloc(clone, strlen(source->sasl->callbacks[x].context));
640+ cb[x].context= libmemcached_malloc(clone, strlen(source->sasl.callbacks[x].context));
641
642 if (cb[x].context == NULL)
643 {
644 /* Failed to allocate memory, clean up previously allocated memory */
645 for (size_t y= 0; y < x; ++y)
646 {
647- libmemcached_free(clone, clone->sasl->callbacks[y].context);
648+ libmemcached_free(clone, clone->sasl.callbacks[y].context);
649 }
650
651 libmemcached_free(clone, cb);
652 return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
653 }
654- strcpy(cb[x].context, source->sasl->callbacks[x].context);
655+ strcpy(cb[x].context, source->sasl.callbacks[x].context);
656 }
657 else
658 {
659- sasl_secret_t *src = source->sasl->callbacks[x].context;
660+ sasl_secret_t *src = source->sasl.callbacks[x].context;
661 sasl_secret_t *n = libmemcached_malloc(clone, src->len + 1 + sizeof(*n));
662 if (n == NULL)
663 {
664 /* Failed to allocate memory, clean up previously allocated memory */
665 for (size_t y= 0; y < x; ++y)
666 {
667- libmemcached_free(clone, clone->sasl->callbacks[y].context);
668+ libmemcached_free(clone, clone->sasl.callbacks[y].context);
669 }
670
671 libmemcached_free(clone, cb);
672@@ -381,8 +368,8 @@
673 }
674 }
675
676- clone->sasl->callbacks= cb;
677- clone->sasl->is_allocated= true;
678+ clone->sasl.callbacks= cb;
679+ clone->sasl.is_allocated= true;
680
681 return MEMCACHED_SUCCESS;
682 }
683
684=== modified file 'libmemcached/stats.c'
685--- libmemcached/stats.c 2010-07-16 02:33:19 +0000
686+++ libmemcached/stats.c 2010-09-14 07:57:51 +0000
687@@ -258,11 +258,11 @@
688 request.message.header.request.keylen= htons((uint16_t)len);
689 request.message.header.request.bodylen= htonl((uint32_t) len);
690
691- struct __write_vector_st vector[]=
692+ struct libmemcached_io_vector_st vector[]=
693 {
694 { .length= sizeof(request.bytes), .buffer= request.bytes },
695 { .length= len, .buffer= args }
696- };
697+ };
698
699 if (memcached_vdo(instance, vector, 2, true) != MEMCACHED_SUCCESS)
700 {
701@@ -302,7 +302,7 @@
702 WATCHPOINT_ASSERT(0);
703 }
704 }
705-
706+
707 if (check && check->func)
708 {
709 size_t key_length= strlen(buffer);
710
711=== modified file 'libmemcached/storage.c'
712--- libmemcached/storage.c 2010-04-22 00:49:09 +0000
713+++ libmemcached/storage.c 2010-09-14 07:57:51 +0000
714@@ -155,12 +155,12 @@
715 }
716 else
717 {
718- struct __write_vector_st vector[]=
719+ struct libmemcached_io_vector_st vector[]=
720 {
721 { .length= write_length, .buffer= buffer },
722 { .length= value_length, .buffer= value },
723 { .length= 2, .buffer= "\r\n" }
724- };
725+ };
726
727 if (ptr->flags.buffer_requests && verb == SET_OP)
728 {
729@@ -492,13 +492,13 @@
730 }
731 }
732
733- struct __write_vector_st vector[]=
734+ struct libmemcached_io_vector_st vector[]=
735 {
736 { .length= send_length, .buffer= request.bytes },
737 { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
738 { .length= key_length, .buffer= key },
739 { .length= value_length, .buffer= value }
740- };
741+ };
742
743 /* write the header */
744 memcached_return_t rc;
745
746=== modified file 'libmemcached/watchpoint.h'
747--- libmemcached/watchpoint.h 2010-04-22 00:49:09 +0000
748+++ libmemcached/watchpoint.h 2010-09-14 07:57:51 +0000
749@@ -16,7 +16,7 @@
750 #if defined(DEBUG)
751
752 #ifdef TARGET_OS_LINUX
753-static inline void __stack_dump(void)
754+static inline void libmemcached_stack_dump(void)
755 {
756 void *array[10];
757 int size;
758@@ -35,12 +35,21 @@
759 fflush(stderr);
760 }
761
762+#elif defined(__sun)
763+#include <ucontext.h>
764+
765+static inline void libmemcached_stack_dump(void)
766+{
767+ fflush(stderr);
768+ printstack(fileno(stderr));
769+}
770+
771 #else
772
773-static inline void __stack_dump(void)
774+static inline void libmemcached_stack_dump(void)
775 { }
776
777-#endif // __stack_dump()
778+#endif // libmemcached_stack_dump()
779
780 #include <assert.h>
781
782@@ -53,9 +62,9 @@
783 #define WATCHPOINT_LABELED_NUMBER(A,B) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s:%zu\n", __FILE__, __LINE__,__func__,(A),(size_t)(B));fflush(stdout); } while (0)
784 #define WATCHPOINT_IF_LABELED_NUMBER(A,B,C) do { if(A) {fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s:%zu\n", __FILE__, __LINE__,__func__,(B),(size_t)(C));fflush(stdout);} } while (0)
785 #define WATCHPOINT_ERRNO(A) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));fflush(stdout); } while (0)
786-#define WATCHPOINT_ASSERT_PRINT(A,B,C) do { if(!(A)){fprintf(stderr, "\nWATCHPOINT ASSERT %s:%d (%s) ", __FILE__, __LINE__,__func__);fprintf(stderr, (B),(C));fprintf(stderr,"\n");fflush(stdout); __stack_dump(); } assert((A)); } while (0)
787-#define WATCHPOINT_ASSERT(A) do { if (! (A)) {__stack_dump();} assert((A)); } while (0)
788-#define WATCHPOINT_ASSERT_INITIALIZED(A) do { if (! (A)) { __stack_dump(); } assert(memcached_is_initialized((A))); } while (0);
789+#define WATCHPOINT_ASSERT_PRINT(A,B,C) do { if(!(A)){fprintf(stderr, "\nWATCHPOINT ASSERT %s:%d (%s) ", __FILE__, __LINE__,__func__);fprintf(stderr, (B),(C));fprintf(stderr,"\n");fflush(stdout); libmemcached_stack_dump(); } assert((A)); } while (0)
790+#define WATCHPOINT_ASSERT(A) do { if (! (A)) {libmemcached_stack_dump();} assert((A)); } while (0)
791+#define WATCHPOINT_ASSERT_INITIALIZED(A) do { if (! (A)) { libmemcached_stack_dump(); } assert(memcached_is_initialized((A))); } while (0);
792 #define WATCHPOINT_SET(A) do { A; } while(0);
793
794 #else
795
796=== modified file 'tests/include.am'
797--- tests/include.am 2010-07-28 00:27:30 +0000
798+++ tests/include.am 2010-09-14 07:57:51 +0000
799@@ -47,7 +47,11 @@
800 tests/libtest.la \
801 libmemcached/libmemcachedinternal.la \
802 $(TESTS_LDADDS)
803-tests_testapp_LDADD= $(tests_testapp_DEPENDENCIES) $(LIBSASL)
804+tests_testapp_LDADD= clients/libgenexec.la \
805+ tests/libserver.la \
806+ tests/libtest.la \
807+ libmemcached/libmemcachedinternal.la \
808+ $(TESTS_LDADDS) $(LIBSASL)
809
810 tests_testplus_SOURCES= tests/plus.cpp
811 tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)

Subscribers

People subscribed via source and target branches

to all changes: