Adding test, showing off how to add a custom function to libmemcached.
[m6w6/libmemcached] / libmemcached / stats.c
index a47b28205623d46061ad77fbf994b4ca76e1167a..128a92f7d1ff7728e64f83487064a5995c6f545e 100644 (file)
@@ -250,8 +250,8 @@ static memcached_return_t binary_stats_fetch(memcached_stat_st *memc_stat,
     request.message.header.request.bodylen= htonl((uint32_t) len);
 
     if ((memcached_do(instance, request.bytes,
-                      sizeof(request.bytes), 0) != MEMCACHED_SUCCESS) ||
-        (memcached_io_write(instance, args, len, 1) == -1))
+                      sizeof(request.bytes), false) != MEMCACHED_SUCCESS) ||
+        (memcached_io_write(instance, args, len, true) == -1))
     {
       memcached_io_reset(instance);
       return MEMCACHED_WRITE_FAILURE;
@@ -260,7 +260,7 @@ static memcached_return_t binary_stats_fetch(memcached_stat_st *memc_stat,
   else
   {
     if (memcached_do(instance, request.bytes,
-                     sizeof(request.bytes), 1) != MEMCACHED_SUCCESS)
+                     sizeof(request.bytes), true) != MEMCACHED_SUCCESS)
     {
       memcached_io_reset(instance);
       return MEMCACHED_WRITE_FAILURE;
@@ -314,7 +314,7 @@ static memcached_return_t ascii_stats_fetch(memcached_stat_st *memc_stat,
   if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
     return MEMCACHED_WRITE_FAILURE;
 
-  rc= memcached_do(instance, buffer, send_length, 1);
+  rc= memcached_do(instance, buffer, send_length, true);
   if (rc != MEMCACHED_SUCCESS)
     goto error;
 
@@ -444,12 +444,11 @@ char ** memcached_stat_get_keys(memcached_st *ptr,
   char **list;
   size_t length= sizeof(memcached_stat_keys);
 
-  list= libmemcached_malloc(memc_stat && memc_stat->root
-                            ? memc_stat->root
-                            : ptr,
-                            length);
+  (void)memc_stat;
 
-  if (!list)
+  list= libmemcached_malloc(ptr, length);
+
+  if (! list)
   {
     *error= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
     return NULL;