uint16_t *flags,
memcached_return *error)
{
- size_t send_length;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
+ char *buf_ptr= buffer;
unsigned int server_key;
char *value;
LIBMEMCACHED_MEMCACHED_GET_START();
if (*error != MEMCACHED_SUCCESS)
goto error;
- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, "get %.*s\r\n",
- (int)key_length, key);
+ memcpy(buf_ptr, "get ", 4);
+ buf_ptr+= 4;
+ memcpy(buf_ptr, key, key_length);
+ buf_ptr+= key_length;
+ memcpy(buf_ptr, "\r\n", 2);
+ buf_ptr+= 2;
- if ((memcached_io_write(ptr, server_key, buffer, send_length, 1)) == -1)
+ if ((memcached_io_write(ptr, server_key, buffer, (size_t)(buf_ptr - buffer), 1)) == -1)
{
*error= MEMCACHED_WRITE_FAILURE;
goto error;
int size= 0;
srand(time(NULL));
char key[10];
- char *randomstuff = (char *)malloc(6 * 1024);
+ char randomstuff[6 * 1024];
+ memcached_return rc;
+
memset(randomstuff, 0, 6 * 1024);
- memcached_return rc;
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, &setter);
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, &setter);
fprintf(stderr, "All tests completed successfully\n\n");
+ memcached_server_list_free(servers);
+
return 0;
}