then
if test "$ENABLE_DEBUG" = "yes"
then
- CFLAGS="-Wall -ggdb -DMEMCACHED_INTERNAL -DHAVE_DEBUG $CFLAGS"
+ CFLAGS="-W -Wall -Wextra -Wstrict-aliasing -pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -03 -ggdb -DMEMCACHED_INTERNAL -DHAVE_DEBUG $CFLAGS"
else
- CFLAGS="-Wall -O3 -DMEMCACHED_INTERNAL $CFLAGS"
+ CFLAGS="-W -Wall -Wextra -Wstrict-aliasing -pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -O3 -DMEMCACHED_INTERNAL $CFLAGS"
fi
else
CFLAGS="-Xa -xstrconst -mt -D_FORTEC_ $CFLAGS"
#include <sys/un.h>
#include <netinet/tcp.h>
-#if TIME_WITH_SYS_TIME
+#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
-# if HAVE_SYS_TIME_H
+# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
MEM_VERIFY_KEY= (1 << 10),
/* 11 used for weighted ketama */
MEM_KETAMA_WEIGHTED= (1 << 11),
- MEM_BINARY_PROTOCOL= (1 << 12),
+ MEM_BINARY_PROTOCOL= (1 << 12)
} memcached_flags;
/* Hashing algo */
extern "C" {
#endif
-#if _DTRACE_VERSION
+
+#ifdef _DTRACE_VERSION
#define LIBMEMCACHED_MEMCACHED_ADD_END() \
__dtrace_libmemcached___memcached_add_end()
*/
typedef enum {
PROTOCOL_BINARY_REQ = 0x80,
- PROTOCOL_BINARY_RES = 0x81,
+ PROTOCOL_BINARY_RES = 0x81
} protocol_binary_magic;
/**
PROTOCOL_BINARY_RESPONSE_EINVAL = 0x04,
PROTOCOL_BINARY_RESPONSE_NOT_STORED = 0x05,
PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81,
- PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82,
+ PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82
} protocol_binary_response_status;
/**
PROTOCOL_BINARY_CMD_GETKQ = 0x0d,
PROTOCOL_BINARY_CMD_APPEND = 0x0e,
PROTOCOL_BINARY_CMD_PREPEND = 0x0f,
- PROTOCOL_BINARY_CMD_STAT = 0x10,
+ PROTOCOL_BINARY_CMD_STAT = 0x10
} protocol_binary_command;
/**
* See section 3.4 Data Types
*/
typedef enum {
- PROTOCOL_BINARY_RAW_BYTES = 0x00,
+ PROTOCOL_BINARY_RAW_BYTES = 0x00
} protocol_binary_datatypes;
/**
MEMCACHED_TIMEOUT,
MEMCACHED_BUFFERED,
MEMCACHED_BAD_KEY_PROVIDED,
- MEMCACHED_MAXIMUM_RETURN, /* Always add new error code before */
+ MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */
} memcached_return;
typedef enum {
MEMCACHED_DISTRIBUTION_MODULA,
MEMCACHED_DISTRIBUTION_CONSISTENT,
- MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA,
+ MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA
} memcached_server_distribution;
typedef enum {
MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
MEMCACHED_BEHAVIOR_SND_TIMEOUT,
MEMCACHED_BEHAVIOR_RCV_TIMEOUT,
- MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT,
+ MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
} memcached_behavior;
typedef enum {
MEMCACHED_CALLBACK_REALLOC_FUNCTION,
MEMCACHED_CALLBACK_FREE_FUNCTION,
MEMCACHED_CALLBACK_GET_FAILURE,
- MEMCACHED_CALLBACK_DELETE_TRIGGER,
+ MEMCACHED_CALLBACK_DELETE_TRIGGER
} memcached_callback;
typedef enum {
MEMCACHED_HASH_FNV1_32,
MEMCACHED_HASH_FNV1A_32,
MEMCACHED_HASH_HSIEH,
- MEMCACHED_HASH_MURMUR,
+ MEMCACHED_HASH_MURMUR
} memcached_hash;
typedef enum {
MEMCACHED_CONNECTION_UNKNOWN,
MEMCACHED_CONNECTION_TCP,
MEMCACHED_CONNECTION_UDP,
- MEMCACHED_CONNECTION_UNIX_SOCKET,
+ MEMCACHED_CONNECTION_UNIX_SOCKET
} memcached_connection;
typedef enum {
MEMCACHED_NOT_ALLOCATED,
MEMCACHED_ALLOCATED,
- MEMCACHED_USED,
+ MEMCACHED_USED
} memcached_allocated;
static int continuum_item_cmp(const void *t1, const void *t2)
{
- memcached_continuum_item_st *ct1 = (memcached_continuum_item_st *)t1;
- memcached_continuum_item_st *ct2 = (memcached_continuum_item_st *)t2;
+ memcached_continuum_item_st *ct1= (memcached_continuum_item_st *)t1;
+ memcached_continuum_item_st *ct2= (memcached_continuum_item_st *)t2;
+ /* Why 153? Hmmm... */
WATCHPOINT_ASSERT(ct1->value != 153);
if (ct1->value == ct2->value)
return 0;
pointer_counter+= pointer_per_server;
}
+ WATCHPOINT_ASSERT(ptr);
+ WATCHPOINT_ASSERT(ptr->continuum);
+ WATCHPOINT_ASSERT(ptr->number_of_hosts);
WATCHPOINT_ASSERT(ptr->number_of_hosts * MEMCACHED_POINTS_PER_SERVER <= MEMCACHED_CONTINUUM_SIZE);
qsort(ptr->continuum, ptr->number_of_hosts * MEMCACHED_POINTS_PER_SERVER, sizeof(memcached_continuum_item_st), continuum_item_cmp);