const memcached_server_st *server,
void *context)
{
- struct context_st *execute= (struct context_st *)context;
+ const libmemcached_io_vector_st *execute= (const libmemcached_io_vector_st *)context;
memcached_st local_memc;
memcached_st *memc_ptr= memcached_create(&local_memc);
if (rc == MEMCACHED_SUCCESS)
{
- char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
-
memcached_server_write_instance_st instance= memcached_server_instance_fetch(memc_ptr, 0);
- rc= memcached_do(instance, execute->buffer, execute->length, true);
+ rc= memcached_vdo(instance, execute, 3, true);
if (rc == MEMCACHED_SUCCESS)
{
- rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
+ char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
+ rc= memcached_response(instance, buffer, sizeof(buffer), NULL);
}
}
memcached_return_t memcached_verbosity(memcached_st *ptr, uint32_t verbosity)
{
- int send_length;
memcached_server_fn callbacks[1];
char 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)
+ int send_length= snprintf(buffer, sizeof(buffer), "%u", verbosity);
+ if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE or send_length < 0)
{
return memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT,
memcached_literal_param("snprintf(MEMCACHED_DEFAULT_COMMAND_SIZE)"));
}
- struct context_st context = { (size_t)send_length, buffer };
+ struct libmemcached_io_vector_st vector[]=
+ {
+ { memcached_literal_param("verbosity ") },
+ { buffer, send_length },
+ { memcached_literal_param("\r\n") }
+ };
callbacks[0]= _set_verbosity;
- return memcached_server_cursor(ptr, callbacks, &context, 1);
+ return memcached_server_cursor(ptr, callbacks, vector, 1);
}