summary |
shortlog |
log |
commit | commitdiff |
tree |
github
raw |
patch |
inline | side by side (from parent 1:
87cd906)
It's not supported by all compilers, and they will most likely
spit out a warning about an unknown attribute. Since we're
treating warnings as errors this stops the compilation..
20 files changed:
static char *opt_passwd;
/* Print the keys and counter how many were found */
static char *opt_passwd;
/* Print the keys and counter how many were found */
-static memcached_return_t key_printer(const memcached_st *ptr __attribute__((unused)),
+static memcached_return_t key_printer(const memcached_st *ptr,
const char *key, size_t key_length,
const char *key, size_t key_length,
- void *context __attribute__((unused)))
+ (void)ptr;(void)context;
printf("%.*s\n", (uint32_t)key_length, key);
return MEMCACHED_SUCCESS;
printf("%.*s\n", (uint32_t)key_length, key);
return MEMCACHED_SUCCESS;
void help_command(const char *command_name, const char *description,
const struct option *long_options,
void help_command(const char *command_name, const char *description,
const struct option *long_options,
- memcached_programs_help_st *options __attribute__((unused)))
+ memcached_programs_help_st *options)
printf("%s v%u.%u\n\n", command_name, 1U, 0U);
printf("\t%s\n\n", description);
printf("%s v%u.%u\n\n", command_name, 1U, 0U);
printf("\t%s\n\n", description);
#define closesocket(a) close(a)
#define get_socket_errno() errno
#endif
#define closesocket(a) close(a)
#define get_socket_errno() errno
#endif
/**
* Print out the command we are about to execute
*/
/**
* Print out the command we are about to execute
*/
-static void pre_execute(const void *cookie __attribute__((unused)),
- protocol_binary_request_header *header __attribute__((unused)))
+static void pre_execute(const void *cookie,
+ protocol_binary_request_header *header)
/**
* Print out the command we just executed
*/
/**
* Print out the command we just executed
*/
-static void post_execute(const void *cookie __attribute__((unused)),
- protocol_binary_request_header *header __attribute__((unused)))
+static void post_execute(const void *cookie,
+ protocol_binary_request_header *header)
-void release_item(struct item* item __attribute__((unused)))
+void release_item(struct item* item)
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
};
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
};
-uint32_t hashkit_crc32(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_crc32(const char *key, size_t key_length, void *context)
{
uint64_t x;
uint32_t crc= UINT32_MAX;
{
uint64_t x;
uint32_t crc= UINT32_MAX;
for (x= 0; x < key_length; x++)
crc= (crc >> 8) ^ crc32tab[(crc ^ (uint64_t)key[x]) & 0xff];
for (x= 0; x < key_length; x++)
crc= (crc >> 8) ^ crc32tab[(crc ^ (uint64_t)key[x]) & 0xff];
static uint32_t FNV_32_INIT= 2166136261UL;
static uint32_t FNV_32_PRIME= 16777619;
static uint32_t FNV_32_INIT= 2166136261UL;
static uint32_t FNV_32_PRIME= 16777619;
-uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context)
{
/* Thanks to pierre@demartines.com for the pointer */
uint64_t hash= FNV_64_INIT;
{
/* Thanks to pierre@demartines.com for the pointer */
uint64_t hash= FNV_64_INIT;
for (size_t x= 0; x < key_length; x++)
{
for (size_t x= 0; x < key_length; x++)
{
-uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context)
{
uint32_t hash= (uint32_t) FNV_64_INIT;
{
uint32_t hash= (uint32_t) FNV_64_INIT;
for (size_t x= 0; x < key_length; x++)
{
for (size_t x= 0; x < key_length; x++)
{
-uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context)
{
uint32_t hash= FNV_32_INIT;
{
uint32_t hash= FNV_32_INIT;
for (size_t x= 0; x < key_length; x++)
{
for (size_t x= 0; x < key_length; x++)
{
-uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void *context)
{
uint32_t hash= FNV_32_INIT;
{
uint32_t hash= FNV_32_INIT;
for (size_t x= 0; x < key_length; x++)
{
for (size_t x= 0; x < key_length; x++)
{
In which case, the hash table should have hashsize(10) elements.
*/
In which case, the hash table should have hashsize(10) elements.
*/
-uint32_t hashkit_jenkins(const char *key, size_t length, void *context __attribute__((unused)))
+uint32_t hashkit_jenkins(const char *key, size_t length, void *context)
{
uint32_t a,b,c; /* internal state */
union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */
{
uint32_t a,b,c; /* internal state */
union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */
/* Set up the internal state */
a = b = c = 0xdeadbeef + ((uint32_t)length) + JENKINS_INITVAL;
/* Set up the internal state */
a = b = c = 0xdeadbeef + ((uint32_t)length) + JENKINS_INITVAL;
}
/*----------------------------- handle the last (probably partial) block */
}
/*----------------------------- handle the last (probably partial) block */
* "k[2]&0xffffff" actually reads beyond the end of the string, but
* then masks off the part it's not allowed to read. Because the
* string is aligned, the masked-off tail is in the same word as the
* "k[2]&0xffffff" actually reads beyond the end of the string, but
* then masks off the part it's not allowed to read. Because the
* string is aligned, the masked-off tail is in the same word as the
else if ((u.i & 0x1) == 0)
{
const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */
else if ((u.i & 0x1) == 0)
{
const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */
else
{ /* need to read the key one byte at a time */
#endif /* little endian */
else
{ /* need to read the key one byte at a time */
#endif /* little endian */
- This Library has been modified from its original form by
+ This Library has been modified from its original form by
Brian Aker (brian@tangent.org)
See below for original Copyright.
Brian Aker (brian@tangent.org)
See below for original Copyright.
Just a simple method for getting the signature
result must be == 16
*/
Just a simple method for getting the signature
result must be == 16
*/
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}
-uint32_t hashkit_md5(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_md5(const char *key, size_t key_length, void *context)
{
unsigned char results[16];
{
unsigned char results[16];
md5_signature((unsigned char*)key, (unsigned int)key_length, results);
md5_signature((unsigned char*)key, (unsigned int)key_length, results);
"Murmur" hash provided by Austin, tanjent@gmail.com
http://murmurhash.googlepages.com/
"Murmur" hash provided by Austin, tanjent@gmail.com
http://murmurhash.googlepages.com/
-uint32_t hashkit_murmur(const char *key, size_t length, void *context __attribute__((unused)))
+uint32_t hashkit_murmur(const char *key, size_t length, void *context)
'm' and 'r' are mixing constants generated offline. They're not
really 'magic', they just happen to work well.
*/
'm' and 'r' are mixing constants generated offline. They're not
really 'magic', they just happen to work well.
*/
// Mix 4 bytes at a time into the hash
const unsigned char * data= (const unsigned char *)key;
// Mix 4 bytes at a time into the hash
const unsigned char * data= (const unsigned char *)key;
while(length >= 4)
{
unsigned int k = *(unsigned int *)data;
while(length >= 4)
{
unsigned int k = *(unsigned int *)data;
- k *= m;
- k ^= k >> r;
- k *= m;
+ k *= m;
+ k ^= k >> r;
+ k *= m;
Do a few final mixes of the hash to ensure the last few bytes are
Do a few final mixes of the hash to ensure the last few bytes are
-uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void *context)
{
const char *ptr= key;
uint32_t value= 0;
{
const char *ptr= key;
uint32_t value= 0;
-const char *hashkit_strerror(hashkit_st *ptr __attribute__((unused)), hashkit_return_t rc)
+const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc)
switch (rc)
{
case HASHKIT_SUCCESS:
switch (rc)
{
case HASHKIT_SUCCESS:
strcmp("reclaimed", key) == 0))
{
WATCHPOINT_STRING(key);
strcmp("reclaimed", key) == 0))
{
WATCHPOINT_STRING(key);
- return MEMCACHED_UNKNOWN_STAT_KEY;
+ /* return MEMCACHED_UNKNOWN_STAT_KEY; */
+ return MEMCACHED_SUCCESS;
}
return MEMCACHED_SUCCESS;
}
return MEMCACHED_SUCCESS;
}
memcached_return_t memcached_set_by_key(memcached_st *ptr,
}
memcached_return_t memcached_set_by_key(memcached_st *ptr,
- const char *master_key __attribute__((unused)),
- size_t master_key_length __attribute__((unused)),
+ const char *master_key,
+ size_t master_key_length,
const char *key, size_t key_length,
const char *value, size_t value_length,
time_t expiration,
const char *key, size_t key_length,
const char *value, size_t value_length,
time_t expiration,
-const char *memcached_strerror(memcached_st *ptr __attribute__((unused)), memcached_return_t rc)
+const char *memcached_strerror(memcached_st *ptr, memcached_return_t rc)
switch (rc)
{
case MEMCACHED_SUCCESS:
switch (rc)
{
case MEMCACHED_SUCCESS:
-static memcached_return_t check_server_version(const memcached_st *ptr __attribute__((unused)),
+static memcached_return_t check_server_version(const memcached_st *ptr,
const memcached_server_st *instance,
void *context)
{
/* Do Nothing */
struct local_context *check= (struct local_context *)context;
const memcached_server_st *instance,
void *context)
{
/* Do Nothing */
struct local_context *check= (struct local_context *)context;
if (instance->major_version != UINT8_MAX &&
instance->major_version >= check->major_version &&
if (instance->major_version != UINT8_MAX &&
instance->major_version >= check->major_version &&
return MEMCACHED_FAILURE;
}
return MEMCACHED_FAILURE;
}
-bool libmemcached_util_version_check(memcached_st *memc,
+bool libmemcached_util_version_check(memcached_st *memc,
uint8_t major_version,
uint8_t minor_version,
uint8_t micro_version)
uint8_t major_version,
uint8_t minor_version,
uint8_t micro_version)
{
size_t length;
const char *buffer;
};
{
size_t length;
const char *buffer;
};
-static memcached_return_t _set_verbosity(const memcached_st *ptr __attribute__((unused)),
+static memcached_return_t _set_verbosity(const memcached_st *ptr,
const memcached_server_st *server,
void *context)
{
const memcached_server_st *server,
void *context)
{
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
struct context_st *execute= (struct context_st *)context;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
struct context_st *execute= (struct context_st *)context;
memc_ptr= memcached_create(&local_memc);
memc_ptr= memcached_create(&local_memc);
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
+ send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
"verbosity %u\r\n", verbosity);
if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE || send_length < 0)
return MEMCACHED_WRITE_FAILURE;
"verbosity %u\r\n", verbosity);
if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE || send_length < 0)
return MEMCACHED_WRITE_FAILURE;
static char *global_keys[GLOBAL_COUNT];
static size_t global_keys_length[GLOBAL_COUNT];
static char *global_keys[GLOBAL_COUNT];
static size_t global_keys_length[GLOBAL_COUNT];
-static test_return_t cleanup_pairs(memcached_st *memc __attribute__((unused)))
+static test_return_t cleanup_pairs(memcached_st *memc)
pairs_free(global_pairs);
return 0;
}
pairs_free(global_pairs);
return 0;
}
-static test_return_t generate_pairs(memcached_st *memc __attribute__((unused)))
+static test_return_t generate_pairs(memcached_st *memc)
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
global_count= GLOBAL_COUNT;
for (size_t x= 0; x < global_count; x++)
{
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
global_count= GLOBAL_COUNT;
for (size_t x= 0; x < global_count; x++)
{
- global_keys[x]= global_pairs[x].key;
+ global_keys[x]= global_pairs[x].key;
global_keys_length[x]= global_pairs[x].key_length;
}
global_keys_length[x]= global_pairs[x].key_length;
}
WATCHPOINT_ERROR(rc);
WATCHPOINT_ASSERT(rc);
}
WATCHPOINT_ERROR(rc);
WATCHPOINT_ASSERT(rc);
}
- rc= memcached_set(memc, global_pairs[test_bit].key,
+ rc= memcached_set(memc, global_pairs[test_bit].key,
global_pairs[test_bit].key_length,
global_pairs[test_bit].key_length,
- global_pairs[test_bit].value,
+ global_pairs[test_bit].value,
global_pairs[test_bit].value_length,
0, 0);
if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_BUFFERED)
global_pairs[test_bit].value_length,
0, 0);
if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_BUFFERED)
Set the value, then quit to make sure it is flushed.
Come back in and test that add fails.
*/
Set the value, then quit to make sure it is flushed.
Come back in and test that add fails.
*/
setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK);
setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK);
- rc= memcached_set(memc, key, strlen(key),
+ rc= memcached_set(memc, key, strlen(key),
value, strlen(value),
(time_t)0, (uint32_t)0);
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
memcached_quit(memc);
value, strlen(value),
(time_t)0, (uint32_t)0);
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
memcached_quit(memc);
- rc= memcached_add(memc, key, strlen(key),
+ rc= memcached_add(memc, key, strlen(key),
value, strlen(value),
(time_t)0, (uint32_t)0);
value, strlen(value),
(time_t)0, (uint32_t)0);
memcached_st *clone;
} benchmark_state;
memcached_st *clone;
} benchmark_state;
-static test_return_t memcached_create_benchmark(memcached_st *memc __attribute__((unused)))
+static test_return_t memcached_create_benchmark(memcached_st *memc)
benchmark_state.create_init= true;
for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
benchmark_state.create_init= true;
for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
-static test_return_t pre_allocate(memcached_st *memc __attribute__((unused)))
+static test_return_t pre_allocate(memcached_st *memc)
memset(&benchmark_state, 0, sizeof(benchmark_state));
benchmark_state.create= (memcached_st *)calloc(BENCHMARK_TEST_LOOP, sizeof(memcached_st));
memset(&benchmark_state, 0, sizeof(benchmark_state));
benchmark_state.create= (memcached_st *)calloc(BENCHMARK_TEST_LOOP, sizeof(memcached_st));
-static test_return_t post_allocate(memcached_st *memc __attribute__((unused)))
+static test_return_t post_allocate(memcached_st *memc)
for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
{
if (benchmark_state.create_init)
for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
{
if (benchmark_state.create_init)
-static test_return_t init_test(void *not_used __attribute__((unused)))
+static test_return_t init_test(void *not_used)
{
hashkit_st hashk;
hashkit_st *hashk_ptr;
{
hashkit_st hashk;
hashkit_st *hashk_ptr;
hashk_ptr= hashkit_create(&hashk);
test_true(hashk_ptr);
hashk_ptr= hashkit_create(&hashk);
test_true(hashk_ptr);
-static test_return_t allocation_test(void *not_used __attribute__((unused)))
+static test_return_t allocation_test(void *not_used)
hashk_ptr= hashkit_create(NULL);
test_true(hashk_ptr);
hashk_ptr= hashkit_create(NULL);
test_true(hashk_ptr);
-static test_return_t one_at_a_time_run (hashkit_st *hashk __attribute__((unused)))
+static test_return_t one_at_a_time_run (hashkit_st *hashk)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t md5_run (hashkit_st *hashk __attribute__((unused)))
+static test_return_t md5_run (hashkit_st *hashk)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t crc_run (hashkit_st *hashk __attribute__((unused)))
+static test_return_t crc_run (hashkit_st *hashk)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t fnv1_64_run (hashkit_st *hashk __attribute__((unused)))
+static test_return_t fnv1_64_run (hashkit_st *hashk)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t fnv1a_64_run (hashkit_st *hashk __attribute__((unused)))
+static test_return_t fnv1a_64_run (hashkit_st *hashk)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t fnv1_32_run (hashkit_st *hashk __attribute__((unused)))
+static test_return_t fnv1_32_run (hashkit_st *hashk)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t fnv1a_32_run (hashkit_st *hashk __attribute__((unused)))
+static test_return_t fnv1a_32_run (hashkit_st *hashk)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t hsieh_run (hashkit_st *hashk __attribute__((unused)))
+static test_return_t hsieh_run (hashkit_st *hashk)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t murmur_run (hashkit_st *hashk __attribute__((unused)))
+static test_return_t murmur_run (hashkit_st *hashk)
#ifdef WORDS_BIGENDIAN
return TEST_SKIPPED;
#else
#ifdef WORDS_BIGENDIAN
return TEST_SKIPPED;
#else
-static test_return_t jenkins_run (hashkit_st *hashk __attribute__((unused)))
+static test_return_t jenkins_run (hashkit_st *hashk)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
static test_return_t hashkit_set_function_test(hashkit_st *hashk)
{
static test_return_t hashkit_set_function_test(hashkit_st *hashk)
{
- for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++)
+ for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++)
{
hashkit_return_t rc;
uint32_t x;
{
hashkit_return_t rc;
uint32_t x;
static test_return_t hashkit_set_distribution_function_test(hashkit_st *hashk)
{
static test_return_t hashkit_set_distribution_function_test(hashkit_st *hashk)
{
- for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++)
+ for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++)
static test_return_t hashkit_get_function_test(hashkit_st *hashk)
{
static test_return_t hashkit_get_function_test(hashkit_st *hashk)
{
- for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++)
+ for (hashkit_hash_algorithm_t algo = HASHKIT_HASH_DEFAULT; algo < HASHKIT_HASH_MAX; algo++)
static test_return_t pre_binary(memcached_st *memc);
static test_return_t pre_binary(memcached_st *memc);
-static test_return_t init_test(memcached_st *not_used __attribute__((unused)))
+static test_return_t init_test(memcached_st *not_used)
(void)memcached_create(&memc);
memcached_free(&memc);
(void)memcached_create(&memc);
memcached_free(&memc);
-static test_return_t server_list_null_test(memcached_st *ptr __attribute__((unused)))
+static test_return_t server_list_null_test(memcached_st *ptr)
{
memcached_server_st *server_list;
memcached_return_t rc;
{
memcached_server_st *server_list;
memcached_return_t rc;
server_list= memcached_server_list_append_with_weight(NULL, NULL, 0, 0, NULL);
test_true(server_list == NULL);
server_list= memcached_server_list_append_with_weight(NULL, NULL, 0, 0, NULL);
test_true(server_list == NULL);
#define TEST_PORT_COUNT 7
in_port_t test_ports[TEST_PORT_COUNT];
#define TEST_PORT_COUNT 7
in_port_t test_ports[TEST_PORT_COUNT];
-static memcached_return_t server_display_function(const memcached_st *ptr __attribute__((unused)),
+static memcached_return_t server_display_function(const memcached_st *ptr,
const memcached_server_st *server,
void *context)
{
/* Do Nothing */
size_t bigger= *((size_t *)(context));
const memcached_server_st *server,
void *context)
{
/* Do Nothing */
size_t bigger= *((size_t *)(context));
assert(bigger <= memcached_server_port(server));
*((size_t *)(context))= memcached_server_port(server);
return MEMCACHED_SUCCESS;
}
assert(bigger <= memcached_server_port(server));
*((size_t *)(context))= memcached_server_port(server);
return MEMCACHED_SUCCESS;
}
-static memcached_return_t dump_server_information(const memcached_st *ptr __attribute__((unused)),
+static memcached_return_t dump_server_information(const memcached_st *ptr,
const memcached_server_st *instance,
void *context)
{
/* Do Nothing */
FILE *stream= (FILE *)context;
const memcached_server_st *instance,
void *context)
{
/* Do Nothing */
FILE *stream= (FILE *)context;
- fprintf(stream, "Memcached Server: %s %u Version %u.%u.%u\n",
+ fprintf(stream, "Memcached Server: %s %u Version %u.%u.%u\n",
memcached_server_name(instance),
memcached_server_port(instance),
instance->major_version,
memcached_server_name(instance),
memcached_server_port(instance),
instance->major_version,
return MEMCACHED_SUCCESS;
}
return MEMCACHED_SUCCESS;
}
-static test_return_t server_sort_test(memcached_st *ptr __attribute__((unused)))
+static test_return_t server_sort_test(memcached_st *ptr)
{
size_t bigger= 0; /* Prime the value for the test_true in server_display_function */
memcached_return_t rc;
memcached_server_fn callbacks[1];
memcached_st *local_memc;
{
size_t bigger= 0; /* Prime the value for the test_true in server_display_function */
memcached_return_t rc;
memcached_server_fn callbacks[1];
memcached_st *local_memc;
local_memc= memcached_create(NULL);
test_true(local_memc);
local_memc= memcached_create(NULL);
test_true(local_memc);
-static test_return_t server_sort2_test(memcached_st *ptr __attribute__((unused)))
+static test_return_t server_sort2_test(memcached_st *ptr)
{
size_t bigger= 0; /* Prime the value for the test_true in server_display_function */
memcached_return_t rc;
memcached_server_fn callbacks[1];
memcached_st *local_memc;
memcached_server_instance_st instance;
{
size_t bigger= 0; /* Prime the value for the test_true in server_display_function */
memcached_return_t rc;
memcached_server_fn callbacks[1];
memcached_st *local_memc;
memcached_server_instance_st instance;
local_memc= memcached_create(NULL);
test_true(local_memc);
local_memc= memcached_create(NULL);
test_true(local_memc);
-static memcached_return_t server_print_callback(const memcached_st *ptr __attribute__((unused)),
+static memcached_return_t server_print_callback(const memcached_st *ptr,
const memcached_server_st *server,
const memcached_server_st *server,
- void *context __attribute__((unused)))
{
(void)server; // Just in case we aren't printing.
{
(void)server; // Just in case we aren't printing.
+ (void)ptr;
+ (void)context;
#if 0
fprintf(stderr, "%s(%d)", memcached_server_name(server), memcached_server_port(server));
#if 0
fprintf(stderr, "%s(%d)", memcached_server_name(server), memcached_server_port(server));
return MEMCACHED_SUCCESS;
}
return MEMCACHED_SUCCESS;
}
-static test_return_t memcached_server_remove_test(memcached_st *ptr __attribute__((unused)))
+static test_return_t memcached_server_remove_test(memcached_st *ptr)
{
memcached_return_t rc;
memcached_st local_memc;
{
memcached_return_t rc;
memcached_st local_memc;
memcached_server_fn callbacks[1];
const char *server_string= "localhost:4444, localhost:4445, localhost:4446, localhost:4447, localhost, memcache1.memcache.bk.sapo.pt:11211, memcache1.memcache.bk.sapo.pt:11212, memcache1.memcache.bk.sapo.pt:11213, memcache1.memcache.bk.sapo.pt:11214, memcache2.memcache.bk.sapo.pt:11211, memcache2.memcache.bk.sapo.pt:11212, memcache2.memcache.bk.sapo.pt:11213, memcache2.memcache.bk.sapo.pt:11214";
memcached_server_fn callbacks[1];
const char *server_string= "localhost:4444, localhost:4445, localhost:4446, localhost:4447, localhost, memcache1.memcache.bk.sapo.pt:11211, memcache1.memcache.bk.sapo.pt:11212, memcache1.memcache.bk.sapo.pt:11213, memcache1.memcache.bk.sapo.pt:11214, memcache2.memcache.bk.sapo.pt:11211, memcache2.memcache.bk.sapo.pt:11212, memcache2.memcache.bk.sapo.pt:11213, memcache2.memcache.bk.sapo.pt:11214";
memc= memcached_create(&local_memc);
memc= memcached_create(&local_memc);
-static memcached_return_t server_display_unsort_function(const memcached_st *ptr __attribute__((unused)),
+static memcached_return_t server_display_unsort_function(const memcached_st *ptr,
const memcached_server_st *server,
void *context)
{
/* Do Nothing */
uint32_t x= *((uint32_t *)(context));
const memcached_server_st *server,
void *context)
{
/* Do Nothing */
uint32_t x= *((uint32_t *)(context));
assert(test_ports[x] == server->port);
*((uint32_t *)(context))= ++x;
assert(test_ports[x] == server->port);
*((uint32_t *)(context))= ++x;
return MEMCACHED_SUCCESS;
}
return MEMCACHED_SUCCESS;
}
-static test_return_t server_unsort_test(memcached_st *ptr __attribute__((unused)))
+static test_return_t server_unsort_test(memcached_st *ptr)
{
size_t counter= 0; /* Prime the value for the test_true in server_display_function */
size_t bigger= 0; /* Prime the value for the test_true in server_display_function */
memcached_return_t rc;
memcached_server_fn callbacks[1];
memcached_st *local_memc;
{
size_t counter= 0; /* Prime the value for the test_true in server_display_function */
size_t bigger= 0; /* Prime the value for the test_true in server_display_function */
memcached_return_t rc;
memcached_server_fn callbacks[1];
memcached_st *local_memc;
local_memc= memcached_create(NULL);
test_true(local_memc);
local_memc= memcached_create(NULL);
test_true(local_memc);
-static test_return_t allocation_test(memcached_st *not_used __attribute__((unused)))
+static test_return_t allocation_test(memcached_st *not_used)
memcached_st *memc;
memc= memcached_create(NULL);
test_true(memc);
memcached_st *memc;
memc= memcached_create(NULL);
test_true(memc);
-static memcached_return_t server_function(const memcached_st *ptr __attribute__((unused)),
- const memcached_server_st *server __attribute__((unused)),
- void *context __attribute__((unused)))
+static memcached_return_t server_function(const memcached_st *ptr,
+ const memcached_server_st *server,
+ void *context)
+ (void)ptr; (void)server; (void)context;
/* Do Nothing */
return MEMCACHED_SUCCESS;
/* Do Nothing */
return MEMCACHED_SUCCESS;
}
#define READ_THROUGH_VALUE "set for me"
}
#define READ_THROUGH_VALUE "set for me"
-static memcached_return_t read_through_trigger(memcached_st *memc __attribute__((unused)),
- char *key __attribute__((unused)),
- size_t key_length __attribute__((unused)),
+static memcached_return_t read_through_trigger(memcached_st *memc,
+ char *key,
+ size_t key_length,
memcached_result_st *result)
{
memcached_result_st *result)
{
+ (void)memc;(void)key;(void)key_length;
return memcached_result_set_value(result, READ_THROUGH_VALUE, strlen(READ_THROUGH_VALUE));
}
return memcached_result_set_value(result, READ_THROUGH_VALUE, strlen(READ_THROUGH_VALUE));
}
-static memcached_return_t delete_trigger(memcached_st *ptr __attribute__((unused)),
+static memcached_return_t delete_trigger(memcached_st *ptr,
- size_t key_length __attribute__((unused)))
+ (void)ptr;(void)key_length;
assert(key);
return MEMCACHED_SUCCESS;
assert(key);
return MEMCACHED_SUCCESS;
}
/* Count the results */
}
/* Count the results */
-static memcached_return_t callback_counter(const memcached_st *ptr __attribute__((unused)),
- memcached_result_st *result __attribute__((unused)),
+static memcached_return_t callback_counter(const memcached_st *ptr,
+ memcached_result_st *result,
+ (void)ptr; (void)result;
size_t *counter= (size_t *)context;
*counter= *counter + 1;
size_t *counter= (size_t *)context;
*counter= *counter + 1;
-static test_return_t version_string_test(memcached_st *memc __attribute__((unused)))
+static test_return_t version_string_test(memcached_st *memc)
{
const char *version_string;
{
const char *version_string;
version_string= memcached_lib_version();
version_string= memcached_lib_version();
-static memcached_return_t clone_test_callback(memcached_st *parent __attribute__((unused)), memcached_st *memc_clone __attribute__((unused)))
+static memcached_return_t clone_test_callback(memcached_st *parent, memcached_st *memc_clone)
+ (void)parent;(void)memc_clone;
return MEMCACHED_SUCCESS;
}
return MEMCACHED_SUCCESS;
}
-static memcached_return_t cleanup_test_callback(memcached_st *ptr __attribute__((unused)))
+static memcached_return_t cleanup_test_callback(memcached_st *ptr)
return MEMCACHED_SUCCESS;
}
return MEMCACHED_SUCCESS;
}
-static test_return_t user_supplied_bug8(memcached_st *memc __attribute__((unused)))
+static test_return_t user_supplied_bug8(memcached_st *memc)
{
memcached_return_t rc;
memcached_st *mine;
{
memcached_return_t rc;
memcached_st *mine;
memcached_server_st *servers;
const char *server_list= "memcache1.memcache.bk.sapo.pt:11211, memcache1.memcache.bk.sapo.pt:11212, memcache1.memcache.bk.sapo.pt:11213, memcache1.memcache.bk.sapo.pt:11214, memcache2.memcache.bk.sapo.pt:11211, memcache2.memcache.bk.sapo.pt:11212, memcache2.memcache.bk.sapo.pt:11213, memcache2.memcache.bk.sapo.pt:11214";
memcached_server_st *servers;
const char *server_list= "memcache1.memcache.bk.sapo.pt:11211, memcache1.memcache.bk.sapo.pt:11212, memcache1.memcache.bk.sapo.pt:11213, memcache1.memcache.bk.sapo.pt:11214, memcache2.memcache.bk.sapo.pt:11211, memcache2.memcache.bk.sapo.pt:11212, memcache2.memcache.bk.sapo.pt:11213, memcache2.memcache.bk.sapo.pt:11214";
servers= memcached_servers_parse(server_list);
test_true(servers);
servers= memcached_servers_parse(server_list);
test_true(servers);
*/
/* sighandler_t function that always asserts false */
*/
/* sighandler_t function that always asserts false */
-static void fail(int unused __attribute__((unused)))
+static void fail(int unused)
-static test_return_t cleanup_pairs(memcached_st *memc __attribute__((unused)))
+static test_return_t cleanup_pairs(memcached_st *memc)
pairs_free(global_pairs);
return TEST_SUCCESS;
}
pairs_free(global_pairs);
return TEST_SUCCESS;
}
-static test_return_t generate_pairs(memcached_st *memc __attribute__((unused)))
+static test_return_t generate_pairs(memcached_st *memc)
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
global_count= GLOBAL_COUNT;
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
global_count= GLOBAL_COUNT;
-static test_return_t generate_large_pairs(memcached_st *memc __attribute__((unused)))
+static test_return_t generate_large_pairs(memcached_st *memc)
global_pairs= pairs_generate(GLOBAL2_COUNT, MEMCACHED_MAX_BUFFER+10);
global_count= GLOBAL2_COUNT;
global_pairs= pairs_generate(GLOBAL2_COUNT, MEMCACHED_MAX_BUFFER+10);
global_count= GLOBAL2_COUNT;
-static void my_free(const memcached_st *ptr __attribute__((unused)), void *mem, void *context)
+static void my_free(const memcached_st *ptr, void *mem, void *context)
+ (void)context;
+ (void)ptr;
#ifdef HARD_MALLOC_TESTS
void *real_ptr= (mem == NULL) ? mem : (void*)((caddr_t)mem - 8);
free(real_ptr);
#ifdef HARD_MALLOC_TESTS
void *real_ptr= (mem == NULL) ? mem : (void*)((caddr_t)mem - 8);
free(real_ptr);
-static void *my_malloc(const memcached_st *ptr __attribute__((unused)), const size_t size, void *context)
+static void *my_malloc(const memcached_st *ptr, const size_t size, void *context)
#ifdef HARD_MALLOC_TESTS
void *ret= malloc(size + 8);
if (ret != NULL)
#ifdef HARD_MALLOC_TESTS
void *ret= malloc(size + 8);
if (ret != NULL)
-static void *my_realloc(const memcached_st *ptr __attribute__((unused)), void *mem, const size_t size, void *context)
+static void *my_realloc(const memcached_st *ptr, void *mem, const size_t size, void *context)
{
(void)context;
#ifdef HARD_MALLOC_TESTS
{
(void)context;
#ifdef HARD_MALLOC_TESTS
return realloc(mem, size);
#endif
}
return realloc(mem, size);
#endif
}
-static void *my_calloc(const memcached_st *ptr __attribute__((unused)), size_t nelem, const size_t size, void *context)
+static void *my_calloc(const memcached_st *ptr, size_t nelem, const size_t size, void *context)
{
(void)context;
#ifdef HARD_MALLOC_TESTS
{
(void)context;
#ifdef HARD_MALLOC_TESTS
return calloc(nelem, size);
#endif
}
return calloc(nelem, size);
#endif
}
}
/* Count the objects */
}
/* Count the objects */
-static memcached_return_t callback_dump_counter(const memcached_st *ptr __attribute__((unused)),
- const char *key __attribute__((unused)),
- size_t key_length __attribute__((unused)),
+static memcached_return_t callback_dump_counter(const memcached_st *ptr,
+ const char *key,
+ size_t key_length,
+ (void)ptr; (void)key; (void)key_length;
size_t *counter= (size_t *)context;
*counter= *counter + 1;
size_t *counter= (size_t *)context;
*counter= *counter + 1;
-static test_return_t one_at_a_time_run (memcached_st *memc __attribute__((unused)))
+static test_return_t one_at_a_time_run (memcached_st *memc)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t md5_run (memcached_st *memc __attribute__((unused)))
+static test_return_t md5_run (memcached_st *memc)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t crc_run (memcached_st *memc __attribute__((unused)))
+static test_return_t crc_run (memcached_st *memc)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t fnv1_64_run (memcached_st *memc __attribute__((unused)))
+static test_return_t fnv1_64_run (memcached_st *memc)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t fnv1a_64_run (memcached_st *memc __attribute__((unused)))
+static test_return_t fnv1a_64_run (memcached_st *memc)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t fnv1_32_run (memcached_st *memc __attribute__((unused)))
+static test_return_t fnv1_32_run (memcached_st *memc)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t fnv1a_32_run (memcached_st *memc __attribute__((unused)))
+static test_return_t fnv1a_32_run (memcached_st *memc)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t hsieh_run (memcached_st *memc __attribute__((unused)))
+static test_return_t hsieh_run (memcached_st *memc)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t murmur_run (memcached_st *memc __attribute__((unused)))
+static test_return_t murmur_run (memcached_st *memc)
{
#ifdef WORDS_BIGENDIAN
return TEST_SKIPPED;
#else
uint32_t x;
const char **ptr;
{
#ifdef WORDS_BIGENDIAN
return TEST_SKIPPED;
#else
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
-static test_return_t jenkins_run (memcached_st *memc __attribute__((unused)))
+static test_return_t jenkins_run (memcached_st *memc)
{
uint32_t x;
const char **ptr;
{
uint32_t x;
const char **ptr;
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++)
{
- Test case adapted from John Gorman <johngorman2@gmail.com>
+ Test case adapted from John Gorman <johngorman2@gmail.com>
- We are testing the error condition when we connect to a server via memcached_get()
+ We are testing the error condition when we connect to a server via memcached_get()
but find that the server is not available.
*/
static test_return_t memcached_get_MEMCACHED_ERRNO(memcached_st *memc)
but find that the server is not available.
*/
static test_return_t memcached_get_MEMCACHED_ERRNO(memcached_st *memc)
We connect to a server which exists, but search for a key that does not exist.
*/
static test_return_t memcached_get_MEMCACHED_NOTFOUND(memcached_st *memc)
We connect to a server which exists, but search for a key that does not exist.
*/
static test_return_t memcached_get_MEMCACHED_NOTFOUND(memcached_st *memc)
- Test case adapted from John Gorman <johngorman2@gmail.com>
+ Test case adapted from John Gorman <johngorman2@gmail.com>
- We are testing the error condition when we connect to a server via memcached_get_by_key()
+ We are testing the error condition when we connect to a server via memcached_get_by_key()
but find that the server is not available.
*/
static test_return_t memcached_get_by_key_MEMCACHED_ERRNO(memcached_st *memc)
but find that the server is not available.
*/
static test_return_t memcached_get_by_key_MEMCACHED_ERRNO(memcached_st *memc)
We connect to a server which exists, but search for a key that does not exist.
*/
static test_return_t memcached_get_by_key_MEMCACHED_NOTFOUND(memcached_st *memc)
We connect to a server which exists, but search for a key that does not exist.
*/
static test_return_t memcached_get_by_key_MEMCACHED_NOTFOUND(memcached_st *memc)
static test_return_t regression_bug_463297(memcached_st *memc)
{
static test_return_t regression_bug_463297(memcached_st *memc)
{
- memcached_st *memc_clone= memcached_clone(NULL, memc);
- test_true(memc_clone != NULL);
- test_true(memcached_version(memc_clone) == MEMCACHED_SUCCESS);
+ memcached_st *memc_clone= memcached_clone(NULL, memc);
+ test_true(memc_clone != NULL);
+ test_true(memcached_version(memc_clone) == MEMCACHED_SUCCESS);
- memcached_server_instance_st instance=
- memcached_server_instance_by_position(memc_clone, 0);
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc_clone, 0);
- if (instance->major_version > 1 ||
- (instance->major_version == 1 &&
- instance->minor_version > 2))
+ if (instance->major_version > 1 ||
+ (instance->major_version == 1 &&
+ instance->minor_version > 2))
{
/* Binary protocol doesn't support deferred delete */
memcached_st *bin_clone= memcached_clone(NULL, memc);
{
/* Binary protocol doesn't support deferred delete */
memcached_st *bin_clone= memcached_clone(NULL, memc);
memcached_return_t rc= memcached_delete(memc, "foo", 3, 1);
/* but there is a bug in some of the memcached servers (1.4) that treats
memcached_return_t rc= memcached_delete(memc, "foo", 3, 1);
/* but there is a bug in some of the memcached servers (1.4) that treats
- * the counter as noreply so it doesn't send the proper error message
+ * the counter as noreply so it doesn't send the proper error message
*/
test_true_got(rc == MEMCACHED_PROTOCOL_ERROR || rc == MEMCACHED_NOTFOUND || rc == MEMCACHED_CLIENT_ERROR || rc == MEMCACHED_INVALID_ARGUMENTS, memcached_strerror(NULL, rc));
*/
test_true_got(rc == MEMCACHED_PROTOCOL_ERROR || rc == MEMCACHED_NOTFOUND || rc == MEMCACHED_CLIENT_ERROR || rc == MEMCACHED_INVALID_ARGUMENTS, memcached_strerror(NULL, rc));
- for (uint32_t x= 0; x < TEST_CONSTANT_CREATION; x++)
+ for (uint32_t x= 0; x < TEST_CONSTANT_CREATION; x++)
{
memcached_st* mc= memcached_create(NULL);
memcached_return rc;
{
memcached_st* mc= memcached_create(NULL);
memcached_return rc;
if (rc == MEMCACHED_SUCCESS)
{
if (rc == MEMCACHED_SUCCESS)
{
{
size_t get_value_len;
char *get_value;
{
size_t get_value_len;
char *get_value;