--- /dev/null
+*
+!.gitignore
tests/var/
tmp_chroot
unittests/unittests
-.idea/
case 'd':
case 'D':
ret*= 24;
-
+ /* fall through */
case 'h':
case 'H':
ret*= 60;
-
+ /* fall through */
case 'm':
case 'M':
ret*= 60;
-
+ /* fall through */
case 's':
case 'S':
break;
#include <libmemcached-1.0/memcached.h>
#include "libmemcached/socket.hpp"
-#include "libmemcached/memcached/protocol_binary.h"
+#include "libmemcachedprotocol-0.0/binary.h"
#include "libmemcached/byteorder.h"
#include "clients/utilities.h"
case PROTOCOL_BINARY_CMD_REPLACEQ:
case PROTOCOL_BINARY_CMD_SETQ:
verify("Quiet command shouldn't return on success" == NULL);
+ /* fall through */
default:
break;
}
# define atomic_dec_size_nv(X) __sync_fetch_and_sub((X), 1)
#else
#warning "Atomic operators not found so memslap will not work correctly"
-# define atomic_add_8(X, Y)
-# define atomic_add_16(X, Y)
-# define atomic_add_32(X, Y)
-# define atomic_add_size(X, Y)
-# define atomic_dec_8(X)
-# define atomic_dec_16(X)
-# define atomic_dec_32(X)
-# define atomic_dec_size(X)
+# define atomic_add_8(X, Y) 0
+# define atomic_add_16(X, Y) 0
+# define atomic_add_32(X, Y) 0
+# define atomic_add_size(X, Y) 0
+# define atomic_dec_8(X) 0
+# define atomic_dec_16(X) 0
+# define atomic_dec_32(X) 0
+# define atomic_dec_size(X) 0
/* The same as above, but these return the new value instead of void */
-# define atomic_add_8_nv(X, Y)
-# define atomic_add_16_nv(X, Y)
-# define atomic_add_32_nv(X, Y)
-# define atomic_add_size_nv(X, Y)
-# define atomic_dec_8_nv(X)
-# define atomic_dec_16_nv(X)
-# define atomic_dec_32_nv(X)
-# define atomic_dec_size_nv(X)
+# define atomic_add_8_nv(X, Y) 0
+# define atomic_add_16_nv(X, Y) 0
+# define atomic_add_32_nv(X, Y) 0
+# define atomic_add_size_nv(X, Y) 0
+# define atomic_dec_8_nv(X) 0
+# define atomic_dec_16_nv(X) 0
+# define atomic_dec_32_nv(X) 0
+# define atomic_dec_size_nv(X) 0
#endif /* defined(__SUNPRO_C) */
#endif /* CLIENTS_MS_ATOMIC_H */
case 'O': /* OK */
c->currcmd.retstat= MCD_SUCCESS;
+ break;
case 'S': /* STORED STATS SERVER_ERROR */
if (buffer[2] == 'A') /* STORED STATS */
&& (c->rudpbytes + UDP_MAX_PAYLOAD_SIZE < UDP_DATA_BUFFER_SIZE))
{
char *new_rbuf= (char *)realloc(c->rudpbuf, (size_t)c->rudpsize * 2);
- if (! new_rbuf)
+ if (new_rbuf)
{
c->rudpbuf= new_rbuf;
c->rudpsize= UDP_DATA_BUFFER_SIZE;
#include <netdb.h>
#include "ms_task.h"
-#include <libmemcached/memcached/protocol_binary.h>
+#include <libmemcachedprotocol-0.0/binary.h>
#ifdef __cplusplus
extern "C" {
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
+ case 11: c+=((uint32_t)k8[10])<<16;
+ /* fall through */
case 10: c+=k[4];
b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 9 : c+=k8[8]; /* fall through */
+ case 9 : c+=k8[8];
+ /* fall through */
case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
+ case 7 : b+=((uint32_t)k8[6])<<16;
+ /* fall through */
case 6 : b+=k[2];
a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 5 : b+=k8[4]; /* fall through */
+ case 5 : b+=k8[4];
+ /* fall through */
case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
break;
- case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
+ case 3 : a+=((uint32_t)k8[2])<<16;
+ /* fall through */
case 2 : a+=k[0];
break;
case 1 : a+=k8[0];
/*-------------------------------- last block: affect all 32 bits of (c) */
switch(length) /* all the case statements fall through */
{
- case 12: c+=((uint32_t)k[11])<<24; /* fall through */
- case 11: c+=((uint32_t)k[10])<<16; /* fall through */
- case 10: c+=((uint32_t)k[9])<<8; /* fall through */
- case 9 : c+=k[8]; /* fall through */
- case 8 : b+=((uint32_t)k[7])<<24; /* fall through */
- case 7 : b+=((uint32_t)k[6])<<16; /* fall through */
- case 6 : b+=((uint32_t)k[5])<<8; /* fall through */
- case 5 : b+=k[4]; /* fall through */
- case 4 : a+=((uint32_t)k[3])<<24; /* fall through */
- case 3 : a+=((uint32_t)k[2])<<16; /* fall through */
- case 2 : a+=((uint32_t)k[1])<<8; /* fall through */
+ case 12: c+=((uint32_t)k[11])<<24;
+ /* fall through */
+ case 11: c+=((uint32_t)k[10])<<16;
+ /* fall through */
+ case 10: c+=((uint32_t)k[9])<<8;
+ /* fall through */
+ case 9 : c+=k[8];
+ /* fall through */
+ case 8 : b+=((uint32_t)k[7])<<24;
+ /* fall through */
+ case 7 : b+=((uint32_t)k[6])<<16;
+ /* fall through */
+ case 6 : b+=((uint32_t)k[5])<<8;
+ /* fall through */
+ case 5 : b+=k[4];
+ /* fall through */
+ case 4 : a+=((uint32_t)k[3])<<24;
+ /* fall through */
+ case 3 : a+=((uint32_t)k[2])<<16;
+ /* fall through */
+ case 2 : a+=((uint32_t)k[1])<<8;
+ /* fall through */
case 1 : a+=k[0];
break;
case 0 : return c;
switch(len & 3)
{
- case 3: k1 ^= tail[2] << 16; /* fall through */
- case 2: k1 ^= tail[1] << 8; /* fall through */
+ case 3: k1 ^= tail[2] << 16;
+ /* fall through */
+ case 2: k1 ^= tail[1] << 8;
+ /* fall through */
case 1: k1 ^= tail[0];
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
};
switch(len & 15)
{
- case 15: k4 ^= tail[14] << 16; /* fall through */
- case 14: k4 ^= tail[13] << 8; /* fall through */
+ case 15: k4 ^= tail[14] << 16;
+ /* fall through */
+ case 14: k4 ^= tail[13] << 8;
+ /* fall through */
case 13: k4 ^= tail[12] << 0;
k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
- /* fall through */
- case 12: k3 ^= tail[11] << 24; /* fall through */
- case 11: k3 ^= tail[10] << 16; /* fall through */
- case 10: k3 ^= tail[ 9] << 8; /* fall through */
- case 9: k3 ^= tail[ 8] << 0; /* fall through */
+ /* fall through */
+ case 12: k3 ^= tail[11] << 24;
+ /* fall through */
+ case 11: k3 ^= tail[10] << 16;
+ /* fall through */
+ case 10: k3 ^= tail[ 9] << 8;
+ /* fall through */
+ case 9: k3 ^= tail[ 8] << 0;
k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
- /* fall through */
- case 8: k2 ^= tail[ 7] << 24; /* fall through */
- case 7: k2 ^= tail[ 6] << 16; /* fall through */
- case 6: k2 ^= tail[ 5] << 8; /* fall through */
- case 5: k2 ^= tail[ 4] << 0; /* fall through */
+ /* fall through */
+ case 8: k2 ^= tail[ 7] << 24;
+ /* fall through */
+ case 7: k2 ^= tail[ 6] << 16;
+ /* fall through */
+ case 6: k2 ^= tail[ 5] << 8;
+ /* fall through */
+ case 5: k2 ^= tail[ 4] << 0;
k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
- /* fall through */
- case 4: k1 ^= tail[ 3] << 24; /* fall through */
- case 3: k1 ^= tail[ 2] << 16; /* fall through */
- case 2: k1 ^= tail[ 1] << 8; /* fall through */
- case 1: k1 ^= tail[ 0] << 0; /* fall through */
+ /* fall through */
+ case 4: k1 ^= tail[ 3] << 24;
+ /* fall through */
+ case 3: k1 ^= tail[ 2] << 16;
+ /* fall through */
+ case 2: k1 ^= tail[ 1] << 8;
+ /* fall through */
+ case 1: k1 ^= tail[ 0] << 0;
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
};
switch(len & 15)
{
- case 15: k2 ^= (uint64_t)(tail[14]) << 48; /* fall through */
- case 14: k2 ^= (uint64_t)(tail[13]) << 40; /* fall through */
- case 13: k2 ^= (uint64_t)(tail[12]) << 32; /* fall through */
- case 12: k2 ^= (uint64_t)(tail[11]) << 24; /* fall through */
- case 11: k2 ^= (uint64_t)(tail[10]) << 16; /* fall through */
- case 10: k2 ^= (uint64_t)(tail[ 9]) << 8; /* fall through */
- case 9: k2 ^= (uint64_t)(tail[ 8]) << 0; /* fall through */
+ case 15: k2 ^= (uint64_t)(tail[14]) << 48;
+ /* fall through */
+ case 14: k2 ^= (uint64_t)(tail[13]) << 40;
+ /* fall through */
+ case 13: k2 ^= (uint64_t)(tail[12]) << 32;
+ /* fall through */
+ case 12: k2 ^= (uint64_t)(tail[11]) << 24;
+ /* fall through */
+ case 11: k2 ^= (uint64_t)(tail[10]) << 16;
+ /* fall through */
+ case 10: k2 ^= (uint64_t)(tail[ 9]) << 8;
+ /* fall through */
+ case 9: k2 ^= (uint64_t)(tail[ 8]) << 0;
k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
- /* fall through */
- case 8: k1 ^= (uint64_t)(tail[ 7]) << 56; /* fall through */
- case 7: k1 ^= (uint64_t)(tail[ 6]) << 48; /* fall through */
- case 6: k1 ^= (uint64_t)(tail[ 5]) << 40; /* fall through */
- case 5: k1 ^= (uint64_t)(tail[ 4]) << 32; /* fall through */
- case 4: k1 ^= (uint64_t)(tail[ 3]) << 24; /* fall through */
- case 3: k1 ^= (uint64_t)(tail[ 2]) << 16; /* fall through */
- case 2: k1 ^= (uint64_t)(tail[ 1]) << 8; /* fall through */
- case 1: k1 ^= (uint64_t)(tail[ 0]) << 0; /* fall through */
+ /* fall through */
+ case 8: k1 ^= (uint64_t)(tail[ 7]) << 56;
+ /* fall through */
+ case 7: k1 ^= (uint64_t)(tail[ 6]) << 48;
+ /* fall through */
+ case 6: k1 ^= (uint64_t)(tail[ 5]) << 40;
+ /* fall through */
+ case 5: k1 ^= (uint64_t)(tail[ 4]) << 32;
+ /* fall through */
+ case 4: k1 ^= (uint64_t)(tail[ 3]) << 24;
+ /* fall through */
+ case 3: k1 ^= (uint64_t)(tail[ 2]) << 16;
+ /* fall through */
+ case 2: k1 ^= (uint64_t)(tail[ 1]) << 8;
+ /* fall through */
+ case 1: k1 ^= (uint64_t)(tail[ 0]) << 0;
k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
};
time_t expiration,
uint32_t flags)
{
- bool retval= true;
std::map<const std::string, std::vector<char> >::const_iterator it= key_value_map.begin();
while (it != key_value_map.end())
{
- retval= set(it->first, it->second, expiration, flags);
- if (retval == false)
+ if (!set(it->first, it->second, expiration, flags))
{
// We should tell the user what the key that failed was
return false;
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="1">
+ <builddir>.cppcheck</builddir>
+ <platform>native</platform>
+ <analyze-all-vs-configs>false</analyze-all-vs-configs>
+ <check-headers>true</check-headers>
+ <check-unused-templates>false</check-unused-templates>
+ <max-ctu-depth>10</max-ctu-depth>
+ <includedir>
+ <dir name="."/>
+ </includedir>
+ <undefines>
+ <undefine>HARD_MALLOC_TEST</undefine>
+ </undefines>
+ <paths>
+ <dir name="."/>
+ </paths>
+ <exclude>
+ <path name=".git"/>
+ <path name=".idea"/>
+ <path name=".settings"/>
+ <path name="docs"/>
+ <path name="libmemcached/csl/parser.cc"/>
+ <path name="libmemcached/csl/scanner.cc"/>
+ <path name="libmemcached/memcached"/>
+ <path name="libtest"/>
+ <path name="tests"/>
+ </exclude>
+</project>
return;
}
- if (error_arg and strcmp(error_arg, "memory exhausted") == 0)
+ if (strcmp(error_arg, "memory exhausted") == 0)
{
(void)memcached_set_error(*memc, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT, memcached_string_make_from_cstr(error_arg));
return;
// We now test if it is something other then a syntax error, if it we
// return a generic message
- if (error_arg and strcmp(error_arg, "syntax error") == 0)
- { }
- else if (error_arg)
+ if (strcmp(error_arg, "syntax error") != 0)
{
memcached_set_parser_error(*memc, MEMCACHED_AT, "Error occured during parsing (%s)", error_arg);
return;
*/
#include <libmemcached/common.h>
-#include <libmemcached/memcached/protocol_binary.h>
memcached_return_t memcached_delete(memcached_st *shell, const char *key, size_t key_length,
time_t expiration)
return MEMCACHED_INVALID_ARGUMENTS;
}
- if (ptr and ptr->error_messages)
+ if (ptr->error_messages)
{
return ptr->error_messages->rc;
}
return MEMCACHED_INVALID_ARGUMENTS;
}
- if (instance and instance->error_messages)
+ if (instance->error_messages)
{
return instance->error_messages->rc;
}
case ENOTCONN: // Programmer Error
WATCHPOINT_ASSERT(0);
+ // fall through
case ENOTSOCK:
WATCHPOINT_ASSERT(0);
+ // fall through
case EBADF:
assert_msg(instance->fd != INVALID_SOCKET, "Programmer error, invalid socket");
/* fall through */
/* fall through */
case ENOTCONN: // Programmer Error
- assert(0);
case ENOTSOCK:
assert(0);
+ /* fall through */
case EBADF:
assert_msg(instance->fd != INVALID_SOCKET, "Invalid socket state");
/* fall through */
* (only the final NOOP), so we need to increment the counter again.
*/
memcached_server_response_increment(instance);
- /* FALLTHROUGH */
+ /* fall through */
case PROTOCOL_BINARY_CMD_GETK:
{
uint16_t keylen= header.response.keylen;
*/
#include <libmemcached/common.h>
-#include <libmemcached/memcached/protocol_binary.h>
static memcached_return_t ascii_touch(memcached_instance_st* instance,
const char *key, size_t key_length,
return false;
}
_addrinfo_next= _addrinfo_next->ai_next;
-
+ /* fall through */
case CONNECT:
close_socket();