projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Remove dead configure.ac issues.
[m6w6/libmemcached]
/
clients
/
memcapable.cc
diff --git
a/clients/memcapable.cc
b/clients/memcapable.cc
index 9dff427eb3c2c9c88e8c5463569aa895ca8d65d6..9bd310c524dd563c482ecaa3f7a200c8c8de3637 100644
(file)
--- a/
clients/memcapable.cc
+++ b/
clients/memcapable.cc
@@
-20,21
+20,21
@@
#include "poll/poll.h"
#endif
#include "poll/poll.h"
#endif
-#include <assert.h>
+#include <cassert>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <ctype.h>
#include <ctype.h>
-#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <pthread.h>
#include <signal.h>
#include <fcntl.h>
#include <inttypes.h>
#include <pthread.h>
#include <signal.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>
-#include <libmemcached/memcached.h>
+#include <libmemcached-1.0/memcached.h>
+#include <libmemcached/socket.hpp>
#include <libmemcached/memcached/protocol_binary.h>
#include <libmemcached/byteorder.h>
#include <clients/utilities.h>
#include <libmemcached/memcached/protocol_binary.h>
#include <libmemcached/byteorder.h>
#include <clients/utilities.h>
@@
-133,7
+133,7
@@
static memcached_socket_t set_noblock(void)
if (flags == -1)
{
perror("Failed to get socket flags");
if (flags == -1)
{
perror("Failed to get socket flags");
-
close
socket(sock);
+
memcached_close_
socket(sock);
return INVALID_SOCKET;
}
return INVALID_SOCKET;
}
@@
-142,7
+142,7
@@
static memcached_socket_t set_noblock(void)
if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) == -1)
{
perror("Failed to set socket to nonblocking mode");
if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) == -1)
{
perror("Failed to set socket to nonblocking mode");
-
close
socket(sock);
+
memcached_close_
socket(sock);
return INVALID_SOCKET;
}
}
return INVALID_SOCKET;
}
}
@@
-1336,7
+1336,10
@@
static enum test_return ascii_get_unknown_value(char **key, char **value, ssize_
verify(strncmp(buffer, "VALUE ", 6) == 0);
char *end= strchr(buffer + 6, ' ');
verify(end != NULL);
verify(strncmp(buffer, "VALUE ", 6) == 0);
char *end= strchr(buffer + 6, ' ');
verify(end != NULL);
- *end= '\0';
+ if (end)
+ {
+ *end= '\0';
+ }
*key= strdup(buffer + 6);
verify(*key != NULL);
char *ptr= end + 1;
*key= strdup(buffer + 6);
verify(*key != NULL);
char *ptr= end + 1;
@@
-1348,9
+1351,9
@@
static enum test_return ascii_get_unknown_value(char **key, char **value, ssize_
*ndata = (ssize_t)strtoul(end, &end, 10); /* size */
verify(ptr != end);
verify(end != NULL);
*ndata = (ssize_t)strtoul(end, &end, 10); /* size */
verify(ptr != end);
verify(end != NULL);
- while (
*end != '\n' &&
isspace(*end))
+ while (
end and *end != '\n' and
isspace(*end))
++end;
++end;
- verify(*end == '\n');
+ verify(
end and
*end == '\n');
*value= static_cast<char*>(malloc((size_t)*ndata));
verify(*value != NULL);
*value= static_cast<char*>(malloc((size_t)*ndata));
verify(*value != NULL);
@@
-1384,9
+1387,11
@@
static enum test_return ascii_get_value(const char *key, const char *value)
verify(ptr != end);
verify(val == datasize);
verify(end != NULL);
verify(ptr != end);
verify(val == datasize);
verify(end != NULL);
- while (*end != '\n' && isspace(*end))
+ while (end and *end != '\n' and isspace(*end))
+ {
++end;
++end;
- verify(*end == '\n');
+ }
+ verify(end and *end == '\n');
execute(retry_read(buffer, datasize));
verify(memcmp(buffer, value, datasize) == 0);
execute(retry_read(buffer, datasize));
verify(memcmp(buffer, value, datasize) == 0);
@@
-1445,9
+1450,11
@@
static enum test_return ascii_gets_value(const char *key, const char *value,
verify(val == datasize);
verify(end != NULL);
verify(val == datasize);
verify(end != NULL);
- while (*end != '\n' && isspace(*end))
+ while (end and *end != '\n' and isspace(*end))
+ {
++end;
++end;
- verify(*end == '\n');
+ }
+ verify(end and *end == '\n');
execute(retry_read(buffer, datasize));
verify(memcmp(buffer, value, datasize) == 0);
execute(retry_read(buffer, datasize));
verify(memcmp(buffer, value, datasize) == 0);
@@
-1974,17
+1981,19
@@
int main(int argc, char **argv)
- while ((cmd= getopt(argc, argv, "t:vch:p:PT:?ab")) != EOF)
+ while ((cmd= getopt(argc, argv, "
q
t:vch:p:PT:?ab")) != EOF)
{
switch (cmd) {
case 'a':
tests.ascii= true;
tests.binary= false;
break;
{
switch (cmd) {
case 'a':
tests.ascii= true;
tests.binary= false;
break;
+
case 'b':
tests.ascii= false;
tests.binary= true;
break;
case 'b':
tests.ascii= false;
tests.binary= true;
break;
+
case 't':
timeout= atoi(optarg);
if (timeout == 0)
case 't':
timeout= atoi(optarg);
if (timeout == 0)
@@
-1993,18
+2002,29
@@
int main(int argc, char **argv)
return EXIT_FAILURE;
}
break;
return EXIT_FAILURE;
}
break;
+
case 'v': verbose= true;
break;
case 'v': verbose= true;
break;
+
case 'c': do_core= true;
break;
case 'c': do_core= true;
break;
+
case 'h': hostname= optarg;
break;
case 'h': hostname= optarg;
break;
+
case 'p': port= optarg;
break;
case 'p': port= optarg;
break;
+
+ case 'q':
+ close_stdio();
+ break;
+
case 'P': prompt= true;
break;
case 'P': prompt= true;
break;
+
case 'T': testname= optarg;
break;
case 'T': testname= optarg;
break;
+
default:
fprintf(stderr, "Usage: %s [-h hostname] [-p port] [-c] [-v] [-t n] [-P] [-T testname]'\n"
"\t-c\tGenerate coredump if a test fails\n"
default:
fprintf(stderr, "Usage: %s [-h hostname] [-p port] [-c] [-v] [-t n] [-P] [-T testname]'\n"
"\t-c\tGenerate coredump if a test fails\n"