std::vector<size_t> key_lengths;
key_lengths.resize(HALDENBRAND_KEY_COUNT);
- char **keys= static_cast<char **>(calloc(key_lengths.size(), sizeof(char *)));
- test_true(keys);
+ std::vector<char *> keys;
+ keys.resize(key_lengths.size());
for (uint32_t x= 0; x < key_lengths.size(); x++)
{
char key[MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1];
int key_length= snprintf(key, sizeof(key), "%u", x);
- test_true(key_length);
+ test_true(key_length > 0 and key_length < MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1);
keys[x]= strdup(key);
- test_true(keys[x]);
key_lengths[x]= key_length;
- test_compare(size_t(key_length), strlen(keys[x]));
}
test_compare(MEMCACHED_SUCCESS,
- memcached_mget(memc, (const char **)keys, &key_lengths[0], key_lengths.size()));
+ memcached_mget(memc, &keys[0], &key_lengths[0], key_lengths.size()));
unsigned int keys_returned;
test_compare(TEST_SUCCESS, fetch_all_results(memc, keys_returned, MEMCACHED_SUCCESS));
test_compare(HALDENBRAND_KEY_COUNT, keys_returned);
- for (uint32_t x= 0; x < HALDENBRAND_KEY_COUNT; x++)
+ for (std::vector<char *>::iterator iter= keys.begin();
+ iter != keys.end();
+ iter++)
{
- free(keys[x]);
+ free(*iter);
}
- free(keys);
return TEST_SUCCESS;
}
std::vector<size_t> key_lengths;
key_lengths.resize(key_count);
- char **keys= static_cast<char **>(calloc(key_lengths.size(), sizeof(char *)));
- test_true(keys);
+ std::vector<char *> keys;
+ keys.resize(key_lengths.size());
for (unsigned int x= 0; x < key_lengths.size(); x++)
{
- char buffer[30];
-
- snprintf(buffer, 30, "%u", x);
- keys[x]= strdup(buffer);
- test_true(keys[x]);
- key_lengths[x]= strlen(keys[x]);
+ char key[MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1];
+ int key_length= snprintf(key, sizeof(key), "%u", x);
+ test_true(key_length > 0 and key_length < MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1);
+ keys[x]= strdup(key);
+ key_lengths[x]= key_length;
}
oldalarm= signal(SIGALRM, fail);
alarm(5);
test_compare_got(MEMCACHED_SUCCESS,
- memcached_mget(memc_clone, (const char **)keys, &key_lengths[0], key_count), memcached_last_error_message(memc_clone));
+ memcached_mget(memc_clone, &keys[0], &key_lengths[0], key_count), memcached_last_error_message(memc_clone));
alarm(0);
signal(SIGALRM, oldalarm);
test_false(return_key[0]);
test_false(return_value);
- for (unsigned int x= 0; x < key_count; x++)
+ for (std::vector<char *>::iterator iter= keys.begin();
+ iter != keys.end();
+ iter++)
{
- free(keys[x]);
+ free(*iter);
}
- free(keys);
memcached_free(memc_clone);
bool has_distribution;
bool has_buffer_requests;
bool has_udp;
+ bool has_binary;
+ bool has_verify_key;
used_options_st() :
has_hash(false),
has_namespace(false),
has_distribution(false),
has_buffer_requests(false),
- has_udp(false)
+ has_udp(false),
+ has_binary(false),
+ has_verify_key(false)
{
}
} used_options;
}
}
+ if (random_string.compare(0, test_literal_compare_param("--BINARY-PROTOCOL")) == 0)
+ {
+ if (used_options.has_binary)
+ {
+ continue;
+ }
+ used_options.has_binary= true;
+
+ if (used_options.has_verify_key)
+ {
+ continue;
+ }
+ }
+
+ if (random_string.compare(0, test_literal_compare_param("--VERIFY-KEY")) == 0)
+ {
+ if (used_options.has_verify_key)
+ {
+ continue;
+ }
+ used_options.has_verify_key= true;
+
+ if (used_options.has_binary)
+ {
+ continue;
+ }
+ }
+
if (random_string.compare(0, test_literal_compare_param("--DISTRIBUTION")) == 0)
{
if (used_options.has_distribution)