Merge lp:~flier-lu/libmemcached/win32-vs2008 into lp:~tangent-org/libmemcached/trunk

Proposed by flier
Status: Work in progress
Proposed branch: lp:~flier-lu/libmemcached/win32-vs2008
Merge into: lp:~tangent-org/libmemcached/trunk
Diff against target: 7279 lines (+4809/-598)
67 files modified
.bzrignore (+13/-0)
clients/memcapable.c (+103/-61)
clients/memcat.c (+7/-4)
clients/memcp.c (+10/-7)
clients/memdump.c (+5/-2)
clients/memerror.c (+4/-1)
clients/memflush.c (+4/-1)
clients/memrm.c (+4/-1)
clients/memstat.c (+13/-9)
clients/utilities.c (+241/-231)
clients/utilities.h (+5/-0)
libhashkit/common.h (+20/-0)
libhashkit/fnv.c (+8/-4)
libhashkit/hashkit.c (+7/-9)
libhashkit/visibility.h (+14/-4)
libmemcached/allocators.c (+30/-20)
libmemcached/allocators.h (+1/-1)
libmemcached/analyze.c (+3/-1)
libmemcached/auto.c (+14/-9)
libmemcached/behavior.c (+5/-4)
libmemcached/byteorder.c (+3/-1)
libmemcached/common.h (+14/-6)
libmemcached/connect.c (+11/-7)
libmemcached/delete.c (+16/-10)
libmemcached/do.c (+4/-2)
libmemcached/fetch.c (+2/-1)
libmemcached/flush.c (+6/-3)
libmemcached/flush_buffers.c (+2/-1)
libmemcached/get.c (+66/-52)
libmemcached/hash.c (+9/-3)
libmemcached/hosts.c (+6/-4)
libmemcached/io.c (+42/-26)
libmemcached/memcached.c (+19/-32)
libmemcached/memcached.h (+1/-7)
libmemcached/purge.c (+8/-6)
libmemcached/quit.c (+4/-1)
libmemcached/response.c (+13/-6)
libmemcached/sasl.c (+4/-0)
libmemcached/server.c (+12/-5)
libmemcached/stats.c (+17/-8)
libmemcached/storage.c (+33/-22)
libmemcached/types.h (+7/-0)
libmemcached/verbosity.c (+3/-1)
libmemcached/version.c (+13/-6)
libmemcached/visibility.h (+14/-4)
libmemcached/watchpoint.h (+3/-3)
poll/poll.c (+21/-12)
win32/common.vsprops (+25/-0)
win32/debug.vsprops (+12/-0)
win32/getopt.c (+1067/-0)
win32/getopt.h (+173/-0)
win32/inttypes.h (+13/-0)
win32/libmemcached.sln (+92/-0)
win32/libmemcached.vcproj (+618/-0)
win32/memcapable.vcproj (+205/-0)
win32/memcat.vcproj (+204/-0)
win32/memcp.vcproj (+206/-0)
win32/memdump.vcproj (+205/-0)
win32/memerror.vcproj (+205/-0)
win32/memflush.vcproj (+205/-0)
win32/memrm.vcproj (+205/-0)
win32/memslap.vcproj (+263/-0)
win32/memstat.vcproj (+205/-0)
win32/release.vsprops (+12/-0)
win32/stdbool.h (+6/-0)
win32/wrappers.c (+16/-0)
win32/wrappers.h (+8/-0)
To merge this branch: bzr merge lp:~flier-lu/libmemcached/win32-vs2008
Reviewer Review Type Date Requested Status
Libmemcached-developers Pending
Review via email: mp+45334@code.launchpad.net

Description of the change

Remove C99 syntax and add supports to Win32 with VS2008

To post a comment you must log in.
905. By flier

use pointer instead of reference to pass allocator

906. By flier

port libhashkit to win32

907. By flier

-h

908. By flier

port poll to win32

909. By flier

update solution

910. By flier

define LIBMEMCACHED_STATIC to support static link

911. By flier

use DLL mode by default

912. By flier

replace %zu instead of %lu

913. By flier

porting client

Unmerged revisions

913. By flier

porting client

912. By flier

replace %zu instead of %lu

911. By flier

use DLL mode by default

910. By flier

define LIBMEMCACHED_STATIC to support static link

909. By flier

update solution

908. By flier

port poll to win32

907. By flier

-h

906. By flier

port libhashkit to win32

905. By flier

use pointer instead of reference to pass allocator

904. By flier

Add VS2008 project

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2010-09-14 07:55:39 +0000
3+++ .bzrignore 2011-01-13 03:40:43 +0000
4@@ -185,3 +185,16 @@
5 tests/testplus
6 tests/testudp
7 unittests/unittests
8+win32/Debug
9+win32/Release
10+win32/libmemcached.vcproj.WIN2003R2.flier.user
11+win32/memcapable.vcproj.WIN2003R2.flier.user
12+win32/memcat.vcproj.WIN2003R2.flier.user
13+win32/memcp.vcproj.WIN2003R2.flier.user
14+win32/memdump.vcproj.WIN2003R2.flier.user
15+win32/memerror.vcproj.WIN2003R2.flier.user
16+win32/memflush.vcproj.WIN2003R2.flier.user
17+win32/memrm.vcproj.WIN2003R2.flier.user
18+win32/memslap.vcproj.WIN2003R2.flier.user
19+win32/memstat.vcproj.WIN2003R2.flier.user
20+*.bak
21
22=== modified file 'clients/memcapable.c'
23--- clients/memcapable.c 2010-10-28 22:21:05 +0000
24+++ clients/memcapable.c 2011-01-13 03:40:43 +0000
25@@ -11,11 +11,18 @@
26
27 /* -*- Mode: C; tab-width: 2; c-basic-offset: 2; indent-tabs-mode: nil -*- */
28 #undef NDEBUG
29+
30 #include "config.h"
31-#include <pthread.h>
32-#include <sys/types.h>
33-#include <fcntl.h>
34-#include <signal.h>
35+#ifdef WIN32
36+# define ETIMEDOUT WSAETIMEDOUT
37+#else
38+# include <pthread.h>
39+# include <sys/types.h>
40+# include <fcntl.h>
41+# include <signal.h>
42+# include <unistd.h>
43+#endif
44+
45 #include <stdio.h>
46 #include <stdlib.h>
47 #include <errno.h>
48@@ -23,7 +30,6 @@
49 #include <string.h>
50 #include <inttypes.h>
51 #include <stdbool.h>
52-#include <unistd.h>
53 #include <ctype.h>
54
55 #include <libmemcached/memcached.h>
56@@ -88,11 +94,13 @@
57 static struct addrinfo *lookuphost(const char *hostname, const char *port)
58 {
59 struct addrinfo *ai= 0;
60- struct addrinfo hints= {.ai_family=AF_UNSPEC,
61- .ai_protocol=IPPROTO_TCP,
62- .ai_socktype=SOCK_STREAM};
63+ struct addrinfo hints;
64 int error= getaddrinfo(hostname, port, &hints, &ai);
65
66+ hints.ai_family=AF_UNSPEC;
67+ hints.ai_protocol=IPPROTO_TCP;
68+ hints.ai_socktype=SOCK_STREAM;
69+
70 if (error != 0)
71 {
72 if (error != EAI_SYSTEM)
73@@ -187,13 +195,12 @@
74 ret= recv(fd, buf, len, 0);
75
76 if (ret == SOCKET_ERROR && get_socket_errno() == EWOULDBLOCK) {
77- struct pollfd fds= {
78- .events= direction,
79- .fd= fd
80- };
81-
82+ struct pollfd fds;
83 int err= poll(&fds, 1, timeout * 1000);
84
85+ fds.events= direction;
86+ fds.fd= fd;
87+
88 if (err == 1)
89 {
90 if (direction == POLLOUT)
91@@ -322,6 +329,8 @@
92 */
93 static enum test_return recv_packet(response *rsp)
94 {
95+ size_t bodysz;
96+
97 execute(retry_read(rsp, sizeof(protocol_binary_response_no_extras)));
98
99 /* Fix the byte order in the packet header */
100@@ -334,7 +343,7 @@
101 rsp->plain.message.header.response.cas=
102 ntohll(rsp->plain.message.header.response.cas);
103
104- size_t bodysz= rsp->plain.message.header.response.bodylen;
105+ bodysz= rsp->plain.message.header.response.bodylen;
106 if (bodysz > 0)
107 execute(retry_read(rsp->bytes + sizeof (protocol_binary_response_no_extras), bodysz));
108
109@@ -362,6 +371,8 @@
110 uint32_t flags,
111 uint32_t exptime)
112 {
113+ off_t key_offset;
114+
115 /* all of the storage commands use the same command layout */
116 protocol_binary_request_set *request= &cmd->set;
117
118@@ -375,7 +386,7 @@
119 request->message.body.flags= flags;
120 request->message.body.expiration= exptime;
121
122- off_t key_offset= sizeof (protocol_binary_request_no_extras) + 8;
123+ key_offset= sizeof (protocol_binary_request_no_extras) + 8;
124 memcpy(cmd->bytes + key_offset, key, keylen);
125 if (dta != NULL)
126 memcpy(cmd->bytes + key_offset + keylen, dta, dtalen);
127@@ -397,6 +408,8 @@
128 const void* dta,
129 size_t dtalen)
130 {
131+ off_t key_offset;
132+
133 /* all of the storage commands use the same command layout */
134 memset(cmd, 0, sizeof (*cmd));
135 cmd->plain.message.header.request.magic= PROTOCOL_BINARY_REQ;
136@@ -405,7 +418,7 @@
137 cmd->plain.message.header.request.bodylen= (uint32_t)(keylen + dtalen);
138 cmd->plain.message.header.request.opaque= 0xdeadbeef;
139
140- off_t key_offset= sizeof (protocol_binary_request_no_extras);
141+ key_offset= sizeof (protocol_binary_request_no_extras);
142
143 if (key != NULL)
144 memcpy(cmd->bytes + key_offset, key, keylen);
145@@ -454,6 +467,8 @@
146 uint64_t initial,
147 uint32_t exptime)
148 {
149+ off_t key_offset;
150+
151 memset(cmd, 0, sizeof (cmd->incr));
152 cmd->incr.message.header.request.magic= PROTOCOL_BINARY_REQ;
153 cmd->incr.message.header.request.opcode= cc;
154@@ -465,7 +480,7 @@
155 cmd->incr.message.body.initial= htonll(initial);
156 cmd->incr.message.body.expiration= htonl(exptime);
157
158- off_t key_offset= sizeof (protocol_binary_request_no_extras) + 20;
159+ key_offset= sizeof (protocol_binary_request_no_extras) + 20;
160 memcpy(cmd->bytes + key_offset, key, keylen);
161 }
162
163@@ -643,12 +658,13 @@
164 {
165 command cmd;
166 response rsp;
167+ int ii;
168
169 uint64_t value= 0xdeadbeefdeadcafe;
170 storage_command(&cmd, cc, key, strlen(key), &value, sizeof (value), 0, 0);
171
172 /* set should always work */
173- for (int ii= 0; ii < 10; ii++)
174+ for (ii= 0; ii < 10; ii++)
175 {
176 if (ii == 0)
177 execute(send_packet(&cmd));
178@@ -716,12 +732,13 @@
179 {
180 command cmd;
181 response rsp;
182+ int ii;
183 uint64_t value= 0xdeadbeefdeadcafe;
184 storage_command(&cmd, cc, key, strlen(key), &value, sizeof (value), 0, 0);
185
186 /* first add should work, rest of them should fail (even with cas
187 as wildcard */
188- for (int ii=0; ii < 10; ii++)
189+ for (ii=0; ii < 10; ii++)
190 {
191 if (ii == 0)
192 execute(send_packet(&cmd));
193@@ -775,12 +792,13 @@
194 {
195 command cmd;
196 response rsp;
197+ int ii;
198 uint64_t value= 0xdeadbeefdeadcafe;
199 storage_command(&cmd, cc, key, strlen(key), &value, sizeof (value), 0, 0);
200
201 /* first replace should fail, successive should succeed (when the
202 item is added! */
203- for (int ii= 0; ii < 10; ii++)
204+ for (ii= 0; ii < 10; ii++)
205 {
206 if (ii == 0)
207 execute(send_packet(&cmd));
208@@ -931,9 +949,9 @@
209 {
210 command cmd;
211 response rsp;
212+ uint64_t ii;
213 arithmetic_command(&cmd, cc, key, strlen(key), 1, 0, 0);
214-
215- uint64_t ii;
216+
217 for (ii= 0; ii < 10; ++ii)
218 {
219 if (ii == 0)
220@@ -969,9 +987,9 @@
221 {
222 command cmd;
223 response rsp;
224+ int ii;
225 arithmetic_command(&cmd, cc, key, strlen(key), 1, 9, 0);
226-
227- int ii;
228+
229 for (ii= 9; ii > -1; --ii)
230 {
231 if (ii == 9)
232@@ -1038,8 +1056,9 @@
233 {
234 command cmd;
235 response rsp;
236+ int ii;
237
238- for (int ii= 0; ii < 2; ++ii)
239+ for (ii= 0; ii < 2; ++ii)
240 {
241 execute(binary_set_item(key, key));
242 flush_command(&cmd, cc, 0, ii == 0);
243@@ -1200,6 +1219,8 @@
244
245 static enum test_return test_ascii_quit(void)
246 {
247+ char buffer[80];
248+
249 /* Verify that quit handles unknown options */
250 execute(send_string("quit foo bar\r\n"));
251 execute(receive_error_response());
252@@ -1212,7 +1233,6 @@
253 execute(send_string("quit\r\n"));
254
255 /* Socket should be closed now, read should return 0 */
256- char buffer[80];
257 verify(timeout_io_op(sock, POLLIN, buffer, sizeof(buffer)) == 0);
258 return TEST_PASS_RECONNECT;
259
260@@ -1220,6 +1240,8 @@
261
262 static enum test_return test_ascii_version(void)
263 {
264+ char buffer[256];
265+
266 /* Verify that version command handles unknown options */
267 execute(send_string("version foo bar\r\n"));
268 execute(receive_error_response());
269@@ -1230,7 +1252,7 @@
270
271 /* Verify that verify works */
272 execute(send_string("version\r\n"));
273- char buffer[256];
274+
275 execute(receive_line(buffer, sizeof(buffer)));
276 verify(strncmp(buffer, "VERSION ", 8) == 0);
277
278@@ -1318,18 +1340,20 @@
279
280 static enum test_return ascii_get_unknown_value(char **key, char **value, ssize_t *ndata)
281 {
282+ char *end, *ptr;
283+ unsigned long val;
284 char buffer[1024];
285
286 execute(receive_line(buffer, sizeof(buffer)));
287 verify(strncmp(buffer, "VALUE ", 6) == 0);
288- char *end= strchr(buffer + 6, ' ');
289+ end= strchr(buffer + 6, ' ');
290 verify(end != NULL);
291 *end= '\0';
292 *key= strdup(buffer + 6);
293 verify(*key != NULL);
294- char *ptr= end + 1;
295+ ptr= end + 1;
296
297- unsigned long val= strtoul(ptr, &end, 10); /* flags */
298+ val= strtoul(ptr, &end, 10); /* flags */
299 verify(ptr != end);
300 verify(val == 0);
301 verify(end != NULL);
302@@ -1353,6 +1377,8 @@
303
304 static enum test_return ascii_get_value(const char *key, const char *value)
305 {
306+ char *ptr, *end;
307+ unsigned long val;
308
309 char buffer[1024];
310 size_t datasize= strlen(value);
311@@ -1361,10 +1387,9 @@
312 execute(receive_line(buffer, sizeof(buffer)));
313 verify(strncmp(buffer, "VALUE ", 6) == 0);
314 verify(strncmp(buffer + 6, key, strlen(key)) == 0);
315- char *ptr= buffer + 6 + strlen(key) + 1;
316- char *end;
317+ ptr= buffer + 6 + strlen(key) + 1;
318
319- unsigned long val= strtoul(ptr, &end, 10); /* flags */
320+ val= strtoul(ptr, &end, 10); /* flags */
321 verify(ptr != end);
322 verify(val == 0);
323 verify(end != NULL);
324@@ -1409,6 +1434,8 @@
325 static enum test_return ascii_gets_value(const char *key, const char *value,
326 unsigned long *cas)
327 {
328+ char *ptr, *end;
329+ unsigned long val;
330
331 char buffer[1024];
332 size_t datasize= strlen(value);
333@@ -1417,10 +1444,9 @@
334 execute(receive_line(buffer, sizeof(buffer)));
335 verify(strncmp(buffer, "VALUE ", 6) == 0);
336 verify(strncmp(buffer + 6, key, strlen(key)) == 0);
337- char *ptr= buffer + 6 + strlen(key) + 1;
338- char *end;
339-
340- unsigned long val= strtoul(ptr, &end, 10); /* flags */
341+ ptr= buffer + 6 + strlen(key) + 1;
342+
343+ val= strtoul(ptr, &end, 10); /* flags */
344 verify(ptr != end);
345 verify(val == 0);
346 verify(end != NULL);
347@@ -1555,6 +1581,8 @@
348
349 static enum test_return test_ascii_delete_impl(const char *key, bool noreply)
350 {
351+ char buffer[1024];
352+
353 execute(ascii_set_item(key, "value"));
354
355 execute(send_string("delete\r\n"));
356@@ -1562,8 +1590,7 @@
357 /* BUG: the server accepts delete a b */
358 execute(send_string("delete a b c d e\r\n"));
359 execute(receive_error_response());
360-
361- char buffer[1024];
362+
363 sprintf(buffer, "delete %s%s\r\n", key, noreply ? " noreply" : "");
364 execute(send_string(buffer));
365
366@@ -1606,11 +1633,13 @@
367
368 static enum test_return test_ascii_gets(void)
369 {
370+ unsigned long cas;
371+
372 execute(ascii_set_item("test_ascii_gets", "value"));
373
374 execute(send_string("gets\r\n"));
375 execute(receive_error_response());
376- unsigned long cas;
377+
378 execute(ascii_gets_item("test_ascii_gets", "value", true, &cas));
379 execute(ascii_gets_item("test_ascii_gets_notfound", "value", false, &cas));
380
381@@ -1619,7 +1648,11 @@
382
383 static enum test_return test_ascii_mget(void)
384 {
385+ uint32_t x;
386 const uint32_t nkeys= 5;
387+ char *returned[5];
388+ char buffer[5];
389+
390 const char * const keys[]= {
391 "test_ascii_mget1",
392 "test_ascii_mget2",
393@@ -1629,7 +1662,7 @@
394 "test_ascii_mget6"
395 };
396
397- for (uint32_t x= 0; x < nkeys; ++x)
398+ for (x= 0; x < nkeys; ++x)
399 execute(ascii_set_item(keys[x], "value"));
400
401 /* Ask for a key that doesn't exist as well */
402@@ -1637,9 +1670,7 @@
403 "test_ascii_mget4 test_ascii_mget5 "
404 "test_ascii_mget6\r\n"));
405
406- char *returned[nkeys];
407-
408- for (uint32_t x= 0; x < nkeys; ++x)
409+ for (x= 0; x < nkeys; ++x)
410 {
411 ssize_t nbytes = 0;
412 char *v= NULL;
413@@ -1648,16 +1679,16 @@
414 verify(memcmp(v, "value", 5) == 0);
415 free(v);
416 }
417-
418- char buffer[5];
419+
420 execute(retry_read(buffer, 5));
421 verify(memcmp(buffer, "END\r\n", 5) == 0);
422
423 /* verify that we got all the keys we expected */
424- for (uint32_t x= 0; x < nkeys; ++x)
425+ for (x= 0; x < nkeys; ++x)
426 {
427+ uint32_t y;
428 bool found= false;
429- for (uint32_t y= 0; y < nkeys; ++y)
430+ for (y= 0; y < nkeys; ++y)
431 {
432 if (strcmp(keys[x], returned[y]) == 0)
433 {
434@@ -1668,7 +1699,7 @@
435 verify(found);
436 }
437
438- for (uint32_t x= 0; x < nkeys; ++x)
439+ for (x= 0; x < nkeys; ++x)
440 free(returned[x]);
441
442 return TEST_PASS;
443@@ -1676,11 +1707,12 @@
444
445 static enum test_return test_ascii_incr_impl(const char* key, bool noreply)
446 {
447+ int x;
448 char cmd[300];
449 sprintf(cmd, "incr %s 1%s\r\n", key, noreply ? " noreply" : "");
450
451 execute(ascii_set_item(key, "0"));
452- for (int x= 1; x < 11; ++x)
453+ for (x= 1; x < 11; ++x)
454 {
455 execute(send_string(cmd));
456
457@@ -1688,9 +1720,10 @@
458 execute(test_ascii_version());
459 else
460 {
461+ int val;
462 char buffer[80];
463 execute(receive_line(buffer, sizeof(buffer)));
464- int val= atoi(buffer);
465+ val= atoi(buffer);
466 verify(val == x);
467 }
468 }
469@@ -1712,11 +1745,12 @@
470
471 static enum test_return test_ascii_decr_impl(const char* key, bool noreply)
472 {
473+ int x;
474 char cmd[300];
475 sprintf(cmd, "decr %s 1%s\r\n", key, noreply ? " noreply" : "");
476
477 execute(ascii_set_item(key, "9"));
478- for (int x= 8; x > -1; --x)
479+ for (x= 8; x > -1; --x)
480 {
481 execute(send_string(cmd));
482
483@@ -1724,9 +1758,10 @@
484 execute(test_ascii_version());
485 else
486 {
487+ int val;
488 char buffer[80];
489 execute(receive_line(buffer, sizeof(buffer)));
490- int val= atoi(buffer);
491+ val= atoi(buffer);
492 verify(val == x);
493 }
494 }
495@@ -1801,6 +1836,7 @@
496 bool noreply)
497 {
498 const char *value;
499+ char cmd[400];
500
501 if (append)
502 value="hello";
503@@ -1813,8 +1849,7 @@
504 value=" world";
505 else
506 value="hello";
507-
508- char cmd[400];
509+
510 sprintf(cmd, "%s %s 0 0 %u%s\r\n%s\r\n",
511 append ? "append" : "prepend",
512 key, (unsigned int)strlen(value), noreply ? " noreply" : "",
513@@ -1864,10 +1899,12 @@
514
515 static enum test_return test_ascii_stat(void)
516 {
517+ char buffer[1024];
518+
519 execute(send_string("stats noreply\r\n"));
520 execute(receive_error_response());
521 execute(send_string("stats\r\n"));
522- char buffer[1024];
523+
524 do {
525 execute(receive_line(buffer, sizeof(buffer)));
526 } while (strcmp(buffer, "END\r\n") != 0);
527@@ -1948,7 +1985,7 @@
528 int failed= 0;
529 const char *hostname= "localhost";
530 const char *port= "11211";
531- int cmd;
532+ int cmd, ii;
533 bool prompt= false;
534 const char *testname= NULL;
535
536@@ -2000,8 +2037,11 @@
537 return 1;
538 }
539
540- for (int ii= 0; testcases[ii].description != NULL; ++ii)
541+ for (ii= 0; testcases[ii].description != NULL; ++ii)
542 {
543+ bool reconnect= false;
544+ enum test_return ret;
545+
546 if (testname != NULL && strcmp(testcases[ii].description, testname) != 0)
547 continue;
548
549@@ -2011,8 +2051,10 @@
550
551 if (prompt)
552 {
553+ char buffer[80] = {0};
554+
555 fprintf(stdout, "\nPress <return> when you are ready? ");
556- char buffer[80] = {0};
557+
558 if (fgets(buffer, sizeof(buffer), stdin) != NULL) {
559 if (strncmp(buffer, "skip", 4) == 0)
560 {
561@@ -2029,8 +2071,8 @@
562 fflush(stdout);
563 }
564
565- bool reconnect= false;
566- enum test_return ret= testcases[ii].function();
567+ reconnect= false;
568+ ret= testcases[ii].function();
569 if (ret == TEST_FAIL)
570 {
571 reconnect= true;
572
573=== modified file 'clients/memcat.c'
574--- clients/memcat.c 2010-07-27 22:38:51 +0000
575+++ clients/memcat.c 2011-01-13 03:40:43 +0000
576@@ -11,10 +11,13 @@
577
578 #include "config.h"
579
580+#ifndef WIN32
581+# include <unistd.h>
582+#endif
583+
584 #include <stdio.h>
585 #include <inttypes.h>
586 #include <string.h>
587-#include <unistd.h>
588 #include <getopt.h>
589 #include <libmemcached/memcached.h>
590
591@@ -95,8 +98,8 @@
592 {
593 if (opt_verbose)
594 {
595- printf("key: %s\nflags: %x\nlength: %zu\nvalue: ",
596- argv[optind], flags, string_length);
597+ printf("key: %s\nflags: %x\nlength: %lu\nvalue: ",
598+ argv[optind], flags, (unsigned long)string_length);
599 }
600
601 if (opt_file)
602@@ -115,7 +118,7 @@
603 written= fwrite(string, 1, string_length, fp);
604 if (written != string_length)
605 {
606- fprintf(stderr, "error writing file (written %zu, should be %zu)\n", written, string_length);
607+ fprintf(stderr, "error writing file (written %lu, should be %lu)\n", (unsigned long) written, (unsigned long) string_length);
608 return_code= -1;
609 break;
610 }
611
612=== modified file 'clients/memcp.c'
613--- clients/memcp.c 2010-07-27 22:38:51 +0000
614+++ clients/memcp.c 2011-01-13 03:40:43 +0000
615@@ -11,19 +11,22 @@
616
617 #include "config.h"
618
619+#ifndef WIN32
620+# include <unistd.h>
621+# include <sys/types.h>
622+# include <sys/types.h>
623+# include <strings.h>
624+#endif
625+
626 #include <stdio.h>
627 #include <stdlib.h>
628 #include <inttypes.h>
629-#include <unistd.h>
630 #include <getopt.h>
631-#include <sys/types.h>
632-#include <sys/stat.h>
633-#include <sys/types.h>
634 #include <fcntl.h>
635 #include <errno.h>
636-#include <strings.h>
637 #include <string.h>
638 #include <sys/types.h>
639+#include <sys/stat.h>
640 #include <stdlib.h>
641 #include <limits.h>
642
643@@ -147,9 +150,9 @@
644 if (opt_verbose)
645 {
646 static const char *opstr[] = { "set", "add", "replace" };
647- printf("op: %s\nsource file: %s\nlength: %zu\n"
648+ printf("op: %s\nsource file: %s\nlength: %lu\n"
649 "key: %s\nflags: %x\nexpires: %llu\n",
650- opstr[opt_method - OPT_SET], argv[optind], (size_t)sbuf.st_size,
651+ opstr[opt_method - OPT_SET], argv[optind], (unsigned long)sbuf.st_size,
652 ptr, opt_flags, (unsigned long long)opt_expires);
653 }
654
655
656=== modified file 'clients/memdump.c'
657--- clients/memdump.c 2010-06-29 06:39:40 +0000
658+++ clients/memdump.c 2011-01-13 03:40:43 +0000
659@@ -11,17 +11,20 @@
660
661 #include "config.h"
662
663+#ifndef WIN32
664+# include <unistd.h>
665+# include <strings.h>
666+#endif
667+
668 #include <stdio.h>
669 #include <stdlib.h>
670 #include <inttypes.h>
671-#include <unistd.h>
672 #include <getopt.h>
673 #include <sys/types.h>
674 #include <sys/stat.h>
675 #include <sys/types.h>
676 #include <fcntl.h>
677 #include <errno.h>
678-#include <strings.h>
679 #include <string.h>
680
681 #include <libmemcached/memcached.h>
682
683=== modified file 'clients/memerror.c'
684--- clients/memerror.c 2010-06-29 06:39:40 +0000
685+++ clients/memerror.c 2011-01-13 03:40:43 +0000
686@@ -10,10 +10,13 @@
687 */
688 #include "config.h"
689
690+#ifndef WIN32
691+# include <unistd.h>
692+#endif
693+
694 #include <stdio.h>
695 #include <inttypes.h>
696 #include <string.h>
697-#include <unistd.h>
698 #include <getopt.h>
699 #include <stdlib.h>
700 #include <libmemcached/memcached.h>
701
702=== modified file 'clients/memflush.c'
703--- clients/memflush.c 2010-06-29 06:39:40 +0000
704+++ clients/memflush.c 2011-01-13 03:40:43 +0000
705@@ -9,9 +9,12 @@
706 *
707 */
708 #include "config.h"
709+
710+#ifndef WIN32
711+# include <unistd.h>
712+#endif
713
714 #include <stdio.h>
715-#include <unistd.h>
716 #include <string.h>
717 #include <getopt.h>
718 #include <libmemcached/memcached.h>
719
720=== modified file 'clients/memrm.c'
721--- clients/memrm.c 2010-07-27 22:38:51 +0000
722+++ clients/memrm.c 2011-01-13 03:40:43 +0000
723@@ -10,8 +10,11 @@
724 */
725 #include "config.h"
726
727+#ifndef WIN32
728+# include <unistd.h>
729+#endif
730+
731 #include <stdio.h>
732-#include <unistd.h>
733 #include <getopt.h>
734 #include <libmemcached/memcached.h>
735 #include <string.h>
736
737=== modified file 'clients/memstat.c'
738--- clients/memstat.c 2010-07-28 20:59:36 +0000
739+++ clients/memstat.c 2011-01-13 03:40:43 +0000
740@@ -13,6 +13,10 @@
741 */
742 #include "config.h"
743
744+#ifndef WIN32
745+# include <sys/time.h>
746+#endif
747+
748 #include <stdio.h>
749 #include <sys/types.h>
750 #include <sys/stat.h>
751@@ -20,7 +24,6 @@
752 #include <fcntl.h>
753 #include <string.h>
754 #include <getopt.h>
755-#include <sys/time.h>
756
757 #include <libmemcached/memcached.h>
758
759@@ -158,9 +161,12 @@
760 else if (strcmp(analyze_mode, "latency") == 0)
761 {
762 memcached_st **servers;
763- uint32_t flags, server_count= memcached_server_count(memc);
764+ uint32_t x, flags, server_count= memcached_server_count(memc);
765 uint32_t num_of_tests= 32;
766 const char *test_key= "libmemcached_test_key";
767+ struct timeval start_time, end_time;
768+ uint32_t slowest_server= 0;
769+ long elapsed_time, slowest_time= 0;
770
771 servers= malloc(sizeof(memcached_st*) * server_count);
772 if (!servers)
773@@ -169,7 +175,7 @@
774 return;
775 }
776
777- for (uint32_t x= 0; x < server_count; x++)
778+ for (x= 0; x < server_count; x++)
779 {
780 memcached_server_instance_st instance=
781 memcached_server_instance_by_position(memc, x);
782@@ -192,17 +198,15 @@
783 }
784
785 printf("Network Latency Test:\n\n");
786- struct timeval start_time, end_time;
787- uint32_t slowest_server= 0;
788- long elapsed_time, slowest_time= 0;
789
790- for (uint32_t x= 0; x < server_count; x++)
791+ for (x= 0; x < server_count; x++)
792 {
793+ uint32_t y;
794 memcached_server_instance_st instance=
795 memcached_server_instance_by_position(memc, x);
796 gettimeofday(&start_time, NULL);
797
798- for (uint32_t y= 0; y < num_of_tests; y++)
799+ for (y= 0; y < num_of_tests; y++)
800 {
801 size_t vlen;
802 char *val= memcached_get(servers[x], test_key, strlen(test_key),
803@@ -250,7 +254,7 @@
804 }
805 printf("\n");
806
807- for (uint32_t x= 0; x < server_count; x++)
808+ for (x= 0; x < server_count; x++)
809 memcached_free(servers[x]);
810
811 free(servers);
812
813=== modified file 'clients/utilities.c'
814--- clients/utilities.c 2010-07-28 20:59:36 +0000
815+++ clients/utilities.c 2011-01-13 03:40:43 +0000
816@@ -1,231 +1,241 @@
817-/* LibMemcached
818- * Copyright (C) 2006-2009 Brian Aker
819- * All rights reserved.
820- *
821- * Use and distribution licensed under the BSD license. See
822- * the COPYING file in the parent directory for full text.
823- *
824- * Summary:
825- *
826- */
827-#include "config.h"
828-
829-#include <stdio.h>
830-#include <ctype.h>
831-#include <string.h>
832-#include "utilities.h"
833-
834-
835-long int timedif(struct timeval a, struct timeval b)
836-{
837- long us, s;
838-
839- us = (int)(a.tv_usec - b.tv_usec);
840- us /= 1000;
841- s = (int)(a.tv_sec - b.tv_sec);
842- s *= 1000;
843- return s + us;
844-}
845-
846-void version_command(const char *command_name)
847-{
848- printf("%s v%u.%u\n", command_name, 1U, 0U);
849- exit(0);
850-}
851-
852-static const char *lookup_help(memcached_options option)
853-{
854- switch (option)
855- {
856- case OPT_SERVERS: return("List which servers you wish to connect to.");
857- case OPT_VERSION: return("Display the version of the application and then exit.");
858- case OPT_HELP: return("Display this message and then exit.");
859- case OPT_VERBOSE: return("Give more details on the progression of the application.");
860- case OPT_DEBUG: return("Provide output only useful for debugging.");
861- case OPT_FLAG: return("Provide flag information for storage operation.");
862- case OPT_EXPIRE: return("Set the expire option for the object.");
863- case OPT_SET: return("Use set command with memcached when storing.");
864- case OPT_REPLACE: return("Use replace command with memcached when storing.");
865- case OPT_ADD: return("Use add command with memcached when storing.");
866- case OPT_SLAP_EXECUTE_NUMBER: return("Number of times to execute the given test.");
867- case OPT_SLAP_INITIAL_LOAD: return("Number of key pairs to load before executing tests.");
868- case OPT_SLAP_TEST: return("Test to run (currently \"get\" or \"set\").");
869- case OPT_SLAP_CONCURRENCY: return("Number of users to simulate with load.");
870- case OPT_SLAP_NON_BLOCK: return("Set TCP up to use non-blocking IO.");
871- case OPT_SLAP_TCP_NODELAY: return("Set TCP socket up to use nodelay.");
872- case OPT_FLUSH: return("Flush servers before running tests.");
873- case OPT_HASH: return("Select hash type.");
874- case OPT_BINARY: return("Switch to binary protocol.");
875- case OPT_ANALYZE: return("Analyze the provided servers.");
876- case OPT_UDP: return("Use UDP protocol when communicating with server.");
877- case OPT_USERNAME: return "Username to use for SASL authentication";
878- case OPT_PASSWD: return "Password to use for SASL authentication";
879- case OPT_FILE: return "Path to file in which to save result";
880- case OPT_STAT_ARGS: return "Argument for statistics";
881- default: WATCHPOINT_ASSERT(0);
882- };
883-
884- WATCHPOINT_ASSERT(0);
885- return "forgot to document this function :)";
886-}
887-
888-void help_command(const char *command_name, const char *description,
889- const struct option *long_options,
890- memcached_programs_help_st *options __attribute__((unused)))
891-{
892- unsigned int x;
893-
894- printf("%s v%u.%u\n\n", command_name, 1U, 0U);
895- printf("\t%s\n\n", description);
896- printf("Current options. A '=' means the option takes a value.\n\n");
897-
898- for (x= 0; long_options[x].name; x++)
899- {
900- const char *help_message;
901-
902- printf("\t --%s%c\n", long_options[x].name,
903- long_options[x].has_arg ? '=' : ' ');
904- if ((help_message= lookup_help(long_options[x].val)))
905- printf("\t\t%s\n", help_message);
906- }
907-
908- printf("\n");
909- exit(0);
910-}
911-
912-void process_hash_option(memcached_st *memc, char *opt_hash)
913-{
914- uint64_t set;
915- memcached_return_t rc;
916-
917- if (opt_hash == NULL)
918- return;
919-
920- set= MEMCACHED_HASH_DEFAULT; /* Just here to solve warning */
921- if (!strcasecmp(opt_hash, "CRC"))
922- set= MEMCACHED_HASH_CRC;
923- else if (!strcasecmp(opt_hash, "FNV1_64"))
924- set= MEMCACHED_HASH_FNV1_64;
925- else if (!strcasecmp(opt_hash, "FNV1A_64"))
926- set= MEMCACHED_HASH_FNV1A_64;
927- else if (!strcasecmp(opt_hash, "FNV1_32"))
928- set= MEMCACHED_HASH_FNV1_32;
929- else if (!strcasecmp(opt_hash, "FNV1A_32"))
930- set= MEMCACHED_HASH_FNV1A_32;
931- else
932- {
933- fprintf(stderr, "hash: type not recognized %s\n", opt_hash);
934- exit(1);
935- }
936-
937- rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set);
938- if (rc != MEMCACHED_SUCCESS)
939- {
940- fprintf(stderr, "hash: memcache error %s\n", memcached_strerror(memc, rc));
941- exit(1);
942- }
943-}
944-
945-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
946-static char *username;
947-static char *passwd;
948-
949-static int get_username(void *context, int id, const char **result,
950- unsigned int *len)
951-{
952- (void)context;
953- if (!result || (id != SASL_CB_USER && id != SASL_CB_AUTHNAME))
954- return SASL_BADPARAM;
955-
956- *result= username;
957- if (len)
958- *len= (username == NULL) ? 0 : (unsigned int)strlen(username);
959-
960- return SASL_OK;
961-}
962-
963-static int get_password(sasl_conn_t *conn, void *context, int id,
964- sasl_secret_t **psecret)
965-{
966- (void)context;
967- static sasl_secret_t* x;
968-
969- if (!conn || ! psecret || id != SASL_CB_PASS)
970- return SASL_BADPARAM;
971-
972- if (passwd == NULL)
973- {
974- *psecret= NULL;
975- return SASL_OK;
976- }
977-
978- size_t len= strlen(passwd);
979- x = realloc(x, sizeof(sasl_secret_t) + len);
980- if (!x)
981- return SASL_NOMEM;
982-
983- x->len = len;
984- strcpy((void *)x->data, passwd);
985-
986- *psecret = x;
987- return SASL_OK;
988-}
989-
990-/* callbacks we support */
991-static sasl_callback_t sasl_callbacks[] = {
992- {
993- SASL_CB_USER, &get_username, NULL
994- }, {
995- SASL_CB_AUTHNAME, &get_username, NULL
996- }, {
997- SASL_CB_PASS, &get_password, NULL
998- }, {
999- SASL_CB_LIST_END, NULL, NULL
1000- }
1001-};
1002-#endif
1003-
1004-bool initialize_sasl(memcached_st *memc, char *user, char *password)
1005-{
1006-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
1007- if (user != NULL && password != NULL)
1008- {
1009- username= user;
1010- passwd= password;
1011-
1012- if (sasl_client_init(NULL) != SASL_OK)
1013- {
1014- fprintf(stderr, "Failed to initialize sasl library!\n");
1015- return false;
1016- }
1017- memcached_set_sasl_callbacks(memc, sasl_callbacks);
1018- }
1019-#else
1020- (void)memc;
1021- (void)user;
1022- (void)password;
1023-#endif
1024-
1025- return true;
1026-}
1027-
1028-void shutdown_sasl(void)
1029-{
1030-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
1031- if (username != NULL || passwd != NULL)
1032- sasl_done();
1033-#endif
1034-}
1035-
1036-void initialize_sockets(void)
1037-{
1038- /* Define the function for all platforms to avoid #ifdefs in each program */
1039-#ifdef WIN32
1040- WSADATA wsaData;
1041- if (WSAStartup(MAKEWORD(2,0), &wsaData) != 0)
1042- {
1043- fprintf(stderr, "Socket Initialization Error. Program aborted\n");
1044- exit(EXIT_FAILURE);
1045- }
1046-#endif
1047-}
1048+/* LibMemcached
1049+ * Copyright (C) 2006-2009 Brian Aker
1050+ * All rights reserved.
1051+ *
1052+ * Use and distribution licensed under the BSD license. See
1053+ * the COPYING file in the parent directory for full text.
1054+ *
1055+ * Summary:
1056+ *
1057+ */
1058+#include "config.h"
1059+
1060+#include <stdio.h>
1061+#include <ctype.h>
1062+#include <string.h>
1063+#include "utilities.h"
1064+
1065+#ifdef WIN32
1066+#include <assert.h>
1067+
1068+long long strtoll(char const* s, char** sN, int base)
1069+{
1070+ assert(sN == 0);
1071+ assert(base == 10);
1072+ return _atoi64(s);
1073+}
1074+#endif
1075+
1076+long int timedif(struct timeval a, struct timeval b)
1077+{
1078+ long us, s;
1079+
1080+ us = (int)(a.tv_usec - b.tv_usec);
1081+ us /= 1000;
1082+ s = (int)(a.tv_sec - b.tv_sec);
1083+ s *= 1000;
1084+ return s + us;
1085+}
1086+
1087+void version_command(const char *command_name)
1088+{
1089+ printf("%s v%u.%u\n", command_name, 1U, 0U);
1090+ exit(0);
1091+}
1092+
1093+static const char *lookup_help(memcached_options option)
1094+{
1095+ switch (option)
1096+ {
1097+ case OPT_SERVERS: return("List which servers you wish to connect to.");
1098+ case OPT_VERSION: return("Display the version of the application and then exit.");
1099+ case OPT_HELP: return("Display this message and then exit.");
1100+ case OPT_VERBOSE: return("Give more details on the progression of the application.");
1101+ case OPT_DEBUG: return("Provide output only useful for debugging.");
1102+ case OPT_FLAG: return("Provide flag information for storage operation.");
1103+ case OPT_EXPIRE: return("Set the expire option for the object.");
1104+ case OPT_SET: return("Use set command with memcached when storing.");
1105+ case OPT_REPLACE: return("Use replace command with memcached when storing.");
1106+ case OPT_ADD: return("Use add command with memcached when storing.");
1107+ case OPT_SLAP_EXECUTE_NUMBER: return("Number of times to execute the given test.");
1108+ case OPT_SLAP_INITIAL_LOAD: return("Number of key pairs to load before executing tests.");
1109+ case OPT_SLAP_TEST: return("Test to run (currently \"get\" or \"set\").");
1110+ case OPT_SLAP_CONCURRENCY: return("Number of users to simulate with load.");
1111+ case OPT_SLAP_NON_BLOCK: return("Set TCP up to use non-blocking IO.");
1112+ case OPT_SLAP_TCP_NODELAY: return("Set TCP socket up to use nodelay.");
1113+ case OPT_FLUSH: return("Flush servers before running tests.");
1114+ case OPT_HASH: return("Select hash type.");
1115+ case OPT_BINARY: return("Switch to binary protocol.");
1116+ case OPT_ANALYZE: return("Analyze the provided servers.");
1117+ case OPT_UDP: return("Use UDP protocol when communicating with server.");
1118+ case OPT_USERNAME: return "Username to use for SASL authentication";
1119+ case OPT_PASSWD: return "Password to use for SASL authentication";
1120+ case OPT_FILE: return "Path to file in which to save result";
1121+ case OPT_STAT_ARGS: return "Argument for statistics";
1122+ default: WATCHPOINT_ASSERT(0);
1123+ };
1124+
1125+ WATCHPOINT_ASSERT(0);
1126+ return "forgot to document this function :)";
1127+}
1128+
1129+void help_command(const char *command_name, const char *description,
1130+ const struct option *long_options,
1131+ memcached_programs_help_st *options __attribute__((unused)))
1132+{
1133+ unsigned int x;
1134+
1135+ printf("%s v%u.%u\n\n", command_name, 1U, 0U);
1136+ printf("\t%s\n\n", description);
1137+ printf("Current options. A '=' means the option takes a value.\n\n");
1138+
1139+ for (x= 0; long_options[x].name; x++)
1140+ {
1141+ const char *help_message;
1142+
1143+ printf("\t --%s%c\n", long_options[x].name,
1144+ long_options[x].has_arg ? '=' : ' ');
1145+ if ((help_message= lookup_help(long_options[x].val)))
1146+ printf("\t\t%s\n", help_message);
1147+ }
1148+
1149+ printf("\n");
1150+ exit(0);
1151+}
1152+
1153+void process_hash_option(memcached_st *memc, char *opt_hash)
1154+{
1155+ uint64_t set;
1156+ memcached_return_t rc;
1157+
1158+ if (opt_hash == NULL)
1159+ return;
1160+
1161+ set= MEMCACHED_HASH_DEFAULT; /* Just here to solve warning */
1162+ if (!strcasecmp(opt_hash, "CRC"))
1163+ set= MEMCACHED_HASH_CRC;
1164+ else if (!strcasecmp(opt_hash, "FNV1_64"))
1165+ set= MEMCACHED_HASH_FNV1_64;
1166+ else if (!strcasecmp(opt_hash, "FNV1A_64"))
1167+ set= MEMCACHED_HASH_FNV1A_64;
1168+ else if (!strcasecmp(opt_hash, "FNV1_32"))
1169+ set= MEMCACHED_HASH_FNV1_32;
1170+ else if (!strcasecmp(opt_hash, "FNV1A_32"))
1171+ set= MEMCACHED_HASH_FNV1A_32;
1172+ else
1173+ {
1174+ fprintf(stderr, "hash: type not recognized %s\n", opt_hash);
1175+ exit(1);
1176+ }
1177+
1178+ rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set);
1179+ if (rc != MEMCACHED_SUCCESS)
1180+ {
1181+ fprintf(stderr, "hash: memcache error %s\n", memcached_strerror(memc, rc));
1182+ exit(1);
1183+ }
1184+}
1185+
1186+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
1187+static char *username;
1188+static char *passwd;
1189+
1190+static int get_username(void *context, int id, const char **result,
1191+ unsigned int *len)
1192+{
1193+ (void)context;
1194+ if (!result || (id != SASL_CB_USER && id != SASL_CB_AUTHNAME))
1195+ return SASL_BADPARAM;
1196+
1197+ *result= username;
1198+ if (len)
1199+ *len= (username == NULL) ? 0 : (unsigned int)strlen(username);
1200+
1201+ return SASL_OK;
1202+}
1203+
1204+static int get_password(sasl_conn_t *conn, void *context, int id,
1205+ sasl_secret_t **psecret)
1206+{
1207+ (void)context;
1208+ static sasl_secret_t* x;
1209+
1210+ if (!conn || ! psecret || id != SASL_CB_PASS)
1211+ return SASL_BADPARAM;
1212+
1213+ if (passwd == NULL)
1214+ {
1215+ *psecret= NULL;
1216+ return SASL_OK;
1217+ }
1218+
1219+ size_t len= strlen(passwd);
1220+ x = realloc(x, sizeof(sasl_secret_t) + len);
1221+ if (!x)
1222+ return SASL_NOMEM;
1223+
1224+ x->len = len;
1225+ strcpy((void *)x->data, passwd);
1226+
1227+ *psecret = x;
1228+ return SASL_OK;
1229+}
1230+
1231+/* callbacks we support */
1232+static sasl_callback_t sasl_callbacks[] = {
1233+ {
1234+ SASL_CB_USER, &get_username, NULL
1235+ }, {
1236+ SASL_CB_AUTHNAME, &get_username, NULL
1237+ }, {
1238+ SASL_CB_PASS, &get_password, NULL
1239+ }, {
1240+ SASL_CB_LIST_END, NULL, NULL
1241+ }
1242+};
1243+#endif
1244+
1245+bool initialize_sasl(memcached_st *memc, char *user, char *password)
1246+{
1247+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
1248+ if (user != NULL && password != NULL)
1249+ {
1250+ username= user;
1251+ passwd= password;
1252+
1253+ if (sasl_client_init(NULL) != SASL_OK)
1254+ {
1255+ fprintf(stderr, "Failed to initialize sasl library!\n");
1256+ return false;
1257+ }
1258+ memcached_set_sasl_callbacks(memc, sasl_callbacks);
1259+ }
1260+#else
1261+ (void)memc;
1262+ (void)user;
1263+ (void)password;
1264+#endif
1265+
1266+ return true;
1267+}
1268+
1269+void shutdown_sasl(void)
1270+{
1271+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
1272+ if (username != NULL || passwd != NULL)
1273+ sasl_done();
1274+#endif
1275+}
1276+
1277+void initialize_sockets(void)
1278+{
1279+ /* Define the function for all platforms to avoid #ifdefs in each program */
1280+#ifdef WIN32
1281+ WSADATA wsaData;
1282+ if (WSAStartup(MAKEWORD(2,0), &wsaData) != 0)
1283+ {
1284+ fprintf(stderr, "Socket Initialization Error. Program aborted\n");
1285+ exit(EXIT_FAILURE);
1286+ }
1287+#endif
1288+}
1289
1290=== modified file 'clients/utilities.h'
1291--- clients/utilities.h 2010-07-27 22:38:51 +0000
1292+++ clients/utilities.h 2011-01-13 03:40:43 +0000
1293@@ -34,6 +34,11 @@
1294 #define OPTIONSTRING const char*
1295 #endif
1296
1297+#ifdef WIN32
1298+# define strcasecmp strcmp
1299+long long strtoll(char const* s, char** sN, int base);
1300+#endif
1301+
1302 typedef struct memcached_programs_help_st memcached_programs_help_st;
1303
1304 struct memcached_programs_help_st
1305
1306=== modified file 'libhashkit/common.h'
1307--- libhashkit/common.h 2010-09-13 12:27:18 +0000
1308+++ libhashkit/common.h 2011-01-13 03:40:43 +0000
1309@@ -17,6 +17,26 @@
1310 #include <stdlib.h>
1311 #include <math.h>
1312
1313+#ifdef WIN32
1314+
1315+#include <limits.h>
1316+#define UINT32_MAX UINT_MAX
1317+
1318+#define __CONCAT(x, y) (x##y)
1319+
1320+#define INT8_C(value) ((int8_t) value)
1321+#define UINT8_C(value) ((uint8_t) __CONCAT(value, U))
1322+#define INT16_C(value) value
1323+#define UINT16_C(value) __CONCAT(value, U)
1324+#define INT32_C(value) __CONCAT(value, L)
1325+#define UINT32_C(value) __CONCAT(value, UL)
1326+#define INT64_C(value) __CONCAT(value, LL)
1327+#define UINT64_C(value) __CONCAT(value, ULL)
1328+#define INTMAX_C(value) __CONCAT(value, LL)
1329+#define UINTMAX_C(value) __CONCAT(value, ULL)
1330+
1331+#endif
1332+
1333 #include "hashkit.h"
1334
1335 #ifdef __cplusplus
1336
1337=== modified file 'libhashkit/fnv.c'
1338--- libhashkit/fnv.c 2010-01-19 23:39:13 +0000
1339+++ libhashkit/fnv.c 2011-01-13 03:40:43 +0000
1340@@ -18,8 +18,9 @@
1341 {
1342 /* Thanks to pierre@demartines.com for the pointer */
1343 uint64_t hash= FNV_64_INIT;
1344+ size_t x;
1345
1346- for (size_t x= 0; x < key_length; x++)
1347+ for (x= 0; x < key_length; x++)
1348 {
1349 hash *= FNV_64_PRIME;
1350 hash ^= (uint64_t)key[x];
1351@@ -31,8 +32,9 @@
1352 uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context __attribute__((unused)))
1353 {
1354 uint32_t hash= (uint32_t) FNV_64_INIT;
1355+ size_t x;
1356
1357- for (size_t x= 0; x < key_length; x++)
1358+ for (x= 0; x < key_length; x++)
1359 {
1360 uint32_t val= (uint32_t)key[x];
1361 hash ^= val;
1362@@ -45,8 +47,9 @@
1363 uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context __attribute__((unused)))
1364 {
1365 uint32_t hash= FNV_32_INIT;
1366+ size_t x;
1367
1368- for (size_t x= 0; x < key_length; x++)
1369+ for (x= 0; x < key_length; x++)
1370 {
1371 uint32_t val= (uint32_t)key[x];
1372 hash *= FNV_32_PRIME;
1373@@ -59,8 +62,9 @@
1374 uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void *context __attribute__((unused)))
1375 {
1376 uint32_t hash= FNV_32_INIT;
1377+ size_t x;
1378
1379- for (size_t x= 0; x < key_length; x++)
1380+ for (x= 0; x < key_length; x++)
1381 {
1382 uint32_t val= (uint32_t)key[x];
1383 hash ^= val;
1384
1385=== modified file 'libhashkit/hashkit.c'
1386--- libhashkit/hashkit.c 2010-01-22 19:04:16 +0000
1387+++ libhashkit/hashkit.c 2011-01-13 03:40:43 +0000
1388@@ -8,18 +8,16 @@
1389
1390 #include "common.h"
1391
1392-static const hashkit_st global_default_hash= {
1393- .base_hash= {
1394- .function= hashkit_one_at_a_time,
1395- .context= NULL
1396- },
1397- .flags= {
1398- .is_base_same_distributed= false,
1399- }
1400-};
1401+static hashkit_st global_default_hash;
1402
1403 static inline bool _hashkit_init(hashkit_st *self)
1404 {
1405+ memset(&global_default_hash, 0, sizeof(global_default_hash));
1406+
1407+ global_default_hash.base_hash.function = hashkit_one_at_a_time;
1408+ global_default_hash.base_hash.context = NULL;
1409+ global_default_hash.flags.is_base_same_distributed = false;
1410+
1411 self->base_hash= global_default_hash.base_hash;
1412 self->distribution_hash= global_default_hash.base_hash;
1413 self->flags= global_default_hash.flags;
1414
1415=== modified file 'libhashkit/visibility.h'
1416--- libhashkit/visibility.h 2009-12-17 17:28:30 +0000
1417+++ libhashkit/visibility.h 2011-01-13 03:40:43 +0000
1418@@ -32,16 +32,26 @@
1419 # define HASHKIT_API __global
1420 # define HASHKIT_LOCAL __hidden
1421 # elif defined(_MSC_VER)
1422-# define HASHKIT_API extern __declspec(dllexport)
1423-# define HASHKIT_LOCAL
1424+# if defined(LIBMEMCACHED_STATIC)
1425+# define HASHKIT_API
1426+# define HASHKIT_LOCAL
1427+# else
1428+# define HASHKIT_API extern __declspec(dllexport)
1429+# define HASHKIT_LOCAL
1430+# endif
1431 # else
1432 # define HASHKIT_API
1433 # define HASHKIT_LOCAL
1434 # endif /* defined(HAVE_VISIBILITY) */
1435 #else /* defined(BUILDING_HASHKIT) */
1436 # if defined(_MSC_VER)
1437-# define HASHKIT_API extern __declspec(dllimport)
1438-# define HASHKIT_LOCAL
1439+# if defined(LIBMEMCACHED_STATIC)
1440+# define HASHKIT_API
1441+# define HASHKIT_LOCAL
1442+# else
1443+# define HASHKIT_API extern __declspec(dllimport)
1444+# define HASHKIT_LOCAL
1445+# endif
1446 # else
1447 # define HASHKIT_API
1448 # define HASHKIT_LOCAL
1449
1450=== modified file 'libmemcached/allocators.c'
1451--- libmemcached/allocators.c 2010-01-18 22:58:20 +0000
1452+++ libmemcached/allocators.c 2011-01-13 03:40:43 +0000
1453@@ -23,7 +23,7 @@
1454
1455 void *_libmemcached_calloc(const memcached_st *ptr, size_t nelem, size_t size, void *context)
1456 {
1457- if (ptr->allocators.malloc != _libmemcached_malloc)
1458+ if (ptr->allocators->malloc != _libmemcached_malloc)
1459 {
1460 void *ret = _libmemcached_malloc(ptr, nelem * size, context);
1461 if (ret != NULL)
1462@@ -35,16 +35,26 @@
1463 return calloc(nelem, size);
1464 }
1465
1466-static const struct _allocators_st global_default_allocator= {
1467- .calloc= _libmemcached_calloc,
1468- .context= NULL,
1469- .free= _libmemcached_free,
1470- .malloc= _libmemcached_malloc,
1471- .realloc= _libmemcached_realloc
1472-};
1473-
1474-struct _allocators_st memcached_allocators_return_default(void)
1475+struct _allocators_st *create_global_default_allocator()
1476 {
1477+ struct _allocators_st *allocator = (struct _allocators_st *) malloc(sizeof(struct _allocators_st));
1478+
1479+ allocator->calloc= _libmemcached_calloc;
1480+ allocator->context= NULL;
1481+ allocator->free= _libmemcached_free;
1482+ allocator->malloc= _libmemcached_malloc;
1483+ allocator->realloc= _libmemcached_realloc;
1484+
1485+ return allocator;
1486+}
1487+
1488+static struct _allocators_st *global_default_allocator = NULL;
1489+
1490+struct _allocators_st *memcached_allocators_return_default(void)
1491+{
1492+ if (global_default_allocator == NULL)
1493+ global_default_allocator = create_global_default_allocator();
1494+
1495 return global_default_allocator;
1496 }
1497
1498@@ -66,11 +76,11 @@
1499 }
1500 else
1501 {
1502- ptr->allocators.malloc= mem_malloc;
1503- ptr->allocators.free= mem_free;
1504- ptr->allocators.realloc= mem_realloc;
1505- ptr->allocators.calloc= mem_calloc;
1506- ptr->allocators.context= context;
1507+ ptr->allocators->malloc= mem_malloc;
1508+ ptr->allocators->free= mem_free;
1509+ ptr->allocators->realloc= mem_realloc;
1510+ ptr->allocators->calloc= mem_calloc;
1511+ ptr->allocators->context= context;
1512 }
1513
1514 return MEMCACHED_SUCCESS;
1515@@ -78,7 +88,7 @@
1516
1517 void *memcached_get_memory_allocators_context(const memcached_st *ptr)
1518 {
1519- return ptr->allocators.context;
1520+ return ptr->allocators->context;
1521 }
1522
1523 void memcached_get_memory_allocators(const memcached_st *ptr,
1524@@ -87,8 +97,8 @@
1525 memcached_realloc_fn *mem_realloc,
1526 memcached_calloc_fn *mem_calloc)
1527 {
1528- *mem_malloc= ptr->allocators.malloc;
1529- *mem_free= ptr->allocators.free;
1530- *mem_realloc= ptr->allocators.realloc;
1531- *mem_calloc= ptr->allocators.calloc;
1532+ *mem_malloc= ptr->allocators->malloc;
1533+ *mem_free= ptr->allocators->free;
1534+ *mem_realloc= ptr->allocators->realloc;
1535+ *mem_calloc= ptr->allocators->calloc;
1536 }
1537
1538=== modified file 'libmemcached/allocators.h'
1539--- libmemcached/allocators.h 2010-01-21 23:45:12 +0000
1540+++ libmemcached/allocators.h 2011-01-13 03:40:43 +0000
1541@@ -47,7 +47,7 @@
1542 void *_libmemcached_calloc(const memcached_st *ptr, size_t nelem, size_t size, void *context);
1543
1544 LIBMEMCACHED_LOCAL
1545-struct _allocators_st memcached_allocators_return_default(void);
1546+struct _allocators_st *memcached_allocators_return_default(void);
1547
1548 #ifdef __cplusplus
1549 }
1550
1551=== modified file 'libmemcached/analyze.c'
1552--- libmemcached/analyze.c 2010-01-10 00:49:55 +0000
1553+++ libmemcached/analyze.c 2011-01-13 03:40:43 +0000
1554@@ -49,13 +49,15 @@
1555 const uint64_t total_get_hits,
1556 const uint64_t total_get_cmds)
1557 {
1558+ double temp;
1559+
1560 if (total_get_hits == 0 || total_get_cmds == 0)
1561 {
1562 result->pool_hit_ratio= 0;
1563 return;
1564 }
1565
1566- double temp= (double) (total_get_hits/total_get_cmds);
1567+ temp = (double) (total_get_hits/total_get_cmds);
1568 result->pool_hit_ratio= temp * 100;
1569 }
1570
1571
1572=== modified file 'libmemcached/auto.c'
1573--- libmemcached/auto.c 2010-09-13 12:26:17 +0000
1574+++ libmemcached/auto.c 2011-01-13 03:40:43 +0000
1575@@ -89,6 +89,11 @@
1576 {
1577 uint32_t server_key;
1578 memcached_server_write_instance_st instance;
1579+ protocol_binary_request_incr request;
1580+ memcached_return_t rc;
1581+
1582+ struct libmemcached_io_vector_st vector[3];
1583+
1584 bool no_reply= ptr->flags.no_reply;
1585
1586 unlikely (memcached_server_count(ptr) == 0)
1587@@ -103,8 +108,9 @@
1588 cmd= PROTOCOL_BINARY_CMD_DECREMENTQ;
1589 if(cmd == PROTOCOL_BINARY_CMD_INCREMENT)
1590 cmd= PROTOCOL_BINARY_CMD_INCREMENTQ;
1591- }
1592- protocol_binary_request_incr request= {.bytes= {0}};
1593+ }
1594+
1595+ memset(&request, 0, sizeof(request));
1596
1597 request.message.header.request.magic= PROTOCOL_BINARY_REQ;
1598 request.message.header.request.opcode= cmd;
1599@@ -116,14 +122,13 @@
1600 request.message.body.initial= htonll(initial);
1601 request.message.body.expiration= htonl((uint32_t) expiration);
1602
1603- struct libmemcached_io_vector_st vector[]=
1604- {
1605- { .length= sizeof(request.bytes), .buffer= request.bytes },
1606- { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
1607- { .length= key_length, .buffer= key }
1608- };
1609+ vector[0].length= sizeof(request.bytes);
1610+ vector[0].buffer= request.bytes;
1611+ vector[1].length= ptr->prefix_key_length;
1612+ vector[1].buffer= ptr->prefix_key;
1613+ vector[2].length= key_length;
1614+ vector[2].buffer= key;
1615
1616- memcached_return_t rc;
1617 if ((rc= memcached_vdo(instance, vector, 3, true)) != MEMCACHED_SUCCESS)
1618 {
1619 memcached_io_reset(instance);
1620
1621=== modified file 'libmemcached/behavior.c'
1622--- libmemcached/behavior.c 2010-07-27 22:38:51 +0000
1623+++ libmemcached/behavior.c 2011-01-13 03:40:43 +0000
1624@@ -178,6 +178,9 @@
1625 case MEMCACHED_BEHAVIOR_CORK:
1626 {
1627 memcached_server_write_instance_st instance;
1628+ memcached_return_t rc;
1629+ memcached_ternary_t enabled;
1630+
1631 bool action= set_flag(data);
1632
1633 if (action == false)
1634@@ -191,16 +194,14 @@
1635 return MEMCACHED_NO_SERVERS;
1636
1637
1638- /* We just try the first host, and if it is down we return zero */
1639- memcached_return_t rc;
1640+ /* We just try the first host, and if it is down we return zero */
1641 rc= memcached_connect(instance);
1642 if (rc != MEMCACHED_SUCCESS)
1643 {
1644 return rc;
1645 }
1646
1647- /* Now we test! */
1648- memcached_ternary_t enabled;
1649+ /* Now we test! */
1650 enabled= test_cork(instance, true);
1651
1652 switch (enabled)
1653
1654=== modified file 'libmemcached/byteorder.c'
1655--- libmemcached/byteorder.c 2010-09-02 08:23:44 +0000
1656+++ libmemcached/byteorder.c 2011-01-13 03:40:43 +0000
1657@@ -19,7 +19,9 @@
1658 /* Little endian, flip the bytes around until someone makes a faster/better
1659 * way to do this. */
1660 uint64_t rv= 0;
1661- for (uint8_t x= 0; x < 8; x++)
1662+ uint8_t x;
1663+
1664+ for (x= 0; x < 8; x++)
1665 {
1666 rv= (rv << 8) | (in & 0xff);
1667 in >>= 8;
1668
1669=== modified file 'libmemcached/common.h'
1670--- libmemcached/common.h 2010-07-27 22:38:51 +0000
1671+++ libmemcached/common.h 2011-01-13 03:40:43 +0000
1672@@ -21,10 +21,18 @@
1673 #include <stdio.h>
1674 #include <stdlib.h>
1675 #include <string.h>
1676-#include <strings.h>
1677+
1678+#ifdef WIN32
1679+# define snprintf _snprintf
1680+# define strtoull strtoul
1681+#else
1682+# include <strings.h>
1683+# include <unistd.h>
1684+#endif
1685+
1686 #include <ctype.h>
1687 #include <sys/types.h>
1688-#include <unistd.h>
1689+
1690 #include <limits.h>
1691 #include <errno.h>
1692 #include <fcntl.h>
1693@@ -204,22 +212,22 @@
1694
1695 static inline void libmemcached_free(const memcached_st *ptr, void *mem)
1696 {
1697- ptr->allocators.free(ptr, mem, ptr->allocators.context);
1698+ ptr->allocators->free(ptr, mem, ptr->allocators->context);
1699 }
1700
1701 static inline void *libmemcached_malloc(const memcached_st *ptr, const size_t size)
1702 {
1703- return ptr->allocators.malloc(ptr, size, ptr->allocators.context);
1704+ return ptr->allocators->malloc(ptr, size, ptr->allocators->context);
1705 }
1706
1707 static inline void *libmemcached_realloc(const memcached_st *ptr, void *mem, const size_t size)
1708 {
1709- return ptr->allocators.realloc(ptr, mem, size, ptr->allocators.context);
1710+ return ptr->allocators->realloc(ptr, mem, size, ptr->allocators->context);
1711 }
1712
1713 static inline void *libmemcached_calloc(const memcached_st *ptr, size_t nelem, size_t size)
1714 {
1715- return ptr->allocators.calloc(ptr, nelem, size, ptr->allocators.context);
1716+ return ptr->allocators->calloc(ptr, nelem, size, ptr->allocators->context);
1717 }
1718
1719 #ifdef __cplusplus
1720
1721=== modified file 'libmemcached/connect.c'
1722--- libmemcached/connect.c 2010-09-13 06:05:34 +0000
1723+++ libmemcached/connect.c 2011-01-13 03:40:43 +0000
1724@@ -10,22 +10,26 @@
1725 */
1726
1727 #include "common.h"
1728-#include <sys/time.h>
1729+#ifndef WIN32
1730+# include <sys/time.h>
1731+#endif
1732 #include <time.h>
1733
1734 static memcached_return_t connect_poll(memcached_server_st *ptr)
1735 {
1736+ int timeout;
1737+
1738+ int error;
1739+ size_t loop_max= 5;
1740+
1741 struct pollfd fds[1];
1742 fds[0].fd = ptr->fd;
1743 fds[0].events = POLLOUT;
1744
1745- int timeout= ptr->root->connect_timeout;
1746+ timeout= ptr->root->connect_timeout;
1747 if (ptr->root->flags.no_block == true)
1748 timeout= -1;
1749
1750- int error;
1751- size_t loop_max= 5;
1752-
1753 while (--loop_max) // Should only loop on cases of ERESTART or EINTR
1754 {
1755 error= poll(fds, 1, timeout);
1756@@ -371,7 +375,7 @@
1757 static memcached_return_t network_connect(memcached_server_st *ptr)
1758 {
1759 bool timeout_error_occured= false;
1760-
1761+ struct addrinfo *use;
1762
1763 WATCHPOINT_ASSERT(ptr->fd == INVALID_SOCKET);
1764 WATCHPOINT_ASSERT(ptr->cursor_active == 0);
1765@@ -386,7 +390,7 @@
1766 ptr->options.sockaddr_inited= true;
1767 }
1768
1769- struct addrinfo *use= ptr->address_info;
1770+ use= ptr->address_info;
1771 /* Create the socket */
1772 while (use != NULL)
1773 {
1774
1775=== modified file 'libmemcached/delete.c'
1776--- libmemcached/delete.c 2010-09-13 12:26:17 +0000
1777+++ libmemcached/delete.c 2011-01-13 03:40:43 +0000
1778@@ -25,6 +25,7 @@
1779 char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
1780 uint32_t server_key;
1781 memcached_server_write_instance_st instance;
1782+ bool no_reply;
1783
1784 LIBMEMCACHED_MEMCACHED_DELETE_START();
1785
1786@@ -41,7 +42,7 @@
1787
1788 to_write= (ptr->flags.buffer_requests) ? false : true;
1789
1790- bool no_reply= (ptr->flags.no_reply);
1791+ no_reply= (ptr->flags.no_reply);
1792
1793 if (ptr->flags.binary_protocol)
1794 {
1795@@ -153,7 +154,12 @@
1796 bool flush)
1797 {
1798 memcached_server_write_instance_st instance;
1799- protocol_binary_request_delete request= {.bytes= {0}};
1800+ protocol_binary_request_delete request;
1801+ struct libmemcached_io_vector_st vector[3];
1802+ memcached_return_t rc;
1803+ uint32_t x;
1804+
1805+ memset(&request, 0, sizeof(request));
1806
1807 instance= memcached_server_instance_fetch(ptr, server_key);
1808
1809@@ -175,14 +181,14 @@
1810 memcached_io_write(instance, NULL, 0, true);
1811 }
1812
1813- struct libmemcached_io_vector_st vector[]=
1814- {
1815- { .length= sizeof(request.bytes), .buffer= request.bytes},
1816- { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
1817- { .length= key_length, .buffer= key },
1818- };
1819+ vector[0].length= sizeof(request.bytes);
1820+ vector[0].buffer= request.bytes;
1821+ vector[1].length= ptr->prefix_key_length;
1822+ vector[1].buffer= ptr->prefix_key;
1823+ vector[2].length= key_length;
1824+ vector[2].buffer= key;
1825
1826- memcached_return_t rc= MEMCACHED_SUCCESS;
1827+ rc= MEMCACHED_SUCCESS;
1828
1829 if ((rc= memcached_vdo(instance, vector, 3, flush)) != MEMCACHED_SUCCESS)
1830 {
1831@@ -194,7 +200,7 @@
1832 {
1833 request.message.header.request.opcode= PROTOCOL_BINARY_CMD_DELETEQ;
1834
1835- for (uint32_t x= 0; x < ptr->number_of_replicas; ++x)
1836+ for (x= 0; x < ptr->number_of_replicas; ++x)
1837 {
1838 memcached_server_write_instance_st replica;
1839
1840
1841=== modified file 'libmemcached/do.c'
1842--- libmemcached/do.c 2010-09-13 12:26:17 +0000
1843+++ libmemcached/do.c 2011-01-13 03:40:43 +0000
1844@@ -56,6 +56,8 @@
1845 {
1846 memcached_return_t rc;
1847 ssize_t sent_length;
1848+ size_t command_length;
1849+ uint32_t x;
1850
1851 WATCHPOINT_ASSERT(count);
1852 WATCHPOINT_ASSERT(vector);
1853@@ -78,8 +80,8 @@
1854
1855 sent_length= memcached_io_writev(ptr, vector, count, with_flush);
1856
1857- size_t command_length= 0;
1858- for (uint32_t x= 0; x < count; ++x, vector++)
1859+ command_length= 0;
1860+ for (x= 0; x < count; ++x, vector++)
1861 {
1862 command_length+= vector->length;
1863 }
1864
1865=== modified file 'libmemcached/fetch.c'
1866--- libmemcached/fetch.c 2010-04-01 21:30:52 +0000
1867+++ libmemcached/fetch.c 2011-01-13 03:40:43 +0000
1868@@ -91,12 +91,13 @@
1869 {
1870 memcached_result_st *result= &ptr->result;
1871 memcached_return_t rc= MEMCACHED_FAILURE;
1872+ uint32_t x;
1873
1874 while ((result= memcached_fetch_result(ptr, result, &rc)) != NULL)
1875 {
1876 if (rc == MEMCACHED_SUCCESS)
1877 {
1878- for (uint32_t x= 0; x < number_of_callbacks; x++)
1879+ for (x= 0; x < number_of_callbacks; x++)
1880 {
1881 rc= (*callback[x])(ptr, result, context);
1882 if (rc != MEMCACHED_SUCCESS)
1883
1884=== modified file 'libmemcached/flush.c'
1885--- libmemcached/flush.c 2010-04-02 19:55:21 +0000
1886+++ libmemcached/flush.c 2011-01-13 03:40:43 +0000
1887@@ -55,7 +55,10 @@
1888 static memcached_return_t memcached_flush_binary(memcached_st *ptr,
1889 time_t expiration)
1890 {
1891- protocol_binary_request_flush request= {.bytes= {0}};
1892+ protocol_binary_request_flush request;
1893+ uint32_t x;
1894+
1895+ memset(&request, 0, sizeof(request));
1896
1897 unlikely (memcached_server_count(ptr) == 0)
1898 return MEMCACHED_NO_SERVERS;
1899@@ -67,7 +70,7 @@
1900 request.message.header.request.bodylen= htonl(request.message.header.request.extlen);
1901 request.message.body.expiration= htonl((uint32_t) expiration);
1902
1903- for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
1904+ for (x= 0; x < memcached_server_count(ptr); x++)
1905 {
1906 memcached_server_write_instance_st instance=
1907 memcached_server_instance_fetch(ptr, x);
1908@@ -88,7 +91,7 @@
1909 }
1910 }
1911
1912- for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
1913+ for (x= 0; x < memcached_server_count(ptr); x++)
1914 {
1915 memcached_server_write_instance_st instance=
1916 memcached_server_instance_fetch(ptr, x);
1917
1918=== modified file 'libmemcached/flush_buffers.c'
1919--- libmemcached/flush_buffers.c 2010-02-13 02:23:49 +0000
1920+++ libmemcached/flush_buffers.c 2011-01-13 03:40:43 +0000
1921@@ -3,8 +3,9 @@
1922 memcached_return_t memcached_flush_buffers(memcached_st *memc)
1923 {
1924 memcached_return_t ret= MEMCACHED_SUCCESS;
1925+ uint32_t x;
1926
1927- for (uint32_t x= 0; x < memcached_server_count(memc); ++x)
1928+ for (x= 0; x < memcached_server_count(memc); ++x)
1929 {
1930 memcached_server_write_instance_st instance=
1931 memcached_server_instance_fetch(memc, x);
1932
1933=== modified file 'libmemcached/get.c'
1934--- libmemcached/get.c 2010-09-13 12:26:17 +0000
1935+++ libmemcached/get.c 2011-01-13 03:40:43 +0000
1936@@ -149,6 +149,8 @@
1937 uint8_t get_command_length= 4;
1938 unsigned int master_server_key= (unsigned int)-1; /* 0 is a valid server id! */
1939 bool is_master_key_set= false;
1940+ uint32_t x;
1941+ struct libmemcached_io_vector_st vector[4];
1942
1943 unlikely (ptr->flags.use_udp)
1944 return MEMCACHED_NOT_SUPPORTED;
1945@@ -178,7 +180,7 @@
1946
1947 It might be optimum to bounce the connection if count > some number.
1948 */
1949- for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
1950+ for (x= 0; x < memcached_server_count(ptr); x++)
1951 {
1952 memcached_server_write_instance_st instance=
1953 memcached_server_instance_fetch(ptr, x);
1954@@ -211,7 +213,7 @@
1955 If a server fails we warn about errors and start all over with sending keys
1956 to the server.
1957 */
1958- for (uint32_t x= 0; x < number_of_keys; x++)
1959+ for (x= 0; x < number_of_keys; x++)
1960 {
1961 memcached_server_write_instance_st instance;
1962 uint32_t server_key;
1963@@ -227,14 +229,14 @@
1964
1965 instance= memcached_server_instance_fetch(ptr, server_key);
1966
1967- struct libmemcached_io_vector_st vector[]=
1968- {
1969- { .length= get_command_length, .buffer= get_command },
1970- { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
1971- { .length= key_length[x], .buffer= keys[x] },
1972- { .length= 1, .buffer= " " }
1973- };
1974-
1975+ vector[0].length= get_command_length;
1976+ vector[0].buffer= get_command;
1977+ vector[1].length= ptr->prefix_key_length;
1978+ vector[1].buffer= ptr->prefix_key;
1979+ vector[2].length= key_length[x];
1980+ vector[2].buffer= keys[x];
1981+ vector[3].length= 1;
1982+ vector[3].buffer= " ";
1983
1984 if (memcached_server_response_count(instance) == 0)
1985 {
1986@@ -266,7 +268,7 @@
1987 /*
1988 Should we muddle on if some servers are dead?
1989 */
1990- for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
1991+ for (x= 0; x < memcached_server_count(ptr); x++)
1992 {
1993 memcached_server_write_instance_st instance=
1994 memcached_server_instance_fetch(ptr, x);
1995@@ -319,16 +321,16 @@
1996 void *context,
1997 unsigned int number_of_callbacks)
1998 {
1999+ memcached_return_t rc;
2000+ memcached_callback_st *original_callbacks= ptr->callbacks;
2001+ memcached_callback_st cb;
2002+
2003 if ((ptr->flags.binary_protocol) == 0)
2004 return MEMCACHED_NOT_SUPPORTED;
2005
2006- memcached_return_t rc;
2007- memcached_callback_st *original_callbacks= ptr->callbacks;
2008- memcached_callback_st cb= {
2009- .callback= callback,
2010- .context= context,
2011- .number_of_callback= number_of_callbacks
2012- };
2013+ cb.callback= callback;
2014+ cb.context= context;
2015+ cb.number_of_callback= number_of_callbacks;
2016
2017 ptr->callbacks= &cb;
2018 rc= memcached_mget_by_key(ptr, master_key, master_key_length, keys,
2019@@ -345,6 +347,7 @@
2020 size_t number_of_keys, bool mget_mode)
2021 {
2022 memcached_return_t rc= MEMCACHED_NOTFOUND;
2023+ uint32_t x;
2024
2025 int flush= number_of_keys == 1;
2026
2027@@ -352,10 +355,15 @@
2028 If a server fails we warn about errors and start all over with sending keys
2029 to the server.
2030 */
2031- for (uint32_t x= 0; x < number_of_keys; ++x)
2032+ for (x= 0; x < number_of_keys; ++x)
2033 {
2034 uint32_t server_key;
2035 memcached_server_write_instance_st instance;
2036+ protocol_binary_request_getk request;
2037+ memcached_return_t vk;
2038+ struct libmemcached_io_vector_st vector[3];
2039+
2040+ memset(&request, 0, sizeof(request));
2041
2042 if (is_master_key_set)
2043 {
2044@@ -375,14 +383,12 @@
2045 continue;
2046 }
2047
2048- protocol_binary_request_getk request= {.bytes= {0}};
2049 request.message.header.request.magic= PROTOCOL_BINARY_REQ;
2050 if (mget_mode)
2051 request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETKQ;
2052 else
2053 request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETK;
2054-
2055- memcached_return_t vk;
2056+
2057 vk= memcached_validate_key_length(key_length[x],
2058 ptr->flags.binary_protocol);
2059 unlikely (vk != MEMCACHED_SUCCESS)
2060@@ -399,12 +405,12 @@
2061 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
2062 request.message.header.request.bodylen= htonl((uint32_t)( key_length[x] + ptr->prefix_key_length));
2063
2064- struct libmemcached_io_vector_st vector[]=
2065- {
2066- { .length= sizeof(request.bytes), .buffer= request.bytes },
2067- { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
2068- { .length= key_length[x], .buffer= keys[x] }
2069- };
2070+ vector[0].length= sizeof(request.bytes);
2071+ vector[0].buffer= request.bytes;
2072+ vector[1].length= ptr->prefix_key_length;
2073+ vector[1].buffer= ptr->prefix_key;
2074+ vector[2].length= key_length[x];
2075+ vector[2].buffer= keys[x];
2076
2077 if (memcached_io_writev(instance, vector, 3, flush) == -1)
2078 {
2079@@ -427,12 +433,16 @@
2080 /*
2081 * Send a noop command to flush the buffers
2082 */
2083- protocol_binary_request_noop request= {.bytes= {0}};
2084+ uint32_t x;
2085+ protocol_binary_request_noop request;
2086+
2087+ memset(&request, 0, sizeof(request));
2088+
2089 request.message.header.request.magic= PROTOCOL_BINARY_REQ;
2090 request.message.header.request.opcode= PROTOCOL_BINARY_CMD_NOOP;
2091 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
2092
2093- for (uint32_t x= 0; x < memcached_server_count(ptr); ++x)
2094+ for (x= 0; x < memcached_server_count(ptr); ++x)
2095 {
2096 memcached_server_write_instance_st instance=
2097 memcached_server_instance_fetch(ptr, x);
2098@@ -471,23 +481,30 @@
2099 memcached_return_t rc= MEMCACHED_NOTFOUND;
2100 uint32_t start= 0;
2101 uint64_t randomize_read= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ);
2102+ uint32_t replica;
2103
2104 if (randomize_read)
2105 start= (uint32_t)random() % (uint32_t)(ptr->number_of_replicas + 1);
2106
2107 /* Loop for each replica */
2108- for (uint32_t replica= 0; replica <= ptr->number_of_replicas; ++replica)
2109+ for (replica= 0; replica <= ptr->number_of_replicas; ++replica)
2110 {
2111 bool success= true;
2112-
2113- for (uint32_t x= 0; x < number_of_keys; ++x)
2114+ uint32_t x;
2115+ protocol_binary_request_getk request;
2116+ struct libmemcached_io_vector_st vector[3];
2117+
2118+ memset(&request, 0, sizeof(request));
2119+
2120+ for (x= 0; x < number_of_keys; ++x)
2121 {
2122 memcached_server_write_instance_st instance;
2123+ uint32_t server;
2124
2125 if (hash[x] == memcached_server_count(ptr))
2126 continue; /* Already successfully sent */
2127
2128- uint32_t server= hash[x] + replica;
2129+ server= hash[x] + replica;
2130
2131 /* In case of randomized reads */
2132 if (randomize_read && ((server + start) <= (hash[x] + ptr->number_of_replicas)))
2133@@ -512,16 +529,12 @@
2134 continue;
2135 }
2136 }
2137-
2138- protocol_binary_request_getk request= {
2139- .message.header.request= {
2140- .magic= PROTOCOL_BINARY_REQ,
2141- .opcode= PROTOCOL_BINARY_CMD_GETK,
2142- .keylen= htons((uint16_t)(key_length[x] + ptr->prefix_key_length)),
2143- .datatype= PROTOCOL_BINARY_RAW_BYTES,
2144- .bodylen= htonl((uint32_t)(key_length[x] + ptr->prefix_key_length))
2145- }
2146- };
2147+
2148+ request.message.header.request.magic= PROTOCOL_BINARY_REQ;
2149+ request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETK;
2150+ request.message.header.request.keylen= htons((uint16_t)(key_length[x] + ptr->prefix_key_length));
2151+ request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
2152+ request.message.header.request.bodylen= htonl((uint32_t)(key_length[x] + ptr->prefix_key_length));
2153
2154 /*
2155 * We need to disable buffering to actually know that the request was
2156@@ -533,12 +546,12 @@
2157 * that we might have processed some of the responses etc. For now,
2158 * just make sure we work _correctly_
2159 */
2160- struct libmemcached_io_vector_st vector[]=
2161- {
2162- { .length= sizeof(request.bytes), .buffer= request.bytes },
2163- { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
2164- { .length= key_length[x], .buffer= keys[x] }
2165- };
2166+ vector[0].length= sizeof(request.bytes);
2167+ vector[0].buffer= request.bytes;
2168+ vector[1].length= ptr->prefix_key_length;
2169+ vector[1].buffer= ptr->prefix_key;
2170+ vector[2].length= key_length[x];
2171+ vector[2].buffer= keys[x];
2172
2173 if (memcached_io_writev(instance, vector, 3, true) == -1)
2174 {
2175@@ -578,6 +591,7 @@
2176 {
2177 uint32_t* hash;
2178 bool* dead_servers;
2179+ size_t x;
2180
2181 hash= libmemcached_malloc(ptr, sizeof(uint32_t) * number_of_keys);
2182 dead_servers= libmemcached_calloc(ptr, memcached_server_count(ptr), sizeof(bool));
2183@@ -591,14 +605,14 @@
2184
2185 if (is_master_key_set)
2186 {
2187- for (size_t x= 0; x < number_of_keys; x++)
2188+ for (x= 0; x < number_of_keys; x++)
2189 {
2190 hash[x]= master_server_key;
2191 }
2192 }
2193 else
2194 {
2195- for (size_t x= 0; x < number_of_keys; x++)
2196+ for (x= 0; x < number_of_keys; x++)
2197 {
2198 hash[x]= memcached_generate_hash_with_redistribution(ptr, keys[x], key_length[x]);
2199 }
2200
2201=== modified file 'libmemcached/hash.c'
2202--- libmemcached/hash.c 2010-03-02 22:16:10 +0000
2203+++ libmemcached/hash.c 2011-01-13 03:40:43 +0000
2204@@ -30,11 +30,12 @@
2205 case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA:
2206 case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY:
2207 {
2208+ memcached_continuum_item_st *begin, *end, *left, *right, *middle;
2209 uint32_t num= ptr->continuum_points_counter;
2210 WATCHPOINT_ASSERT(ptr->continuum);
2211
2212 hash= hash;
2213- memcached_continuum_item_st *begin, *end, *left, *right, *middle;
2214+
2215 begin= left= ptr->continuum;
2216 end= right= ptr->continuum + num;
2217
2218@@ -75,7 +76,8 @@
2219 if (ptr->flags.hash_with_prefix_key)
2220 {
2221 size_t temp_length= ptr->prefix_key_length + key_length;
2222- char temp[temp_length];
2223+ char *temp = (char *) malloc(temp_length);
2224+ uint32_t hash;
2225
2226 if (temp_length > MEMCACHED_MAX_KEY -1)
2227 return 0;
2228@@ -83,7 +85,11 @@
2229 strncpy(temp, ptr->prefix_key, ptr->prefix_key_length);
2230 strncpy(temp + ptr->prefix_key_length, key, key_length);
2231
2232- return generate_hash(ptr, temp, temp_length);
2233+ hash = generate_hash(ptr, temp, temp_length);
2234+
2235+ free(temp);
2236+
2237+ return hash;
2238 }
2239 else
2240 {
2241
2242=== modified file 'libmemcached/hosts.c'
2243--- libmemcached/hosts.c 2010-04-05 22:27:54 +0000
2244+++ libmemcached/hosts.c 2011-01-13 03:40:43 +0000
2245@@ -207,6 +207,7 @@
2246 {
2247 char sort_host[MEMCACHED_MAX_HOST_SORT_LENGTH]= "";
2248 size_t sort_host_length;
2249+ uint32_t x;
2250
2251 // Spymemcached ketema key format is: hostname/ip:port-index
2252 // If hostname is not available then: /ip:port-index
2253@@ -223,7 +224,7 @@
2254
2255 if (is_ketama_weighted)
2256 {
2257- for (uint32_t x= 0; x < pointer_per_hash; x++)
2258+ for (x= 0; x < pointer_per_hash; x++)
2259 {
2260 value= ketama_server_hash(sort_host, sort_host_length, x);
2261 ptr->continuum[continuum_index].index= host_index;
2262@@ -246,6 +247,7 @@
2263 {
2264 char sort_host[MEMCACHED_MAX_HOST_SORT_LENGTH]= "";
2265 size_t sort_host_length;
2266+ uint32_t x;
2267
2268 if (list[host_index].port == MEMCACHED_DEFAULT_PORT)
2269 {
2270@@ -267,7 +269,7 @@
2271
2272 if (is_ketama_weighted)
2273 {
2274- for (uint32_t x = 0; x < pointer_per_hash; x++)
2275+ for (x = 0; x < pointer_per_hash; x++)
2276 {
2277 value= ketama_server_hash(sort_host, sort_host_length, x);
2278 ptr->continuum[continuum_index].index= host_index;
2279@@ -305,7 +307,7 @@
2280
2281 memcached_return_t memcached_server_push(memcached_st *ptr, const memcached_server_list_st list)
2282 {
2283- uint32_t count;
2284+ uint32_t count, x;
2285 memcached_server_st *new_host_list;
2286
2287 if (! list)
2288@@ -320,7 +322,7 @@
2289
2290 memcached_server_list_set(ptr, new_host_list);
2291
2292- for (uint32_t x= 0; x < count; x++)
2293+ for (x= 0; x < count; x++)
2294 {
2295 memcached_server_write_instance_st instance;
2296
2297
2298=== modified file 'libmemcached/io.c'
2299--- libmemcached/io.c 2010-09-15 00:44:32 +0000
2300+++ libmemcached/io.c 2011-01-13 03:40:43 +0000
2301@@ -24,12 +24,13 @@
2302 static memcached_return_t io_wait(memcached_server_write_instance_st ptr,
2303 memc_read_or_write read_or_write)
2304 {
2305- struct pollfd fds= {
2306- .fd= ptr->fd,
2307- .events = POLLIN
2308- };
2309- int error;
2310+ struct pollfd fds;
2311+ int error, timeout;
2312+ size_t loop_max;
2313
2314+ fds.fd= ptr->fd;
2315+ fds.events = POLLIN;
2316+
2317 if (read_or_write == MEM_WRITE) /* write */
2318 {
2319 fds.events= POLLOUT;
2320@@ -55,11 +56,11 @@
2321 return MEMCACHED_FAILURE;
2322 }
2323
2324- int timeout= ptr->root->poll_timeout;
2325+ timeout= ptr->root->poll_timeout;
2326 if (ptr->root->flags.no_block == false)
2327 timeout= -1;
2328
2329- size_t loop_max= 5;
2330+ loop_max= 5;
2331 while (--loop_max) // While loop is for ERESTART or EINTR
2332 {
2333 error= poll(&fds, 1, timeout);
2334@@ -164,6 +165,11 @@
2335 */
2336 if (ptr->root->callbacks != NULL && ptr->root->flags.use_udp == false)
2337 {
2338+ uint32_t x;
2339+ char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
2340+ memcached_return_t error;
2341+ memcached_st *root;
2342+
2343 /*
2344 * We might have responses... try to read them out and fire
2345 * callbacks
2346@@ -171,10 +177,8 @@
2347 memcached_callback_st cb= *ptr->root->callbacks;
2348
2349 memcached_set_processing_input((memcached_st *)ptr->root, true);
2350-
2351- char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
2352- memcached_return_t error;
2353- memcached_st *root= (memcached_st *)ptr->root;
2354+
2355+ root= (memcached_st *) ptr->root;
2356 error= memcached_response(ptr, buffer, sizeof(buffer),
2357 &root->result);
2358
2359@@ -182,7 +186,7 @@
2360
2361 if (error == MEMCACHED_SUCCESS)
2362 {
2363- for (unsigned int x= 0; x < cb.number_of_callback; x++)
2364+ for (x= 0; x < cb.number_of_callback; x++)
2365 {
2366 error= (*cb.callback[x])(ptr->root, &root->result, cb.context);
2367 if (error != MEMCACHED_SUCCESS)
2368@@ -281,8 +285,10 @@
2369 }
2370 else if (data_read == SOCKET_ERROR)
2371 {
2372- ptr->cached_errno= get_socket_errno();
2373 memcached_return_t rc= MEMCACHED_ERRNO;
2374+
2375+ ptr->cached_errno= get_socket_errno();
2376+
2377 switch (get_socket_errno())
2378 {
2379 case EWOULDBLOCK:
2380@@ -443,9 +449,10 @@
2381 const struct libmemcached_io_vector_st *vector,
2382 size_t number_of, bool with_flush)
2383 {
2384+ size_t x;
2385 ssize_t total= 0;
2386
2387- for (size_t x= 0; x < number_of; x++, vector++)
2388+ for (x= 0; x < number_of; x++, vector++)
2389 {
2390 ssize_t returnable;
2391
2392@@ -496,8 +503,10 @@
2393 #define MAX_SERVERS_TO_POLL 100
2394 struct pollfd fds[MAX_SERVERS_TO_POLL];
2395 unsigned int host_index= 0;
2396+ uint32_t x, y;
2397+ int err;
2398
2399- for (uint32_t x= 0;
2400+ for (x= 0;
2401 x< memcached_server_count(memc) && host_index < MAX_SERVERS_TO_POLL;
2402 ++x)
2403 {
2404@@ -519,7 +528,7 @@
2405 if (host_index < 2)
2406 {
2407 /* We have 0 or 1 server with pending events.. */
2408- for (uint32_t x= 0; x< memcached_server_count(memc); ++x)
2409+ for (x= 0; x< memcached_server_count(memc); ++x)
2410 {
2411 memcached_server_write_instance_st instance=
2412 memcached_server_instance_fetch(memc, x);
2413@@ -533,7 +542,7 @@
2414 return NULL;
2415 }
2416
2417- int err= poll(fds, host_index, memc->poll_timeout);
2418+ err= poll(fds, host_index, memc->poll_timeout);
2419 switch (err) {
2420 case -1:
2421 memc->cached_errno = get_socket_errno();
2422@@ -541,11 +550,11 @@
2423 case 0:
2424 break;
2425 default:
2426- for (size_t x= 0; x < host_index; ++x)
2427+ for (x= 0; x < host_index; ++x)
2428 {
2429 if (fds[x].revents & POLLIN)
2430 {
2431- for (uint32_t y= 0; y < memcached_server_count(memc); ++y)
2432+ for (y= 0; y < memcached_server_count(memc); ++y)
2433 {
2434 memcached_server_write_instance_st instance=
2435 memcached_server_instance_fetch(memc, y);
2436@@ -563,6 +572,11 @@
2437 static ssize_t io_flush(memcached_server_write_instance_st ptr,
2438 memcached_return_t *error)
2439 {
2440+ ssize_t sent_length;
2441+ size_t return_length;
2442+ char *local_write_ptr;
2443+ size_t write_length;
2444+
2445 /*
2446 ** We might want to purge the input buffer if we haven't consumed
2447 ** any output yet... The test for the limits is the purge is inline
2448@@ -576,10 +590,9 @@
2449 if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_STORED)
2450 return -1;
2451 }
2452- ssize_t sent_length;
2453- size_t return_length;
2454- char *local_write_ptr= ptr->write_buffer;
2455- size_t write_length= ptr->write_buffer_offset;
2456+
2457+ local_write_ptr= ptr->write_buffer;
2458+ write_length= ptr->write_buffer_offset;
2459
2460 *error= MEMCACHED_SUCCESS;
2461
2462@@ -626,6 +639,8 @@
2463 case EAGAIN:
2464 #endif
2465 {
2466+ memcached_return_t rc;
2467+
2468 /*
2469 * We may be blocked on write because the input buffer
2470 * is full. Let's check if we have room in our input
2471@@ -635,8 +650,7 @@
2472 if (repack_input_buffer(ptr) ||
2473 process_input_buffer(ptr))
2474 continue;
2475-
2476- memcached_return_t rc;
2477+
2478 rc= io_wait(ptr, MEM_WRITE);
2479
2480 if (rc == MEMCACHED_SUCCESS || rc == MEMCACHED_TIMEOUT)
2481@@ -786,10 +800,12 @@
2482
2483 memcached_return_t memcached_io_init_udp_header(memcached_server_write_instance_st ptr, uint16_t thread_id)
2484 {
2485+ struct udp_datagram_header_st *header;
2486+
2487 if (thread_id > UDP_REQUEST_ID_MAX_THREAD_ID)
2488 return MEMCACHED_FAILURE;
2489
2490- struct udp_datagram_header_st *header= (struct udp_datagram_header_st *)ptr->write_buffer;
2491+ header= (struct udp_datagram_header_st *)ptr->write_buffer;
2492 header->request_id= htons((uint16_t) (generate_udp_request_thread_id(thread_id)));
2493 header->num_datagrams= htons(1);
2494 header->sequence_number= htons(0);
2495
2496=== modified file 'libmemcached/memcached.c'
2497--- libmemcached/memcached.c 2010-09-13 06:05:34 +0000
2498+++ libmemcached/memcached.c 2011-01-13 03:40:43 +0000
2499@@ -11,41 +11,29 @@
2500
2501 #include "common.h"
2502
2503-static const memcached_st global_copy= {
2504- .state= {
2505- .is_purging= false,
2506- .is_processing_input= false,
2507- .is_time_for_rebuild= false,
2508- },
2509- .flags= {
2510- .auto_eject_hosts= false,
2511- .binary_protocol= false,
2512- .buffer_requests= false,
2513- .cork= false,
2514- .hash_with_prefix_key= false,
2515- .ketama_weighted= false,
2516- .no_block= false,
2517- .no_reply= false,
2518- .randomize_replica_read= false,
2519- .reuse_memory= false,
2520- .support_cas= false,
2521- .tcp_nodelay= false,
2522- .use_cache_lookups= false,
2523- .use_sort_hosts= false,
2524- .use_udp= false,
2525- .verify_key= false,
2526- .tcp_keepalive= false
2527- }
2528-};
2529+const memcached_st *create_global_copy()
2530+{
2531+ memcached_st *global = (memcached_st *) malloc(sizeof(memcached_st));
2532+
2533+ memset(global, 0, sizeof(memcached_st));
2534+
2535+ return global;
2536+}
2537+
2538+static const memcached_st *global_copy = NULL;
2539
2540 static inline bool _memcached_init(memcached_st *self)
2541 {
2542- self->state= global_copy.state;
2543- self->flags= global_copy.flags;
2544+ hashkit_st *hash_ptr;
2545+
2546+ if (global_copy == NULL)
2547+ global_copy = create_global_copy();
2548+
2549+ self->state= global_copy->state;
2550+ self->flags= global_copy->flags;
2551
2552 self->distribution= MEMCACHED_DISTRIBUTION_MODULA;
2553-
2554- hashkit_st *hash_ptr;
2555+
2556 hash_ptr= hashkit_create(&self->hashkit);
2557 if (! hash_ptr)
2558 return false;
2559@@ -199,6 +187,7 @@
2560 {
2561 memcached_return_t rc= MEMCACHED_SUCCESS;
2562 memcached_st *new_clone;
2563+ hashkit_st *hash_ptr;
2564
2565 if (source == NULL)
2566 return memcached_create(clone);
2567@@ -221,8 +210,6 @@
2568 new_clone->retry_timeout= source->retry_timeout;
2569 new_clone->distribution= source->distribution;
2570
2571- hashkit_st *hash_ptr;
2572-
2573 hash_ptr= hashkit_clone(&new_clone->hashkit, &source->hashkit);
2574 if (! hash_ptr)
2575 {
2576
2577=== modified file 'libmemcached/memcached.h'
2578--- libmemcached/memcached.h 2010-09-13 06:05:34 +0000
2579+++ libmemcached/memcached.h 2011-01-13 03:40:43 +0000
2580@@ -111,13 +111,7 @@
2581 memcached_result_st result;
2582 memcached_continuum_item_st *continuum; // Ketama
2583
2584- struct _allocators_st {
2585- memcached_calloc_fn calloc;
2586- memcached_free_fn free;
2587- memcached_malloc_fn malloc;
2588- memcached_realloc_fn realloc;
2589- void *context;
2590- } allocators;
2591+ allocators_st *allocators;
2592
2593 memcached_clone_fn on_clone;
2594 memcached_cleanup_fn on_cleanup;
2595
2596=== modified file 'libmemcached/purge.c'
2597--- libmemcached/purge.c 2010-02-13 02:23:49 +0000
2598+++ libmemcached/purge.c 2011-01-13 03:40:43 +0000
2599@@ -2,7 +2,7 @@
2600
2601 memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
2602 {
2603- uint32_t x;
2604+ uint32_t x, no_msg;
2605 memcached_return_t ret= MEMCACHED_SUCCESS;
2606 memcached_st *root= (memcached_st *)ptr->root;
2607
2608@@ -30,7 +30,7 @@
2609 }
2610 WATCHPOINT_ASSERT(ptr->fd != -1);
2611
2612- uint32_t no_msg= memcached_server_response_count(ptr) - 1;
2613+ no_msg= memcached_server_response_count(ptr) - 1;
2614 if (no_msg > 0)
2615 {
2616 memcached_result_st result;
2617@@ -50,10 +50,10 @@
2618
2619 for (x= 0; x < no_msg; x++)
2620 {
2621+ memcached_return_t rc;
2622+
2623 memcached_result_reset(result_ptr);
2624- memcached_return_t rc= memcached_read_one_response(ptr, buffer,
2625- sizeof (buffer),
2626- result_ptr);
2627+ rc= memcached_read_one_response(ptr, buffer, sizeof (buffer), result_ptr);
2628 /*
2629 * Purge doesn't care for what kind of command results that is received.
2630 * The only kind of errors I care about if is I'm out of sync with the
2631@@ -69,9 +69,11 @@
2632 if (ptr->root->callbacks != NULL)
2633 {
2634 memcached_callback_st cb = *ptr->root->callbacks;
2635+ uint32_t y;
2636+
2637 if (rc == MEMCACHED_SUCCESS)
2638 {
2639- for (uint32_t y= 0; y < cb.number_of_callback; y++)
2640+ for (y= 0; y < cb.number_of_callback; y++)
2641 {
2642 rc = (*cb.callback[y])(ptr->root, result_ptr, cb.context);
2643 if (rc != MEMCACHED_SUCCESS)
2644
2645=== modified file 'libmemcached/quit.c'
2646--- libmemcached/quit.c 2010-04-22 00:49:09 +0000
2647+++ libmemcached/quit.c 2011-01-13 03:40:43 +0000
2648@@ -22,7 +22,10 @@
2649
2650 if (ptr->root->flags.binary_protocol)
2651 {
2652- protocol_binary_request_quit request = {.bytes= {0}};
2653+ protocol_binary_request_quit request;
2654+
2655+ memset(&request, 0, sizeof(request));
2656+
2657 request.message.header.request.magic = PROTOCOL_BINARY_REQ;
2658 request.message.header.request.opcode = PROTOCOL_BINARY_CMD_QUIT;
2659 request.message.header.request.datatype = PROTOCOL_BINARY_RAW_BYTES;
2660
2661=== modified file 'libmemcached/response.c'
2662--- libmemcached/response.c 2010-07-16 03:54:57 +0000
2663+++ libmemcached/response.c 2011-01-13 03:40:43 +0000
2664@@ -22,6 +22,8 @@
2665 char *buffer, size_t buffer_length,
2666 memcached_result_st *result)
2667 {
2668+ memcached_return_t rc;
2669+
2670 memcached_server_response_decrement(ptr);
2671
2672 if (result == NULL)
2673@@ -29,8 +31,7 @@
2674 memcached_st *root= (memcached_st *)ptr->root;
2675 result = &root->result;
2676 }
2677-
2678- memcached_return_t rc;
2679+
2680 if (ptr->root->flags.binary_protocol)
2681 rc= binary_read_one_response(ptr, buffer, buffer_length, result);
2682 else
2683@@ -341,6 +342,7 @@
2684 {
2685 memcached_return_t rc;
2686 protocol_binary_response_header header;
2687+ uint32_t bodylen;
2688
2689 if ((rc= memcached_safe_read(ptr, &header.bytes, sizeof(header.bytes))) != MEMCACHED_SUCCESS)
2690 {
2691@@ -360,7 +362,7 @@
2692 header.response.status= ntohs(header.response.status);
2693 header.response.bodylen= ntohl(header.response.bodylen);
2694 header.response.cas= ntohll(header.response.cas);
2695- uint32_t bodylen= header.response.bodylen;
2696+ bodylen= header.response.bodylen;
2697
2698 if (header.response.status == PROTOCOL_BINARY_RESPONSE_SUCCESS ||
2699 header.response.status == PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE)
2700@@ -376,6 +378,7 @@
2701 /* FALLTHROUGH */
2702 case PROTOCOL_BINARY_CMD_GETK:
2703 {
2704+ char *vptr;
2705 uint16_t keylen= header.response.keylen;
2706 memcached_result_reset(result);
2707 result->item_cas= header.response.cas;
2708@@ -401,7 +404,7 @@
2709 bodylen) != MEMCACHED_SUCCESS)
2710 return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
2711
2712- char *vptr= memcached_string_value_mutable(&result->value);
2713+ vptr= memcached_string_value_mutable(&result->value);
2714 if ((rc= memcached_safe_read(ptr, vptr, bodylen)) != MEMCACHED_SUCCESS)
2715 {
2716 WATCHPOINT_ERROR(rc);
2717@@ -414,11 +417,13 @@
2718 case PROTOCOL_BINARY_CMD_INCREMENT:
2719 case PROTOCOL_BINARY_CMD_DECREMENT:
2720 {
2721+ uint64_t val;
2722+
2723 if (bodylen != sizeof(uint64_t) || buffer_length != sizeof(uint64_t))
2724 return MEMCACHED_PROTOCOL_ERROR;
2725
2726 WATCHPOINT_ASSERT(bodylen == buffer_length);
2727- uint64_t val;
2728+
2729 if ((rc= memcached_safe_read(ptr, &val, sizeof(val))) != MEMCACHED_SUCCESS)
2730 {
2731 WATCHPOINT_ERROR(rc);
2732@@ -490,6 +495,8 @@
2733 case PROTOCOL_BINARY_CMD_SASL_AUTH:
2734 case PROTOCOL_BINARY_CMD_SASL_STEP:
2735 {
2736+ char * vptr;
2737+
2738 memcached_result_reset(result);
2739 result->item_cas= header.response.cas;
2740
2741@@ -497,7 +504,7 @@
2742 bodylen) != MEMCACHED_SUCCESS)
2743 return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
2744
2745- char *vptr= memcached_string_value_mutable(&result->value);
2746+ vptr= memcached_string_value_mutable(&result->value);
2747 if ((rc= memcached_safe_read(ptr, vptr, bodylen)) != MEMCACHED_SUCCESS)
2748 {
2749 WATCHPOINT_ERROR(rc);
2750
2751=== modified file 'libmemcached/sasl.c'
2752--- libmemcached/sasl.c 2010-09-13 12:26:17 +0000
2753+++ libmemcached/sasl.c 2011-01-13 03:40:43 +0000
2754@@ -11,6 +11,8 @@
2755 */
2756 #include "common.h"
2757
2758+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
2759+
2760 void memcached_set_sasl_callbacks(memcached_st *ptr,
2761 const sasl_callback_t *callbacks)
2762 {
2763@@ -373,3 +375,5 @@
2764
2765 return MEMCACHED_SUCCESS;
2766 }
2767+
2768+#endif
2769
2770=== modified file 'libmemcached/server.c'
2771--- libmemcached/server.c 2010-07-16 02:33:19 +0000
2772+++ libmemcached/server.c 2011-01-13 03:40:43 +0000
2773@@ -153,12 +153,14 @@
2774 void *context,
2775 uint32_t number_of_callbacks)
2776 {
2777- for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
2778+ uint32_t x, y;
2779+
2780+ for (x= 0; x < memcached_server_count(ptr); x++)
2781 {
2782 memcached_server_instance_st instance=
2783 memcached_server_instance_by_position(ptr, x);
2784
2785- for (uint32_t y= 0; y < number_of_callbacks; y++)
2786+ for (y= 0; y < number_of_callbacks; y++)
2787 {
2788 unsigned int iferror;
2789
2790@@ -176,7 +178,9 @@
2791 memcached_server_execute_fn callback,
2792 void *context)
2793 {
2794- for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
2795+ uint32_t x;
2796+
2797+ for (x= 0; x < memcached_server_count(ptr); x++)
2798 {
2799 memcached_server_write_instance_st instance=
2800 memcached_server_instance_fetch(ptr, x);
2801@@ -236,12 +240,15 @@
2802
2803 void memcached_server_list_free(memcached_server_list_st self)
2804 {
2805+ const memcached_st *root;
2806+ uint32_t x;
2807+
2808 if (self == NULL)
2809 return;
2810
2811- const memcached_st *root= self->root;
2812+ root= self->root;
2813
2814- for (uint32_t x= 0; x < memcached_server_list_count(self); x++)
2815+ for (x= 0; x < memcached_server_list_count(self); x++)
2816 {
2817 if (self[x].address_info)
2818 {
2819
2820=== modified file 'libmemcached/stats.c'
2821--- libmemcached/stats.c 2010-09-13 12:26:17 +0000
2822+++ libmemcached/stats.c 2011-01-13 03:40:43 +0000
2823@@ -242,13 +242,18 @@
2824 memcached_return_t rc;
2825
2826 char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
2827- protocol_binary_request_stats request= {.bytes= {0}};
2828+ protocol_binary_request_stats request;
2829+
2830+ memset(&request, 0, sizeof(request));
2831+
2832 request.message.header.request.magic= PROTOCOL_BINARY_REQ;
2833 request.message.header.request.opcode= PROTOCOL_BINARY_CMD_STAT;
2834 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
2835
2836 if (args != NULL)
2837 {
2838+ struct libmemcached_io_vector_st vector[2];
2839+
2840 size_t len= strlen(args);
2841
2842 rc= memcached_validate_key_length(len, true);
2843@@ -258,11 +263,10 @@
2844 request.message.header.request.keylen= htons((uint16_t)len);
2845 request.message.header.request.bodylen= htonl((uint32_t) len);
2846
2847- struct libmemcached_io_vector_st vector[]=
2848- {
2849- { .length= sizeof(request.bytes), .buffer= request.bytes },
2850- { .length= len, .buffer= args }
2851- };
2852+ vector[0].length= sizeof(request.bytes);
2853+ vector[0].buffer= request.bytes;
2854+ vector[1].length= len;
2855+ vector[1].buffer= args;
2856
2857 if (memcached_vdo(instance, vector, 2, true) != MEMCACHED_SUCCESS)
2858 {
2859@@ -397,6 +401,7 @@
2860 {
2861 memcached_return_t rc;
2862 memcached_stat_st *stats;
2863+ uint32_t x;
2864
2865 unlikely (ptr->flags.use_udp)
2866 {
2867@@ -413,7 +418,7 @@
2868 }
2869
2870 rc= MEMCACHED_SUCCESS;
2871- for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
2872+ for (x= 0; x < memcached_server_count(ptr); x++)
2873 {
2874 memcached_return_t temp_return;
2875 memcached_server_write_instance_st instance;
2876@@ -544,9 +549,13 @@
2877
2878 memcached_return_t memcached_stat_execute(memcached_st *memc, const char *args, memcached_stat_fn func, void *context)
2879 {
2880+ struct local_context check;
2881+
2882 memcached_version(memc);
2883
2884- struct local_context check= { .func= func, .context= context, .args= args };
2885+ check.func= func;
2886+ check.context= context;
2887+ check.args= args;
2888
2889 return memcached_server_execute(memc, call_stat_fn, (void *)&check);
2890 }
2891
2892=== modified file 'libmemcached/storage.c'
2893--- libmemcached/storage.c 2010-09-13 12:26:17 +0000
2894+++ libmemcached/storage.c 2011-01-13 03:40:43 +0000
2895@@ -105,12 +105,13 @@
2896 if (cas)
2897 {
2898 write_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
2899- "%s %.*s%.*s %u %llu %zu %llu%s\r\n",
2900+ "%s %.*s%.*s %u %llu %lu %llu%s\r\n",
2901 storage_op_string(verb),
2902 (int)ptr->prefix_key_length,
2903 ptr->prefix_key,
2904 (int)key_length, key, flags,
2905- (unsigned long long)expiration, value_length,
2906+ (unsigned long long)expiration,
2907+ (unsigned long)value_length,
2908 (unsigned long long)cas,
2909 (ptr->flags.no_reply) ? " noreply" : "");
2910 }
2911@@ -134,9 +135,10 @@
2912
2913 write_length= (size_t)(buffer_ptr - buffer);
2914 write_length+= (size_t) snprintf(buffer_ptr, MEMCACHED_DEFAULT_COMMAND_SIZE,
2915- "%u %llu %zu%s\r\n",
2916+ "%u %llu %lu%s\r\n",
2917 flags,
2918- (unsigned long long)expiration, value_length,
2919+ (unsigned long long)expiration,
2920+ (unsigned long)value_length,
2921 ptr->flags.no_reply ? " noreply" : "");
2922 }
2923
2924@@ -155,12 +157,14 @@
2925 }
2926 else
2927 {
2928- struct libmemcached_io_vector_st vector[]=
2929- {
2930- { .length= write_length, .buffer= buffer },
2931- { .length= value_length, .buffer= value },
2932- { .length= 2, .buffer= "\r\n" }
2933- };
2934+ struct libmemcached_io_vector_st vector[3];
2935+
2936+ vector[0].length= write_length;
2937+ vector[0].buffer= buffer;
2938+ vector[1].length= value_length;
2939+ vector[1].buffer= value;
2940+ vector[2].length= 2;
2941+ vector[2].buffer= "\r\n";
2942
2943 if (ptr->flags.buffer_requests && verb == SET_OP)
2944 {
2945@@ -452,11 +456,15 @@
2946 memcached_storage_action_t verb)
2947 {
2948 bool flush;
2949- protocol_binary_request_set request= {.bytes= {0}};
2950+ protocol_binary_request_set request;
2951 size_t send_length= sizeof(request.bytes);
2952-
2953+ memcached_return_t rc;
2954+ struct libmemcached_io_vector_st vector[4];
2955+
2956 bool noreply= server->root->flags.no_reply;
2957
2958+ memset(&request, 0, sizeof(request));
2959+
2960 request.message.header.request.magic= PROTOCOL_BINARY_REQ;
2961 request.message.header.request.opcode= get_com_code(verb, noreply);
2962 request.message.header.request.keylen= htons((uint16_t)(key_length + ptr->prefix_key_length));
2963@@ -492,16 +500,17 @@
2964 }
2965 }
2966
2967- struct libmemcached_io_vector_st vector[]=
2968- {
2969- { .length= send_length, .buffer= request.bytes },
2970- { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
2971- { .length= key_length, .buffer= key },
2972- { .length= value_length, .buffer= value }
2973- };
2974+
2975+ vector[0].length= send_length;
2976+ vector[0].buffer= request.bytes;
2977+ vector[1].length= ptr->prefix_key_length;
2978+ vector[1].buffer= ptr->prefix_key;
2979+ vector[2].length= key_length;
2980+ vector[2].buffer= key;
2981+ vector[3].length= value_length;
2982+ vector[3].buffer= value;
2983
2984- /* write the header */
2985- memcached_return_t rc;
2986+ /* write the header */
2987 if ((rc= memcached_vdo(server, vector, 4, flush)) != MEMCACHED_SUCCESS)
2988 {
2989 memcached_io_reset(server);
2990@@ -510,10 +519,12 @@
2991
2992 if (verb == SET_OP && ptr->number_of_replicas > 0)
2993 {
2994+ uint32_t x;
2995+
2996 request.message.header.request.opcode= PROTOCOL_BINARY_CMD_SETQ;
2997 WATCHPOINT_STRING("replicating");
2998
2999- for (uint32_t x= 0; x < ptr->number_of_replicas; x++)
3000+ for (x= 0; x < ptr->number_of_replicas; x++)
3001 {
3002 memcached_server_write_instance_st instance;
3003
3004
3005=== modified file 'libmemcached/types.h'
3006--- libmemcached/types.h 2010-07-16 02:33:19 +0000
3007+++ libmemcached/types.h 2011-01-13 03:40:43 +0000
3008@@ -44,6 +44,13 @@
3009 typedef void *(*memcached_realloc_fn)(const memcached_st *ptr, void *mem, const size_t size, void *context);
3010 typedef void *(*memcached_calloc_fn)(const memcached_st *ptr, size_t nelem, const size_t elsize, void *context);
3011
3012+typedef struct _allocators_st {
3013+ memcached_calloc_fn calloc;
3014+ memcached_free_fn free;
3015+ memcached_malloc_fn malloc;
3016+ memcached_realloc_fn realloc;
3017+ void *context;
3018+} allocators_st;
3019
3020 typedef memcached_return_t (*memcached_execute_fn)(const memcached_st *ptr, memcached_result_st *result, void *context);
3021 typedef memcached_return_t (*memcached_server_fn)(const memcached_st *ptr, memcached_server_instance_st server, void *context);
3022
3023=== modified file 'libmemcached/verbosity.c'
3024--- libmemcached/verbosity.c 2010-04-04 21:53:03 +0000
3025+++ libmemcached/verbosity.c 2011-01-13 03:40:43 +0000
3026@@ -43,6 +43,7 @@
3027 {
3028 size_t send_length;
3029 memcached_server_fn callbacks[1];
3030+ struct context_st context;
3031
3032 char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
3033
3034@@ -51,7 +52,8 @@
3035 unlikely (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
3036 return MEMCACHED_WRITE_FAILURE;
3037
3038- struct context_st context = { .length= send_length, .buffer= buffer };
3039+ context.length= send_length;
3040+ context.buffer= buffer;
3041
3042 callbacks[0]= _set_verbosity;
3043
3044
3045=== modified file 'libmemcached/version.c'
3046--- libmemcached/version.c 2010-07-16 03:54:57 +0000
3047+++ libmemcached/version.c 2011-01-13 03:40:43 +0000
3048@@ -10,11 +10,13 @@
3049
3050 memcached_return_t memcached_version(memcached_st *ptr)
3051 {
3052+ bool was_blocking;
3053+ memcached_return_t rc;
3054+
3055 if (ptr->flags.use_udp)
3056 return MEMCACHED_NOT_SUPPORTED;
3057
3058- bool was_blocking= ptr->flags.no_block;
3059- memcached_return_t rc;
3060+ was_blocking= ptr->flags.no_block;
3061
3062 ptr->flags.no_block= false;
3063
3064@@ -35,11 +37,12 @@
3065 char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
3066 char *response_ptr;
3067 const char *command= "version\r\n";
3068+ uint32_t x;
3069
3070 send_length= strlen(command);
3071
3072 rc= MEMCACHED_SUCCESS;
3073- for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
3074+ for (x= 0; x < memcached_server_count(ptr); x++)
3075 {
3076 memcached_return_t rrc;
3077 memcached_server_write_instance_st instance=
3078@@ -78,13 +81,17 @@
3079 static inline memcached_return_t memcached_version_binary(memcached_st *ptr)
3080 {
3081 memcached_return_t rc;
3082- protocol_binary_request_version request= { .bytes= {0}};
3083+ uint32_t x;
3084+ protocol_binary_request_version request;
3085+
3086+ memset(&request, 0, sizeof(request));
3087+
3088 request.message.header.request.magic= PROTOCOL_BINARY_REQ;
3089 request.message.header.request.opcode= PROTOCOL_BINARY_CMD_VERSION;
3090 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
3091
3092 rc= MEMCACHED_SUCCESS;
3093- for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
3094+ for (x= 0; x < memcached_server_count(ptr); x++)
3095 {
3096 memcached_return_t rrc;
3097
3098@@ -100,7 +107,7 @@
3099 }
3100 }
3101
3102- for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
3103+ for (x= 0; x < memcached_server_count(ptr); x++)
3104 {
3105 memcached_server_write_instance_st instance=
3106 memcached_server_instance_fetch(ptr, x);
3107
3108=== modified file 'libmemcached/visibility.h'
3109--- libmemcached/visibility.h 2010-01-21 23:45:12 +0000
3110+++ libmemcached/visibility.h 2011-01-13 03:40:43 +0000
3111@@ -35,16 +35,26 @@
3112 # define LIBMEMCACHED_API __global
3113 # define LIBMEMCACHED_LOCAL __hidden
3114 # elif defined(_MSC_VER)
3115-# define LIBMEMCACHED_API extern __declspec(dllexport)
3116-# define LIBMEMCACHED_LOCAL
3117+# if defined(LIBMEMCACHED_STATIC)
3118+# define LIBMEMCACHED_API
3119+# define LIBMEMCACHED_LOCAL
3120+# else
3121+# define LIBMEMCACHED_API extern __declspec(dllexport)
3122+# define LIBMEMCACHED_LOCAL
3123+# endif
3124 # else
3125 # define LIBMEMCACHED_API
3126 # define LIBMEMCACHED_LOCAL
3127 # endif /* defined(HAVE_VISIBILITY) */
3128 #else /* defined(BUILDING_LIBMEMCACHED) */
3129 # if defined(_MSC_VER)
3130-# define LIBMEMCACHED_API extern __declspec(dllimport)
3131-# define LIBMEMCACHED_LOCAL
3132+# if defined(LIBMEMCACHED_STATIC)
3133+# define LIBMEMCACHED_API
3134+# define LIBMEMCACHED_LOCAL
3135+# else
3136+# define LIBMEMCACHED_API extern __declspec(dllimport)
3137+# define LIBMEMCACHED_LOCAL
3138+# endif
3139 # else
3140 # define LIBMEMCACHED_API
3141 # define LIBMEMCACHED_LOCAL
3142
3143=== modified file 'libmemcached/watchpoint.h'
3144--- libmemcached/watchpoint.h 2010-09-13 12:31:19 +0000
3145+++ libmemcached/watchpoint.h 2011-01-13 03:40:43 +0000
3146@@ -58,9 +58,9 @@
3147 #define WATCHPOINT_IFERROR(A) do { if(A != MEMCACHED_SUCCESS)fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout); } while (0)
3148 #define WATCHPOINT_STRING(A) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__,A);fflush(stdout); } while (0)
3149 #define WATCHPOINT_STRING_LENGTH(A,B) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %.*s\n", __FILE__, __LINE__,__func__,(int)B,A);fflush(stdout); } while (0)
3150-#define WATCHPOINT_NUMBER(A) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %zu\n", __FILE__, __LINE__,__func__,(size_t)(A));fflush(stdout); } while (0)
3151-#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)
3152-#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)
3153+#define WATCHPOINT_NUMBER(A) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %lu\n", __FILE__, __LINE__,__func__,(long unsigned int)(A));fflush(stdout); } while (0)
3154+#define WATCHPOINT_LABELED_NUMBER(A,B) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s:%lu\n", __FILE__, __LINE__,__func__,(A),(long unsigned int)(B));fflush(stdout); } while (0)
3155+#define WATCHPOINT_IF_LABELED_NUMBER(A,B,C) do { if(A) {fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s:%lu\n", __FILE__, __LINE__,__func__,(B),(long unsigned int)(C));fflush(stdout);} } while (0)
3156 #define WATCHPOINT_ERRNO(A) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));fflush(stdout); } while (0)
3157 #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)
3158 #define WATCHPOINT_ASSERT(A) do { if (! (A)) {libmemcached_stack_dump();} assert((A)); } while (0)
3159
3160=== modified file 'poll/poll.c'
3161--- poll/poll.c 2010-07-28 18:48:00 +0000
3162+++ poll/poll.c 2011-01-13 03:40:43 +0000
3163@@ -9,19 +9,27 @@
3164 *
3165 */
3166 #include "config.h"
3167-#include <sys/time.h>
3168-#include <strings.h>
3169+
3170+#ifdef WIN32
3171+# include <ws2tcpip.h>
3172+#else
3173+# include <sys/time.h>
3174+# include <strings.h>
3175+#endif
3176
3177 int poll(struct pollfd fds[], nfds_t nfds, int tmo)
3178 {
3179+ int maxfd= 0, ret;
3180+ nfds_t x;
3181+ struct timeval timeout;
3182+ struct timeval *tp;
3183+
3184 fd_set readfds, writefds, errorfds;
3185 FD_ZERO(&readfds);
3186 FD_ZERO(&writefds);
3187- FD_ZERO(&errorfds);
3188-
3189- int maxfd= 0;
3190-
3191- for (nfds_t x= 0; x < nfds; ++x)
3192+ FD_ZERO(&errorfds);
3193+
3194+ for (x= 0; x < nfds; ++x)
3195 {
3196 if (fds[x].events & (POLLIN | POLLOUT))
3197 {
3198@@ -42,21 +50,22 @@
3199 }
3200 }
3201
3202- struct timeval timeout= { .tv_sec = tmo / 1000,
3203- .tv_usec= (tmo % 1000) * 1000 };
3204- struct timeval *tp= &timeout;
3205+ timeout.tv_sec = tmo / 1000;
3206+ timeout.tv_usec= (tmo % 1000) * 1000;
3207+
3208+ tp= &timeout;
3209 if (tmo == -1)
3210 {
3211 tp= NULL;
3212 }
3213- int ret= select(maxfd + 1, &readfds, &writefds, &errorfds, tp);
3214+ ret= select(maxfd + 1, &readfds, &writefds, &errorfds, tp);
3215 if (ret <= 0)
3216 {
3217 return ret;
3218 }
3219
3220 /* Iterate through all of them because I need to clear the revent map */
3221- for (nfds_t x= 0; x < nfds; ++x)
3222+ for (x= 0; x < nfds; ++x)
3223 {
3224 fds[x].revents= 0;
3225 if (FD_ISSET(fds[x].fd, &readfds))
3226
3227=== added file 'win32/common.vsprops'
3228--- win32/common.vsprops 1970-01-01 00:00:00 +0000
3229+++ win32/common.vsprops 2011-01-13 03:40:43 +0000
3230@@ -0,0 +1,25 @@
3231+<?xml version="1.0" encoding="gb2312"?>
3232+<VisualStudioPropertySheet
3233+ ProjectType="Visual C++"
3234+ Version="8.00"
3235+ Name="essential"
3236+ CharacterSet="2"
3237+ >
3238+ <Tool
3239+ Name="VCCLCompilerTool"
3240+ AdditionalIncludeDirectories="..;..\win32;"
3241+ PreprocessorDefinitions="WIN32;_WINDOWS;_USRDLL;LIBMEMCACHED_STATIC"
3242+ MinimalRebuild="true"
3243+ RuntimeLibrary="3"
3244+ WarningLevel="3"
3245+ DebugInformationFormat="4"
3246+ />
3247+ <Tool
3248+ Name="VCLinkerTool"
3249+ AdditionalDependencies="ws2_32.lib libmemcached-win32.lib"
3250+ AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
3251+ GenerateDebugInformation="true"
3252+ TargetMachine="1"
3253+ />
3254+</VisualStudioPropertySheet>
3255+
3256\ No newline at end of file
3257
3258=== added file 'win32/debug.vsprops'
3259--- win32/debug.vsprops 1970-01-01 00:00:00 +0000
3260+++ win32/debug.vsprops 2011-01-13 03:40:43 +0000
3261@@ -0,0 +1,12 @@
3262+<?xml version="1.0" encoding="gb2312"?>
3263+<VisualStudioPropertySheet
3264+ ProjectType="Visual C++"
3265+ Version="8.00"
3266+ Name="essential"
3267+ CharacterSet="2"
3268+ >
3269+ <Tool
3270+ Name="VCCLCompilerTool"
3271+ PreprocessorDefinitions="_DEBUG"
3272+ />
3273+</VisualStudioPropertySheet>
3274\ No newline at end of file
3275
3276=== added file 'win32/getopt.c'
3277--- win32/getopt.c 1970-01-01 00:00:00 +0000
3278+++ win32/getopt.c 2011-01-13 03:40:43 +0000
3279@@ -0,0 +1,1067 @@
3280+/* Getopt for GNU.
3281+ NOTE: getopt is now part of the C library, so if you don't know what
3282+ "Keep this file name-space clean" means, talk to drepper@gnu.org
3283+ before changing it!
3284+
3285+ Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
3286+ Free Software Foundation, Inc.
3287+
3288+ The GNU C Library is free software; you can redistribute it and/or
3289+ modify it under the terms of the GNU Library General Public License as
3290+ published by the Free Software Foundation; either version 2 of the
3291+ License, or (at your option) any later version.
3292+
3293+ The GNU C Library is distributed in the hope that it will be useful,
3294+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3295+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3296+ Library General Public License for more details.
3297+
3298+ You should have received a copy of the GNU Library General Public
3299+ License along with the GNU C Library; see the file COPYING.LIB. If not,
3300+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3301+ Boston, MA 02111-1307, USA. */
3302+
3303
3304+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
3305+ Ditto for AIX 3.2 and <stdlib.h>. */
3306+#ifndef _NO_PROTO
3307+# define _NO_PROTO
3308+#endif
3309+
3310+#ifdef HAVE_CONFIG_H
3311+# include <config.h>
3312+#endif
3313+
3314+#if !defined __STDC__ || !__STDC__
3315+/* This is a separate conditional since some stdc systems
3316+ reject `defined (const)'. */
3317+# ifndef const
3318+# define const
3319+# endif
3320+#endif
3321+
3322+#include <stdio.h>
3323+
3324+/* Comment out all this code if we are using the GNU C Library, and are not
3325+ actually compiling the library itself. This code is part of the GNU C
3326+ Library, but also included in many other GNU distributions. Compiling
3327+ and linking in this code is a waste when using the GNU C library
3328+ (especially if it is a shared library). Rather than having every GNU
3329+ program understand `configure --with-gnu-libc' and omit the object files,
3330+ it is simpler to just do this in the source for each such file. */
3331+
3332+#define GETOPT_INTERFACE_VERSION 2
3333+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
3334+# include <gnu-versions.h>
3335+# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
3336+# define ELIDE_CODE
3337+# endif
3338+#endif
3339+
3340+#ifndef ELIDE_CODE
3341+
3342+
3343+/* This needs to come after some library #include
3344+ to get __GNU_LIBRARY__ defined. */
3345+#ifdef __GNU_LIBRARY__
3346+/* Don't include stdlib.h for non-GNU C libraries because some of them
3347+ contain conflicting prototypes for getopt. */
3348+# include <stdlib.h>
3349+# include <unistd.h>
3350+#endif /* GNU C library. */
3351+
3352+#ifdef VMS
3353+# include <unixlib.h>
3354+# if HAVE_STRING_H - 0
3355+# include <string.h>
3356+# endif
3357+#endif
3358+
3359+#ifdef WIN32
3360+# define HAVE_STRING_H 1
3361+#endif
3362+
3363+#ifndef _
3364+/* This is for other GNU distributions with internationalized messages.
3365+ When compiling libc, the _ macro is predefined. */
3366+# ifdef HAVE_LIBINTL_H
3367+# include <libintl.h>
3368+# define _(msgid) gettext (msgid)
3369+# else
3370+# define _(msgid) (msgid)
3371+# endif
3372+#endif
3373+
3374+/* This version of `getopt' appears to the caller like standard Unix `getopt'
3375+ but it behaves differently for the user, since it allows the user
3376+ to intersperse the options with the other arguments.
3377+
3378+ As `getopt' works, it permutes the elements of ARGV so that,
3379+ when it is done, all the options precede everything else. Thus
3380+ all application programs are extended to handle flexible argument order.
3381+
3382+ Setting the environment variable POSIXLY_CORRECT disables permutation.
3383+ Then the behavior is completely standard.
3384+
3385+ GNU application programs can use a third alternative mode in which
3386+ they can distinguish the relative order of options and other arguments. */
3387+
3388+#include "getopt.h"
3389+
3390+/* For communication from `getopt' to the caller.
3391+ When `getopt' finds an option that takes an argument,
3392+ the argument value is returned here.
3393+ Also, when `ordering' is RETURN_IN_ORDER,
3394+ each non-option ARGV-element is returned here. */
3395+
3396+char *optarg;
3397+
3398+/* Index in ARGV of the next element to be scanned.
3399+ This is used for communication to and from the caller
3400+ and for communication between successive calls to `getopt'.
3401+
3402+ On entry to `getopt', zero means this is the first call; initialize.
3403+
3404+ When `getopt' returns -1, this is the index of the first of the
3405+ non-option elements that the caller should itself scan.
3406+
3407+ Otherwise, `optind' communicates from one call to the next
3408+ how much of ARGV has been scanned so far. */
3409+
3410+/* 1003.2 says this must be 1 before any call. */
3411+int optind = 1;
3412+
3413+/* Formerly, initialization of getopt depended on optind==0, which
3414+ causes problems with re-calling getopt as programs generally don't
3415+ know that. */
3416+
3417+int __getopt_initialized;
3418+
3419+/* The next char to be scanned in the option-element
3420+ in which the last option character we returned was found.
3421+ This allows us to pick up the scan where we left off.
3422+
3423+ If this is zero, or a null string, it means resume the scan
3424+ by advancing to the next ARGV-element. */
3425+
3426+static char *nextchar;
3427+
3428+/* Callers store zero here to inhibit the error message
3429+ for unrecognized options. */
3430+
3431+int opterr = 1;
3432+
3433+/* Set to an option character which was unrecognized.
3434+ This must be initialized on some systems to avoid linking in the
3435+ system's own getopt implementation. */
3436+
3437+int optopt = '?';
3438+
3439+/* Describe how to deal with options that follow non-option ARGV-elements.
3440+
3441+ If the caller did not specify anything,
3442+ the default is REQUIRE_ORDER if the environment variable
3443+ POSIXLY_CORRECT is defined, PERMUTE otherwise.
3444+
3445+ REQUIRE_ORDER means don't recognize them as options;
3446+ stop option processing when the first non-option is seen.
3447+ This is what Unix does.
3448+ This mode of operation is selected by either setting the environment
3449+ variable POSIXLY_CORRECT, or using `+' as the first character
3450+ of the list of option characters.
3451+
3452+ PERMUTE is the default. We permute the contents of ARGV as we scan,
3453+ so that eventually all the non-options are at the end. This allows options
3454+ to be given in any order, even with programs that were not written to
3455+ expect this.
3456+
3457+ RETURN_IN_ORDER is an option available to programs that were written
3458+ to expect options and other ARGV-elements in any order and that care about
3459+ the ordering of the two. We describe each non-option ARGV-element
3460+ as if it were the argument of an option with character code 1.
3461+ Using `-' as the first character of the list of option characters
3462+ selects this mode of operation.
3463+
3464+ The special argument `--' forces an end of option-scanning regardless
3465+ of the value of `ordering'. In the case of RETURN_IN_ORDER, only
3466+ `--' can cause `getopt' to return -1 with `optind' != ARGC. */
3467+
3468+static enum
3469+{
3470+ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
3471+} ordering;
3472+
3473+/* Value of POSIXLY_CORRECT environment variable. */
3474+static char *posixly_correct;
3475+
3476
3477+#ifdef __GNU_LIBRARY__
3478+/* We want to avoid inclusion of string.h with non-GNU libraries
3479+ because there are many ways it can cause trouble.
3480+ On some systems, it contains special magic macros that don't work
3481+ in GCC. */
3482+# include <string.h>
3483+# define my_index strchr
3484+#else
3485+
3486+# if HAVE_STRING_H
3487+# include <string.h>
3488+# else
3489+# include <strings.h>
3490+# endif
3491+
3492+/* Avoid depending on library functions or files
3493+ whose names are inconsistent. */
3494+
3495+#ifndef getenv
3496+extern char *getenv ();
3497+#endif
3498+
3499+static char *
3500+my_index (str, chr)
3501+ const char *str;
3502+ int chr;
3503+{
3504+ while (*str)
3505+ {
3506+ if (*str == chr)
3507+ return (char *) str;
3508+ str++;
3509+ }
3510+ return 0;
3511+}
3512+
3513+/* If using GCC, we can safely declare strlen this way.
3514+ If not using GCC, it is ok not to declare it. */
3515+#ifdef __GNUC__
3516+/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
3517+ That was relevant to code that was here before. */
3518+# if (!defined __STDC__ || !__STDC__) && !defined strlen
3519+/* gcc with -traditional declares the built-in strlen to return int,
3520+ and has done so at least since version 2.4.5. -- rms. */
3521+extern int strlen (const char *);
3522+# endif /* not __STDC__ */
3523+#endif /* __GNUC__ */
3524+
3525+#endif /* not __GNU_LIBRARY__ */
3526+
3527
3528+/* Handle permutation of arguments. */
3529+
3530+/* Describe the part of ARGV that contains non-options that have
3531+ been skipped. `first_nonopt' is the index in ARGV of the first of them;
3532+ `last_nonopt' is the index after the last of them. */
3533+
3534+static int first_nonopt;
3535+static int last_nonopt;
3536+
3537+#ifdef _LIBC
3538+/* Bash 2.0 gives us an environment variable containing flags
3539+ indicating ARGV elements that should not be considered arguments. */
3540+
3541+/* Defined in getopt_init.c */
3542+extern char *__getopt_nonoption_flags;
3543+
3544+static int nonoption_flags_max_len;
3545+static int nonoption_flags_len;
3546+
3547+static int original_argc;
3548+static char *const *original_argv;
3549+
3550+/* Make sure the environment variable bash 2.0 puts in the environment
3551+ is valid for the getopt call we must make sure that the ARGV passed
3552+ to getopt is that one passed to the process. */
3553+static void
3554+__attribute__ ((unused))
3555+store_args_and_env (int argc, char *const *argv)
3556+{
3557+ /* XXX This is no good solution. We should rather copy the args so
3558+ that we can compare them later. But we must not use malloc(3). */
3559+ original_argc = argc;
3560+ original_argv = argv;
3561+}
3562+# ifdef text_set_element
3563+text_set_element (__libc_subinit, store_args_and_env);
3564+# endif /* text_set_element */
3565+
3566+# define SWAP_FLAGS(ch1, ch2) \
3567+ if (nonoption_flags_len > 0) \
3568+ { \
3569+ char __tmp = __getopt_nonoption_flags[ch1]; \
3570+ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
3571+ __getopt_nonoption_flags[ch2] = __tmp; \
3572+ }
3573+#else /* !_LIBC */
3574+# define SWAP_FLAGS(ch1, ch2)
3575+#endif /* _LIBC */
3576+
3577+/* Exchange two adjacent subsequences of ARGV.
3578+ One subsequence is elements [first_nonopt,last_nonopt)
3579+ which contains all the non-options that have been skipped so far.
3580+ The other is elements [last_nonopt,optind), which contains all
3581+ the options processed since those non-options were skipped.
3582+
3583+ `first_nonopt' and `last_nonopt' are relocated so that they describe
3584+ the new indices of the non-options in ARGV after they are moved. */
3585+
3586+#if defined __STDC__ && __STDC__
3587+static void exchange (char **);
3588+#endif
3589+
3590+static void
3591+exchange (argv)
3592+ char **argv;
3593+{
3594+ int bottom = first_nonopt;
3595+ int middle = last_nonopt;
3596+ int top = optind;
3597+ char *tem;
3598+
3599+ /* Exchange the shorter segment with the far end of the longer segment.
3600+ That puts the shorter segment into the right place.
3601+ It leaves the longer segment in the right place overall,
3602+ but it consists of two parts that need to be swapped next. */
3603+
3604+#ifdef _LIBC
3605+ /* First make sure the handling of the `__getopt_nonoption_flags'
3606+ string can work normally. Our top argument must be in the range
3607+ of the string. */
3608+ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
3609+ {
3610+ /* We must extend the array. The user plays games with us and
3611+ presents new arguments. */
3612+ char *new_str = malloc (top + 1);
3613+ if (new_str == NULL)
3614+ nonoption_flags_len = nonoption_flags_max_len = 0;
3615+ else
3616+ {
3617+ memset (__mempcpy (new_str, __getopt_nonoption_flags,
3618+ nonoption_flags_max_len),
3619+ '\0', top + 1 - nonoption_flags_max_len);
3620+ nonoption_flags_max_len = top + 1;
3621+ __getopt_nonoption_flags = new_str;
3622+ }
3623+ }
3624+#endif
3625+
3626+ while (top > middle && middle > bottom)
3627+ {
3628+ if (top - middle > middle - bottom)
3629+ {
3630+ /* Bottom segment is the short one. */
3631+ int len = middle - bottom;
3632+ register int i;
3633+
3634+ /* Swap it with the top part of the top segment. */
3635+ for (i = 0; i < len; i++)
3636+ {
3637+ tem = argv[bottom + i];
3638+ argv[bottom + i] = argv[top - (middle - bottom) + i];
3639+ argv[top - (middle - bottom) + i] = tem;
3640+ SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
3641+ }
3642+ /* Exclude the moved bottom segment from further swapping. */
3643+ top -= len;
3644+ }
3645+ else
3646+ {
3647+ /* Top segment is the short one. */
3648+ int len = top - middle;
3649+ register int i;
3650+
3651+ /* Swap it with the bottom part of the bottom segment. */
3652+ for (i = 0; i < len; i++)
3653+ {
3654+ tem = argv[bottom + i];
3655+ argv[bottom + i] = argv[middle + i];
3656+ argv[middle + i] = tem;
3657+ SWAP_FLAGS (bottom + i, middle + i);
3658+ }
3659+ /* Exclude the moved top segment from further swapping. */
3660+ bottom += len;
3661+ }
3662+ }
3663+
3664+ /* Update records for the slots the non-options now occupy. */
3665+
3666+ first_nonopt += (optind - last_nonopt);
3667+ last_nonopt = optind;
3668+}
3669+
3670+/* Initialize the internal data when the first call is made. */
3671+
3672+#if defined __STDC__ && __STDC__
3673+static const char *_getopt_initialize (int, char *const *, const char *);
3674+#endif
3675+static const char *
3676+_getopt_initialize (argc, argv, optstring)
3677+ int argc;
3678+ char *const *argv;
3679+ const char *optstring;
3680+{
3681+ /* Start processing options with ARGV-element 1 (since ARGV-element 0
3682+ is the program name); the sequence of previously skipped
3683+ non-option ARGV-elements is empty. */
3684+
3685+ first_nonopt = last_nonopt = optind;
3686+
3687+ nextchar = NULL;
3688+
3689+ posixly_correct = getenv ("POSIXLY_CORRECT");
3690+
3691+ /* Determine how to handle the ordering of options and nonoptions. */
3692+
3693+ if (optstring[0] == '-')
3694+ {
3695+ ordering = RETURN_IN_ORDER;
3696+ ++optstring;
3697+ }
3698+ else if (optstring[0] == '+')
3699+ {
3700+ ordering = REQUIRE_ORDER;
3701+ ++optstring;
3702+ }
3703+ else if (posixly_correct != NULL)
3704+ ordering = REQUIRE_ORDER;
3705+ else
3706+ ordering = PERMUTE;
3707+
3708+#ifdef _LIBC
3709+ if (posixly_correct == NULL
3710+ && argc == original_argc && argv == original_argv)
3711+ {
3712+ if (nonoption_flags_max_len == 0)
3713+ {
3714+ if (__getopt_nonoption_flags == NULL
3715+ || __getopt_nonoption_flags[0] == '\0')
3716+ nonoption_flags_max_len = -1;
3717+ else
3718+ {
3719+ const char *orig_str = __getopt_nonoption_flags;
3720+ int len = nonoption_flags_max_len = strlen (orig_str);
3721+ if (nonoption_flags_max_len < argc)
3722+ nonoption_flags_max_len = argc;
3723+ __getopt_nonoption_flags =
3724+ (char *) malloc (nonoption_flags_max_len);
3725+ if (__getopt_nonoption_flags == NULL)
3726+ nonoption_flags_max_len = -1;
3727+ else
3728+ memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
3729+ '\0', nonoption_flags_max_len - len);
3730+ }
3731+ }
3732+ nonoption_flags_len = nonoption_flags_max_len;
3733+ }
3734+ else
3735+ nonoption_flags_len = 0;
3736+#endif
3737+
3738+ return optstring;
3739+}
3740+
3741
3742+/* Scan elements of ARGV (whose length is ARGC) for option characters
3743+ given in OPTSTRING.
3744+
3745+ If an element of ARGV starts with '-', and is not exactly "-" or "--",
3746+ then it is an option element. The characters of this element
3747+ (aside from the initial '-') are option characters. If `getopt'
3748+ is called repeatedly, it returns successively each of the option characters
3749+ from each of the option elements.
3750+
3751+ If `getopt' finds another option character, it returns that character,
3752+ updating `optind' and `nextchar' so that the next call to `getopt' can
3753+ resume the scan with the following option character or ARGV-element.
3754+
3755+ If there are no more option characters, `getopt' returns -1.
3756+ Then `optind' is the index in ARGV of the first ARGV-element
3757+ that is not an option. (The ARGV-elements have been permuted
3758+ so that those that are not options now come last.)
3759+
3760+ OPTSTRING is a string containing the legitimate option characters.
3761+ If an option character is seen that is not listed in OPTSTRING,
3762+ return '?' after printing an error message. If you set `opterr' to
3763+ zero, the error message is suppressed but we still return '?'.
3764+
3765+ If a char in OPTSTRING is followed by a colon, that means it wants an arg,
3766+ so the following text in the same ARGV-element, or the text of the following
3767+ ARGV-element, is returned in `optarg'. Two colons mean an option that
3768+ wants an optional arg; if there is text in the current ARGV-element,
3769+ it is returned in `optarg', otherwise `optarg' is set to zero.
3770+
3771+ If OPTSTRING starts with `-' or `+', it requests different methods of
3772+ handling the non-option ARGV-elements.
3773+ See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
3774+
3775+ Long-named options begin with `--' instead of `-'.
3776+ Their names may be abbreviated as long as the abbreviation is unique
3777+ or is an exact match for some defined option. If they have an
3778+ argument, it follows the option name in the same ARGV-element, separated
3779+ from the option name by a `=', or else the in next ARGV-element.
3780+ When `getopt' finds a long-named option, it returns 0 if that option's
3781+ `flag' field is nonzero, the value of the option's `val' field
3782+ if the `flag' field is zero.
3783+
3784+ The elements of ARGV aren't really const, because we permute them.
3785+ But we pretend they're const in the prototype to be compatible
3786+ with other systems.
3787+
3788+ LONGOPTS is a vector of `struct option' terminated by an
3789+ element containing a name which is zero.
3790+
3791+ LONGIND returns the index in LONGOPT of the long-named option found.
3792+ It is only valid when a long-named option has been found by the most
3793+ recent call.
3794+
3795+ If LONG_ONLY is nonzero, '-' as well as '--' can introduce
3796+ long-named options. */
3797+
3798+int
3799+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
3800+ int argc;
3801+ char *const *argv;
3802+ const char *optstring;
3803+ const struct option *longopts;
3804+ int *longind;
3805+ int long_only;
3806+{
3807+ int print_errors = opterr;
3808+ if (optstring[0] == ':')
3809+ print_errors = 0;
3810+
3811+ optarg = NULL;
3812+
3813+ if (optind == 0 || !__getopt_initialized)
3814+ {
3815+ if (optind == 0)
3816+ optind = 1; /* Don't scan ARGV[0], the program name. */
3817+ optstring = _getopt_initialize (argc, argv, optstring);
3818+ __getopt_initialized = 1;
3819+ }
3820+
3821+ /* Test whether ARGV[optind] points to a non-option argument.
3822+ Either it does not have option syntax, or there is an environment flag
3823+ from the shell indicating it is not an option. The later information
3824+ is only used when the used in the GNU libc. */
3825+#ifdef _LIBC
3826+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
3827+ || (optind < nonoption_flags_len \
3828+ && __getopt_nonoption_flags[optind] == '1'))
3829+#else
3830+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
3831+#endif
3832+
3833+ if (nextchar == NULL || *nextchar == '\0')
3834+ {
3835+ /* Advance to the next ARGV-element. */
3836+
3837+ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
3838+ moved back by the user (who may also have changed the arguments). */
3839+ if (last_nonopt > optind)
3840+ last_nonopt = optind;
3841+ if (first_nonopt > optind)
3842+ first_nonopt = optind;
3843+
3844+ if (ordering == PERMUTE)
3845+ {
3846+ /* If we have just processed some options following some non-options,
3847+ exchange them so that the options come first. */
3848+
3849+ if (first_nonopt != last_nonopt && last_nonopt != optind)
3850+ exchange ((char **) argv);
3851+ else if (last_nonopt != optind)
3852+ first_nonopt = optind;
3853+
3854+ /* Skip any additional non-options
3855+ and extend the range of non-options previously skipped. */
3856+
3857+ while (optind < argc && NONOPTION_P)
3858+ optind++;
3859+ last_nonopt = optind;
3860+ }
3861+
3862+ /* The special ARGV-element `--' means premature end of options.
3863+ Skip it like a null option,
3864+ then exchange with previous non-options as if it were an option,
3865+ then skip everything else like a non-option. */
3866+
3867+ if (optind != argc && !strcmp (argv[optind], "--"))
3868+ {
3869+ optind++;
3870+
3871+ if (first_nonopt != last_nonopt && last_nonopt != optind)
3872+ exchange ((char **) argv);
3873+ else if (first_nonopt == last_nonopt)
3874+ first_nonopt = optind;
3875+ last_nonopt = argc;
3876+
3877+ optind = argc;
3878+ }
3879+
3880+ /* If we have done all the ARGV-elements, stop the scan
3881+ and back over any non-options that we skipped and permuted. */
3882+
3883+ if (optind == argc)
3884+ {
3885+ /* Set the next-arg-index to point at the non-options
3886+ that we previously skipped, so the caller will digest them. */
3887+ if (first_nonopt != last_nonopt)
3888+ optind = first_nonopt;
3889+ return -1;
3890+ }
3891+
3892+ /* If we have come to a non-option and did not permute it,
3893+ either stop the scan or describe it to the caller and pass it by. */
3894+
3895+ if (NONOPTION_P)
3896+ {
3897+ if (ordering == REQUIRE_ORDER)
3898+ return -1;
3899+ optarg = argv[optind++];
3900+ return 1;
3901+ }
3902+
3903+ /* We have found another option-ARGV-element.
3904+ Skip the initial punctuation. */
3905+
3906+ nextchar = (argv[optind] + 1
3907+ + (longopts != NULL && argv[optind][1] == '-'));
3908+ }
3909+
3910+ /* Decode the current option-ARGV-element. */
3911+
3912+ /* Check whether the ARGV-element is a long option.
3913+
3914+ If long_only and the ARGV-element has the form "-f", where f is
3915+ a valid short option, don't consider it an abbreviated form of
3916+ a long option that starts with f. Otherwise there would be no
3917+ way to give the -f short option.
3918+
3919+ On the other hand, if there's a long option "fubar" and
3920+ the ARGV-element is "-fu", do consider that an abbreviation of
3921+ the long option, just like "--fu", and not "-f" with arg "u".
3922+
3923+ This distinction seems to be the most useful approach. */
3924+
3925+ if (longopts != NULL
3926+ && (argv[optind][1] == '-'
3927+ || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
3928+ {
3929+ char *nameend;
3930+ const struct option *p;
3931+ const struct option *pfound = NULL;
3932+ int exact = 0;
3933+ int ambig = 0;
3934+ int indfound = -1;
3935+ int option_index;
3936+
3937+ for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
3938+ /* Do nothing. */ ;
3939+
3940+ /* Test all long options for either exact match
3941+ or abbreviated matches. */
3942+ for (p = longopts, option_index = 0; p->name; p++, option_index++)
3943+ if (!strncmp (p->name, nextchar, nameend - nextchar))
3944+ {
3945+ if ((unsigned int) (nameend - nextchar)
3946+ == (unsigned int) strlen (p->name))
3947+ {
3948+ /* Exact match found. */
3949+ pfound = p;
3950+ indfound = option_index;
3951+ exact = 1;
3952+ break;
3953+ }
3954+ else if (pfound == NULL)
3955+ {
3956+ /* First nonexact match found. */
3957+ pfound = p;
3958+ indfound = option_index;
3959+ }
3960+ else
3961+ /* Second or later nonexact match found. */
3962+ ambig = 1;
3963+ }
3964+
3965+ if (ambig && !exact)
3966+ {
3967+ if (print_errors)
3968+ fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
3969+ argv[0], argv[optind]);
3970+ nextchar += strlen (nextchar);
3971+ optind++;
3972+ optopt = 0;
3973+ return '?';
3974+ }
3975+
3976+ if (pfound != NULL)
3977+ {
3978+ option_index = indfound;
3979+ optind++;
3980+ if (*nameend)
3981+ {
3982+ /* Don't test has_arg with >, because some C compilers don't
3983+ allow it to be used on enums. */
3984+ if (pfound->has_arg)
3985+ optarg = nameend + 1;
3986+ else
3987+ {
3988+ if (print_errors)
3989+ {
3990+ if (argv[optind - 1][1] == '-')
3991+ /* --option */
3992+ fprintf (stderr,
3993+ _("%s: option `--%s' doesn't allow an argument\n"),
3994+ argv[0], pfound->name);
3995+ else
3996+ /* +option or -option */
3997+ fprintf (stderr,
3998+ _("%s: option `%c%s' doesn't allow an argument\n"),
3999+ argv[0], argv[optind - 1][0], pfound->name);
4000+ }
4001+
4002+ nextchar += strlen (nextchar);
4003+
4004+ optopt = pfound->val;
4005+ return '?';
4006+ }
4007+ }
4008+ else if (pfound->has_arg == 1)
4009+ {
4010+ if (optind < argc)
4011+ optarg = argv[optind++];
4012+ else
4013+ {
4014+ if (print_errors)
4015+ fprintf (stderr,
4016+ _("%s: option `%s' requires an argument\n"),
4017+ argv[0], argv[optind - 1]);
4018+ nextchar += strlen (nextchar);
4019+ optopt = pfound->val;
4020+ return optstring[0] == ':' ? ':' : '?';
4021+ }
4022+ }
4023+ nextchar += strlen (nextchar);
4024+ if (longind != NULL)
4025+ *longind = option_index;
4026+ if (pfound->flag)
4027+ {
4028+ *(pfound->flag) = pfound->val;
4029+ return 0;
4030+ }
4031+ return pfound->val;
4032+ }
4033+
4034+ /* Can't find it as a long option. If this is not getopt_long_only,
4035+ or the option starts with '--' or is not a valid short
4036+ option, then it's an error.
4037+ Otherwise interpret it as a short option. */
4038+ if (!long_only || argv[optind][1] == '-'
4039+ || my_index (optstring, *nextchar) == NULL)
4040+ {
4041+ if (print_errors)
4042+ {
4043+ if (argv[optind][1] == '-')
4044+ /* --option */
4045+ fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
4046+ argv[0], nextchar);
4047+ else
4048+ /* +option or -option */
4049+ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
4050+ argv[0], argv[optind][0], nextchar);
4051+ }
4052+ nextchar = (char *) "";
4053+ optind++;
4054+ optopt = 0;
4055+ return '?';
4056+ }
4057+ }
4058+
4059+ /* Look at and handle the next short option-character. */
4060+
4061+ {
4062+ char c = *nextchar++;
4063+ char *temp = my_index (optstring, c);
4064+
4065+ /* Increment `optind' when we start to process its last character. */
4066+ if (*nextchar == '\0')
4067+ ++optind;
4068+
4069+ if (temp == NULL || c == ':')
4070+ {
4071+ if (print_errors)
4072+ {
4073+ if (posixly_correct)
4074+ /* 1003.2 specifies the format of this message. */
4075+ fprintf (stderr, _("%s: illegal option -- %c\n"),
4076+ argv[0], c);
4077+ else
4078+ fprintf (stderr, _("%s: invalid option -- %c\n"),
4079+ argv[0], c);
4080+ }
4081+ optopt = c;
4082+ return '?';
4083+ }
4084+ /* Convenience. Treat POSIX -W foo same as long option --foo */
4085+ if (temp[0] == 'W' && temp[1] == ';')
4086+ {
4087+ char *nameend;
4088+ const struct option *p;
4089+ const struct option *pfound = NULL;
4090+ int exact = 0;
4091+ int ambig = 0;
4092+ int indfound = 0;
4093+ int option_index;
4094+
4095+ /* This is an option that requires an argument. */
4096+ if (*nextchar != '\0')
4097+ {
4098+ optarg = nextchar;
4099+ /* If we end this ARGV-element by taking the rest as an arg,
4100+ we must advance to the next element now. */
4101+ optind++;
4102+ }
4103+ else if (optind == argc)
4104+ {
4105+ if (print_errors)
4106+ {
4107+ /* 1003.2 specifies the format of this message. */
4108+ fprintf (stderr, _("%s: option requires an argument -- %c\n"),
4109+ argv[0], c);
4110+ }
4111+ optopt = c;
4112+ if (optstring[0] == ':')
4113+ c = ':';
4114+ else
4115+ c = '?';
4116+ return c;
4117+ }
4118+ else
4119+ /* We already incremented `optind' once;
4120+ increment it again when taking next ARGV-elt as argument. */
4121+ optarg = argv[optind++];
4122+
4123+ /* optarg is now the argument, see if it's in the
4124+ table of longopts. */
4125+
4126+ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
4127+ /* Do nothing. */ ;
4128+
4129+ /* Test all long options for either exact match
4130+ or abbreviated matches. */
4131+ for (p = longopts, option_index = 0; p->name; p++, option_index++)
4132+ if (!strncmp (p->name, nextchar, nameend - nextchar))
4133+ {
4134+ if ((unsigned int) (nameend - nextchar) == strlen (p->name))
4135+ {
4136+ /* Exact match found. */
4137+ pfound = p;
4138+ indfound = option_index;
4139+ exact = 1;
4140+ break;
4141+ }
4142+ else if (pfound == NULL)
4143+ {
4144+ /* First nonexact match found. */
4145+ pfound = p;
4146+ indfound = option_index;
4147+ }
4148+ else
4149+ /* Second or later nonexact match found. */
4150+ ambig = 1;
4151+ }
4152+ if (ambig && !exact)
4153+ {
4154+ if (print_errors)
4155+ fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
4156+ argv[0], argv[optind]);
4157+ nextchar += strlen (nextchar);
4158+ optind++;
4159+ return '?';
4160+ }
4161+ if (pfound != NULL)
4162+ {
4163+ option_index = indfound;
4164+ if (*nameend)
4165+ {
4166+ /* Don't test has_arg with >, because some C compilers don't
4167+ allow it to be used on enums. */
4168+ if (pfound->has_arg)
4169+ optarg = nameend + 1;
4170+ else
4171+ {
4172+ if (print_errors)
4173+ fprintf (stderr, _("\
4174+%s: option `-W %s' doesn't allow an argument\n"),
4175+ argv[0], pfound->name);
4176+
4177+ nextchar += strlen (nextchar);
4178+ return '?';
4179+ }
4180+ }
4181+ else if (pfound->has_arg == 1)
4182+ {
4183+ if (optind < argc)
4184+ optarg = argv[optind++];
4185+ else
4186+ {
4187+ if (print_errors)
4188+ fprintf (stderr,
4189+ _("%s: option `%s' requires an argument\n"),
4190+ argv[0], argv[optind - 1]);
4191+ nextchar += strlen (nextchar);
4192+ return optstring[0] == ':' ? ':' : '?';
4193+ }
4194+ }
4195+ nextchar += strlen (nextchar);
4196+ if (longind != NULL)
4197+ *longind = option_index;
4198+ if (pfound->flag)
4199+ {
4200+ *(pfound->flag) = pfound->val;
4201+ return 0;
4202+ }
4203+ return pfound->val;
4204+ }
4205+ nextchar = NULL;
4206+ return 'W'; /* Let the application handle it. */
4207+ }
4208+ if (temp[1] == ':')
4209+ {
4210+ if (temp[2] == ':')
4211+ {
4212+ /* This is an option that accepts an argument optionally. */
4213+ if (*nextchar != '\0')
4214+ {
4215+ optarg = nextchar;
4216+ optind++;
4217+ }
4218+ else
4219+ optarg = NULL;
4220+ nextchar = NULL;
4221+ }
4222+ else
4223+ {
4224+ /* This is an option that requires an argument. */
4225+ if (*nextchar != '\0')
4226+ {
4227+ optarg = nextchar;
4228+ /* If we end this ARGV-element by taking the rest as an arg,
4229+ we must advance to the next element now. */
4230+ optind++;
4231+ }
4232+ else if (optind == argc)
4233+ {
4234+ if (print_errors)
4235+ {
4236+ /* 1003.2 specifies the format of this message. */
4237+ fprintf (stderr,
4238+ _("%s: option requires an argument -- %c\n"),
4239+ argv[0], c);
4240+ }
4241+ optopt = c;
4242+ if (optstring[0] == ':')
4243+ c = ':';
4244+ else
4245+ c = '?';
4246+ }
4247+ else
4248+ /* We already incremented `optind' once;
4249+ increment it again when taking next ARGV-elt as argument. */
4250+ optarg = argv[optind++];
4251+ nextchar = NULL;
4252+ }
4253+ }
4254+ return c;
4255+ }
4256+}
4257+
4258+int
4259+getopt ( int argc, char *const *argv, const char *optstring)
4260+{
4261+ return _getopt_internal (argc, argv, optstring,
4262+ (const struct option *) 0,
4263+ (int *) 0,
4264+ 0);
4265+}
4266+
4267+int getopt_long (int argc, char *const *argv, const char *optstring,
4268+ const struct option *longopts, int *longind)
4269+{
4270+ return _getopt_internal (argc, argv, optstring, longopts, longind, 0);
4271+}
4272+extern int getopt_long_only (int argc, char *const *argv, const char *optstring,
4273+ const struct option *longopts, int *longind)
4274+{
4275+ return _getopt_internal (argc, argv, optstring, longopts, longind, 1);
4276+}
4277+
4278+#endif /* Not ELIDE_CODE. */
4279+
4280
4281+#ifdef TEST
4282+
4283+/* Compile with -DTEST to make an executable for use in testing
4284+ the above definition of `getopt'. */
4285+
4286+int
4287+main (argc, argv)
4288+ int argc;
4289+ char **argv;
4290+{
4291+ int c;
4292+ int digit_optind = 0;
4293+
4294+ while (1)
4295+ {
4296+ int this_option_optind = optind ? optind : 1;
4297+
4298+ c = getopt (argc, argv, "abc:d:0123456789");
4299+ if (c == -1)
4300+ break;
4301+
4302+ switch (c)
4303+ {
4304+ case '0':
4305+ case '1':
4306+ case '2':
4307+ case '3':
4308+ case '4':
4309+ case '5':
4310+ case '6':
4311+ case '7':
4312+ case '8':
4313+ case '9':
4314+ if (digit_optind != 0 && digit_optind != this_option_optind)
4315+ printf ("digits occur in two different argv-elements.\n");
4316+ digit_optind = this_option_optind;
4317+ printf ("option %c\n", c);
4318+ break;
4319+
4320+ case 'a':
4321+ printf ("option a\n");
4322+ break;
4323+
4324+ case 'b':
4325+ printf ("option b\n");
4326+ break;
4327+
4328+ case 'c':
4329+ printf ("option c with value `%s'\n", optarg);
4330+ break;
4331+
4332+ case '?':
4333+ break;
4334+
4335+ default:
4336+ printf ("?? getopt returned character code 0%o ??\n", c);
4337+ }
4338+ }
4339+
4340+ if (optind < argc)
4341+ {
4342+ printf ("non-option ARGV-elements: ");
4343+ while (optind < argc)
4344+ printf ("%s ", argv[optind++]);
4345+ printf ("\n");
4346+ }
4347+
4348+ exit (0);
4349+}
4350+
4351+#endif /* TEST */
4352
4353=== added file 'win32/getopt.h'
4354--- win32/getopt.h 1970-01-01 00:00:00 +0000
4355+++ win32/getopt.h 2011-01-13 03:40:43 +0000
4356@@ -0,0 +1,173 @@
4357+/* Declarations for getopt.
4358+ Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
4359+ This file is part of the GNU C Library.
4360+
4361+ The GNU C Library is free software; you can redistribute it and/or
4362+ modify it under the terms of the GNU General Public License as
4363+ published by the Free Software Foundation; either version 2 of the
4364+ License, or (at your option) any later version.
4365+
4366+ The GNU C Library is distributed in the hope that it will be useful,
4367+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4368+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4369+ General Public License for more details.
4370+
4371+ You should have received a copy of the GNU General Public
4372+ License along with the GNU C Library; see the file COPYING. If not,
4373+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
4374+ Boston, MA 02111-1307, USA. */
4375+
4376+#ifndef _GETOPT_H
4377+
4378+#ifndef __need_getopt
4379+# define _GETOPT_H 1
4380+#endif
4381+
4382+#ifdef __cplusplus
4383+extern "C" {
4384+#endif
4385+
4386+/* For communication from `getopt' to the caller.
4387+ When `getopt' finds an option that takes an argument,
4388+ the argument value is returned here.
4389+ Also, when `ordering' is RETURN_IN_ORDER,
4390+ each non-option ARGV-element is returned here. */
4391+
4392+extern char *optarg;
4393+
4394+/* Index in ARGV of the next element to be scanned.
4395+ This is used for communication to and from the caller
4396+ and for communication between successive calls to `getopt'.
4397+
4398+ On entry to `getopt', zero means this is the first call; initialize.
4399+
4400+ When `getopt' returns -1, this is the index of the first of the
4401+ non-option elements that the caller should itself scan.
4402+
4403+ Otherwise, `optind' communicates from one call to the next
4404+ how much of ARGV has been scanned so far. */
4405+
4406+extern int optind;
4407+
4408+/* Callers store zero here to inhibit the error message `getopt' prints
4409+ for unrecognized options. */
4410+
4411+extern int opterr;
4412+
4413+/* Set to an option character which was unrecognized. */
4414+
4415+extern int optopt;
4416+
4417+#ifndef __need_getopt
4418+/* Describe the long-named options requested by the application.
4419+ The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
4420+ of `struct option' terminated by an element containing a name which is
4421+ zero.
4422+
4423+ The field `has_arg' is:
4424+ no_argument (or 0) if the option does not take an argument,
4425+ required_argument (or 1) if the option requires an argument,
4426+ optional_argument (or 2) if the option takes an optional argument.
4427+
4428+ If the field `flag' is not NULL, it points to a variable that is set
4429+ to the value given in the field `val' when the option is found, but
4430+ left unchanged if the option is not found.
4431+
4432+ To have a long-named option do something other than set an `int' to
4433+ a compiled-in constant, such as set a value from `optarg', set the
4434+ option's `flag' field to zero and its `val' field to a nonzero
4435+ value (the equivalent single-letter option character, if there is
4436+ one). For long options that have a zero `flag' field, `getopt'
4437+ returns the contents of the `val' field. */
4438+
4439+struct option
4440+{
4441+# if defined __STDC__ && __STDC__
4442+ const char *name;
4443+# else
4444+ char *name;
4445+# endif
4446+ /* has_arg can't be an enum because some compilers complain about
4447+ type mismatches in all the code that assumes it is an int. */
4448+ int has_arg;
4449+ int *flag;
4450+ int val;
4451+};
4452+
4453+/* Names for the values of the `has_arg' field of `struct option'. */
4454+
4455+# define no_argument 0
4456+# define required_argument 1
4457+# define optional_argument 2
4458+#endif /* need getopt */
4459+
4460+
4461+/* Get definitions and prototypes for functions to process the
4462+ arguments in ARGV (ARGC of them, minus the program name) for
4463+ options given in OPTS.
4464+
4465+ Return the option character from OPTS just read. Return -1 when
4466+ there are no more options. For unrecognized options, or options
4467+ missing arguments, `optopt' is set to the option letter, and '?' is
4468+ returned.
4469+
4470+ The OPTS string is a list of characters which are recognized option
4471+ letters, optionally followed by colons, specifying that that letter
4472+ takes an argument, to be placed in `optarg'.
4473+
4474+ If a letter in OPTS is followed by two colons, its argument is
4475+ optional. This behavior is specific to the GNU `getopt'.
4476+
4477+ The argument `--' causes premature termination of argument
4478+ scanning, explicitly telling `getopt' that there are no more
4479+ options.
4480+
4481+ If OPTS begins with `--', then non-option arguments are treated as
4482+ arguments to the option '\0'. This behavior is specific to the GNU
4483+ `getopt'. */
4484+
4485+#if defined __STDC__ && __STDC__
4486+# ifdef __GNU_LIBRARY__
4487+/* Many other libraries have conflicting prototypes for getopt, with
4488+ differences in the consts, in stdlib.h. To avoid compilation
4489+ errors, only prototype getopt for the GNU C library. */
4490+extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
4491+# else /* not __GNU_LIBRARY__ */
4492+extern int getopt ();
4493+# endif /* __GNU_LIBRARY__ */
4494+
4495+# ifndef __need_getopt
4496+extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
4497+ const struct option *__longopts, int *__longind);
4498+extern int getopt_long_only (int __argc, char *const *__argv,
4499+ const char *__shortopts,
4500+ const struct option *__longopts, int *__longind);
4501+
4502+/* Internal only. Users should not call this directly. */
4503+extern int _getopt_internal (int __argc, char *const *__argv,
4504+ const char *__shortopts,
4505+ const struct option *__longopts, int *__longind,
4506+ int __long_only);
4507+# endif
4508+#else /* not __STDC__ */
4509+extern int
4510+getopt ( int argc, char *const *argv, const char *optstring);
4511+# ifndef __need_getopt
4512+extern int getopt_long (int argc, char *const *argv, const char *optstring,
4513+ const struct option *longopts, int *longind);
4514+extern int getopt_long_only (int argc, char *const *argv, const char *optstring,
4515+ const struct option *longopts, int *longind);
4516+
4517+extern int _getopt_internal (int argc, char *const *argv, const char *optstring,
4518+ const struct option *longopts, int *longind, int long_only);
4519+# endif
4520+#endif /* __STDC__ */
4521+
4522+#ifdef __cplusplus
4523+}
4524+#endif
4525+
4526+/* Make sure we later can get all the definitions and declarations. */
4527+#undef __need_getopt
4528+
4529+#endif /* getopt.h */
4530
4531=== added file 'win32/inttypes.h'
4532--- win32/inttypes.h 1970-01-01 00:00:00 +0000
4533+++ win32/inttypes.h 2011-01-13 03:40:43 +0000
4534@@ -0,0 +1,13 @@
4535+#pragma once
4536+
4537+typedef char int8_t;
4538+typedef unsigned char uint8_t;
4539+typedef short int16_t;
4540+typedef unsigned short uint16_t;
4541+typedef int int32_t;
4542+typedef unsigned int uint32_t;
4543+typedef __int64 int64_t;
4544+typedef unsigned __int64 uint64_t;
4545+
4546+typedef int ssize_t;
4547+typedef unsigned int size_t;
4548\ No newline at end of file
4549
4550=== added file 'win32/libmemcached.sln'
4551--- win32/libmemcached.sln 1970-01-01 00:00:00 +0000
4552+++ win32/libmemcached.sln 2011-01-13 03:40:43 +0000
4553@@ -0,0 +1,92 @@
4554+
4555+Microsoft Visual Studio Solution File, Format Version 10.00
4556+# Visual Studio 2008
4557+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmemcached-win32", "libmemcached.vcproj", "{3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}"
4558+EndProject
4559+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "memcapable", "memcapable.vcproj", "{9545B3E3-F6E1-4C3D-A7C3-BAB60D94A15A}"
4560+ ProjectSection(ProjectDependencies) = postProject
4561+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99} = {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}
4562+ EndProjectSection
4563+EndProject
4564+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "memcat", "memcat.vcproj", "{82BF1D3F-0090-456C-8E45-407E9B8DDF7B}"
4565+ ProjectSection(ProjectDependencies) = postProject
4566+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99} = {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}
4567+ EndProjectSection
4568+EndProject
4569+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "memcp", "memcp.vcproj", "{C590AC65-FFB1-4084-A850-A4893C1C93B0}"
4570+ ProjectSection(ProjectDependencies) = postProject
4571+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99} = {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}
4572+ EndProjectSection
4573+EndProject
4574+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "memdump", "memdump.vcproj", "{E0C217F1-E7B3-4B87-9067-B1B11CE1139D}"
4575+ ProjectSection(ProjectDependencies) = postProject
4576+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99} = {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}
4577+ EndProjectSection
4578+EndProject
4579+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "memerror", "memerror.vcproj", "{CD90B6B5-BAF7-49DC-A05F-C8606BC8F29B}"
4580+ ProjectSection(ProjectDependencies) = postProject
4581+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99} = {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}
4582+ EndProjectSection
4583+EndProject
4584+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "memflush", "memflush.vcproj", "{800FC200-ED8E-4191-944D-28B33540C62D}"
4585+ ProjectSection(ProjectDependencies) = postProject
4586+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99} = {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}
4587+ EndProjectSection
4588+EndProject
4589+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "memrm", "memrm.vcproj", "{656696BA-4EE2-41CE-B451-ADF82611701B}"
4590+ ProjectSection(ProjectDependencies) = postProject
4591+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99} = {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}
4592+ EndProjectSection
4593+EndProject
4594+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "memstat", "memstat.vcproj", "{9746CFE7-4AF2-458D-A216-FC56F5BA62F2}"
4595+ ProjectSection(ProjectDependencies) = postProject
4596+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99} = {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}
4597+ EndProjectSection
4598+EndProject
4599+Global
4600+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
4601+ Debug|Win32 = Debug|Win32
4602+ Release|Win32 = Release|Win32
4603+ EndGlobalSection
4604+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
4605+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}.Debug|Win32.ActiveCfg = Debug|Win32
4606+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}.Debug|Win32.Build.0 = Debug|Win32
4607+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}.Release|Win32.ActiveCfg = Release|Win32
4608+ {3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}.Release|Win32.Build.0 = Release|Win32
4609+ {9545B3E3-F6E1-4C3D-A7C3-BAB60D94A15A}.Debug|Win32.ActiveCfg = Debug|Win32
4610+ {9545B3E3-F6E1-4C3D-A7C3-BAB60D94A15A}.Debug|Win32.Build.0 = Debug|Win32
4611+ {9545B3E3-F6E1-4C3D-A7C3-BAB60D94A15A}.Release|Win32.ActiveCfg = Release|Win32
4612+ {9545B3E3-F6E1-4C3D-A7C3-BAB60D94A15A}.Release|Win32.Build.0 = Release|Win32
4613+ {82BF1D3F-0090-456C-8E45-407E9B8DDF7B}.Debug|Win32.ActiveCfg = Debug|Win32
4614+ {82BF1D3F-0090-456C-8E45-407E9B8DDF7B}.Debug|Win32.Build.0 = Debug|Win32
4615+ {82BF1D3F-0090-456C-8E45-407E9B8DDF7B}.Release|Win32.ActiveCfg = Release|Win32
4616+ {82BF1D3F-0090-456C-8E45-407E9B8DDF7B}.Release|Win32.Build.0 = Release|Win32
4617+ {C590AC65-FFB1-4084-A850-A4893C1C93B0}.Debug|Win32.ActiveCfg = Debug|Win32
4618+ {C590AC65-FFB1-4084-A850-A4893C1C93B0}.Debug|Win32.Build.0 = Debug|Win32
4619+ {C590AC65-FFB1-4084-A850-A4893C1C93B0}.Release|Win32.ActiveCfg = Release|Win32
4620+ {C590AC65-FFB1-4084-A850-A4893C1C93B0}.Release|Win32.Build.0 = Release|Win32
4621+ {E0C217F1-E7B3-4B87-9067-B1B11CE1139D}.Debug|Win32.ActiveCfg = Debug|Win32
4622+ {E0C217F1-E7B3-4B87-9067-B1B11CE1139D}.Debug|Win32.Build.0 = Debug|Win32
4623+ {E0C217F1-E7B3-4B87-9067-B1B11CE1139D}.Release|Win32.ActiveCfg = Release|Win32
4624+ {E0C217F1-E7B3-4B87-9067-B1B11CE1139D}.Release|Win32.Build.0 = Release|Win32
4625+ {CD90B6B5-BAF7-49DC-A05F-C8606BC8F29B}.Debug|Win32.ActiveCfg = Debug|Win32
4626+ {CD90B6B5-BAF7-49DC-A05F-C8606BC8F29B}.Debug|Win32.Build.0 = Debug|Win32
4627+ {CD90B6B5-BAF7-49DC-A05F-C8606BC8F29B}.Release|Win32.ActiveCfg = Release|Win32
4628+ {CD90B6B5-BAF7-49DC-A05F-C8606BC8F29B}.Release|Win32.Build.0 = Release|Win32
4629+ {800FC200-ED8E-4191-944D-28B33540C62D}.Debug|Win32.ActiveCfg = Debug|Win32
4630+ {800FC200-ED8E-4191-944D-28B33540C62D}.Debug|Win32.Build.0 = Debug|Win32
4631+ {800FC200-ED8E-4191-944D-28B33540C62D}.Release|Win32.ActiveCfg = Release|Win32
4632+ {800FC200-ED8E-4191-944D-28B33540C62D}.Release|Win32.Build.0 = Release|Win32
4633+ {656696BA-4EE2-41CE-B451-ADF82611701B}.Debug|Win32.ActiveCfg = Debug|Win32
4634+ {656696BA-4EE2-41CE-B451-ADF82611701B}.Debug|Win32.Build.0 = Debug|Win32
4635+ {656696BA-4EE2-41CE-B451-ADF82611701B}.Release|Win32.ActiveCfg = Release|Win32
4636+ {656696BA-4EE2-41CE-B451-ADF82611701B}.Release|Win32.Build.0 = Release|Win32
4637+ {9746CFE7-4AF2-458D-A216-FC56F5BA62F2}.Debug|Win32.ActiveCfg = Debug|Win32
4638+ {9746CFE7-4AF2-458D-A216-FC56F5BA62F2}.Debug|Win32.Build.0 = Debug|Win32
4639+ {9746CFE7-4AF2-458D-A216-FC56F5BA62F2}.Release|Win32.ActiveCfg = Release|Win32
4640+ {9746CFE7-4AF2-458D-A216-FC56F5BA62F2}.Release|Win32.Build.0 = Release|Win32
4641+ EndGlobalSection
4642+ GlobalSection(SolutionProperties) = preSolution
4643+ HideSolutionNode = FALSE
4644+ EndGlobalSection
4645+EndGlobal
4646
4647=== added file 'win32/libmemcached.vcproj'
4648--- win32/libmemcached.vcproj 1970-01-01 00:00:00 +0000
4649+++ win32/libmemcached.vcproj 2011-01-13 03:40:43 +0000
4650@@ -0,0 +1,618 @@
4651+<?xml version="1.0" encoding="gb2312"?>
4652+<VisualStudioProject
4653+ ProjectType="Visual C++"
4654+ Version="9.00"
4655+ Name="libmemcached-win32"
4656+ ProjectGUID="{3BF1DCB9-580A-4AC2-8F4E-141C8F578A99}"
4657+ RootNamespace="libmemcachedwin32"
4658+ TargetFrameworkVersion="196613"
4659+ >
4660+ <Platforms>
4661+ <Platform
4662+ Name="Win32"
4663+ />
4664+ </Platforms>
4665+ <ToolFiles>
4666+ </ToolFiles>
4667+ <Configurations>
4668+ <Configuration
4669+ Name="Debug|Win32"
4670+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
4671+ IntermediateDirectory="$(ConfigurationName)"
4672+ ConfigurationType="4"
4673+ CharacterSet="2"
4674+ >
4675+ <Tool
4676+ Name="VCPreBuildEventTool"
4677+ />
4678+ <Tool
4679+ Name="VCCustomBuildTool"
4680+ />
4681+ <Tool
4682+ Name="VCXMLDataGeneratorTool"
4683+ />
4684+ <Tool
4685+ Name="VCWebServiceProxyGeneratorTool"
4686+ />
4687+ <Tool
4688+ Name="VCMIDLTool"
4689+ />
4690+ <Tool
4691+ Name="VCCLCompilerTool"
4692+ Optimization="0"
4693+ AdditionalIncludeDirectories="..;."
4694+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMEMCACHED_STATIC"
4695+ MinimalRebuild="true"
4696+ BasicRuntimeChecks="3"
4697+ RuntimeLibrary="3"
4698+ WarningLevel="3"
4699+ DebugInformationFormat="4"
4700+ />
4701+ <Tool
4702+ Name="VCManagedResourceCompilerTool"
4703+ />
4704+ <Tool
4705+ Name="VCResourceCompilerTool"
4706+ />
4707+ <Tool
4708+ Name="VCPreLinkEventTool"
4709+ />
4710+ <Tool
4711+ Name="VCLibrarianTool"
4712+ />
4713+ <Tool
4714+ Name="VCALinkTool"
4715+ />
4716+ <Tool
4717+ Name="VCXDCMakeTool"
4718+ />
4719+ <Tool
4720+ Name="VCBscMakeTool"
4721+ />
4722+ <Tool
4723+ Name="VCFxCopTool"
4724+ />
4725+ <Tool
4726+ Name="VCPostBuildEventTool"
4727+ />
4728+ </Configuration>
4729+ <Configuration
4730+ Name="Release|Win32"
4731+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
4732+ IntermediateDirectory="$(ConfigurationName)"
4733+ ConfigurationType="4"
4734+ CharacterSet="2"
4735+ WholeProgramOptimization="1"
4736+ >
4737+ <Tool
4738+ Name="VCPreBuildEventTool"
4739+ />
4740+ <Tool
4741+ Name="VCCustomBuildTool"
4742+ />
4743+ <Tool
4744+ Name="VCXMLDataGeneratorTool"
4745+ />
4746+ <Tool
4747+ Name="VCWebServiceProxyGeneratorTool"
4748+ />
4749+ <Tool
4750+ Name="VCMIDLTool"
4751+ />
4752+ <Tool
4753+ Name="VCCLCompilerTool"
4754+ Optimization="2"
4755+ EnableIntrinsicFunctions="true"
4756+ AdditionalIncludeDirectories="..;."
4757+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBMEMCACHED_STATIC"
4758+ RuntimeLibrary="2"
4759+ EnableFunctionLevelLinking="true"
4760+ WarningLevel="3"
4761+ DebugInformationFormat="3"
4762+ />
4763+ <Tool
4764+ Name="VCManagedResourceCompilerTool"
4765+ />
4766+ <Tool
4767+ Name="VCResourceCompilerTool"
4768+ />
4769+ <Tool
4770+ Name="VCPreLinkEventTool"
4771+ />
4772+ <Tool
4773+ Name="VCLibrarianTool"
4774+ />
4775+ <Tool
4776+ Name="VCALinkTool"
4777+ />
4778+ <Tool
4779+ Name="VCXDCMakeTool"
4780+ />
4781+ <Tool
4782+ Name="VCBscMakeTool"
4783+ />
4784+ <Tool
4785+ Name="VCFxCopTool"
4786+ />
4787+ <Tool
4788+ Name="VCPostBuildEventTool"
4789+ />
4790+ </Configuration>
4791+ </Configurations>
4792+ <References>
4793+ </References>
4794+ <Files>
4795+ <Filter
4796+ Name="Source Files"
4797+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
4798+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
4799+ >
4800+ <File
4801+ RelativePath="..\libmemcached\allocators.c"
4802+ >
4803+ </File>
4804+ <File
4805+ RelativePath="..\libmemcached\analyze.c"
4806+ >
4807+ </File>
4808+ <File
4809+ RelativePath="..\libmemcached\auto.c"
4810+ >
4811+ </File>
4812+ <File
4813+ RelativePath="..\libmemcached\behavior.c"
4814+ >
4815+ </File>
4816+ <File
4817+ RelativePath="..\libmemcached\byteorder.c"
4818+ >
4819+ </File>
4820+ <File
4821+ RelativePath="..\libmemcached\callback.c"
4822+ >
4823+ </File>
4824+ <File
4825+ RelativePath="..\libmemcached\connect.c"
4826+ >
4827+ </File>
4828+ <File
4829+ RelativePath="..\libmemcached\delete.c"
4830+ >
4831+ </File>
4832+ <File
4833+ RelativePath="..\libmemcached\do.c"
4834+ >
4835+ </File>
4836+ <File
4837+ RelativePath="..\libmemcached\dump.c"
4838+ >
4839+ </File>
4840+ <File
4841+ RelativePath="..\libmemcached\fetch.c"
4842+ >
4843+ </File>
4844+ <File
4845+ RelativePath="..\libmemcached\flush.c"
4846+ >
4847+ </File>
4848+ <File
4849+ RelativePath="..\libmemcached\flush_buffers.c"
4850+ >
4851+ </File>
4852+ <File
4853+ RelativePath="..\libmemcached\get.c"
4854+ >
4855+ </File>
4856+ <File
4857+ RelativePath="..\libmemcached\hash.c"
4858+ >
4859+ </File>
4860+ <File
4861+ RelativePath="..\libmemcached\hosts.c"
4862+ >
4863+ </File>
4864+ <File
4865+ RelativePath="..\libmemcached\io.c"
4866+ >
4867+ </File>
4868+ <File
4869+ RelativePath="..\libmemcached\key.c"
4870+ >
4871+ </File>
4872+ <File
4873+ RelativePath="..\libmemcached\memcached.c"
4874+ >
4875+ </File>
4876+ <File
4877+ RelativePath="..\libmemcached\parse.c"
4878+ >
4879+ </File>
4880+ <File
4881+ RelativePath="..\libmemcached\purge.c"
4882+ >
4883+ </File>
4884+ <File
4885+ RelativePath="..\libmemcached\quit.c"
4886+ >
4887+ </File>
4888+ <File
4889+ RelativePath="..\libmemcached\response.c"
4890+ >
4891+ </File>
4892+ <File
4893+ RelativePath="..\libmemcached\result.c"
4894+ >
4895+ </File>
4896+ <File
4897+ RelativePath="..\libmemcached\sasl.c"
4898+ >
4899+ </File>
4900+ <File
4901+ RelativePath="..\libmemcached\server.c"
4902+ >
4903+ </File>
4904+ <File
4905+ RelativePath="..\libmemcached\server_list.c"
4906+ >
4907+ </File>
4908+ <File
4909+ RelativePath="..\libmemcached\stats.c"
4910+ >
4911+ </File>
4912+ <File
4913+ RelativePath="..\libmemcached\storage.c"
4914+ >
4915+ </File>
4916+ <File
4917+ RelativePath="..\libmemcached\strerror.c"
4918+ >
4919+ </File>
4920+ <File
4921+ RelativePath="..\libmemcached\string.c"
4922+ >
4923+ </File>
4924+ <File
4925+ RelativePath="..\libmemcached\verbosity.c"
4926+ >
4927+ </File>
4928+ <File
4929+ RelativePath="..\libmemcached\version.c"
4930+ >
4931+ </File>
4932+ <Filter
4933+ Name="hashkit"
4934+ >
4935+ <File
4936+ RelativePath="..\libhashkit\algorithm.c"
4937+ >
4938+ </File>
4939+ <File
4940+ RelativePath="..\libhashkit\behavior.c"
4941+ >
4942+ </File>
4943+ <File
4944+ RelativePath="..\libhashkit\crc32.c"
4945+ >
4946+ </File>
4947+ <File
4948+ RelativePath="..\libhashkit\digest.c"
4949+ >
4950+ </File>
4951+ <File
4952+ RelativePath="..\libhashkit\fnv.c"
4953+ >
4954+ </File>
4955+ <File
4956+ RelativePath="..\libhashkit\function.c"
4957+ >
4958+ </File>
4959+ <File
4960+ RelativePath="..\libhashkit\hashkit.c"
4961+ >
4962+ </File>
4963+ <File
4964+ RelativePath="..\libhashkit\hsieh.c"
4965+ >
4966+ </File>
4967+ <File
4968+ RelativePath="..\libhashkit\jenkins.c"
4969+ >
4970+ </File>
4971+ <File
4972+ RelativePath="..\libhashkit\ketama.c"
4973+ >
4974+ </File>
4975+ <File
4976+ RelativePath="..\libhashkit\md5.c"
4977+ >
4978+ </File>
4979+ <File
4980+ RelativePath="..\libhashkit\murmur.c"
4981+ >
4982+ </File>
4983+ <File
4984+ RelativePath="..\libhashkit\one_at_a_time.c"
4985+ >
4986+ </File>
4987+ <File
4988+ RelativePath="..\libhashkit\strerror.c"
4989+ >
4990+ </File>
4991+ </Filter>
4992+ <Filter
4993+ Name="poll"
4994+ >
4995+ <File
4996+ RelativePath="..\poll\poll.c"
4997+ >
4998+ </File>
4999+ </Filter>
5000+ <Filter
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: