Setup for next version (and fixes for util for RPM)
[awesomized/libmemcached] / libmemcached / memcached_stats.c
index d489052c6ecd5f2e551569bf5c672ab43d8172f3..791c00d9891ef75950cca606c1958ae43a74704e 100644 (file)
@@ -136,7 +136,18 @@ static void set_data(memcached_stat_st *stat, char *key, char *value)
   {
     stat->threads= strtol(value, (char **)NULL, 10);
   }
-  else
+  else if (!(strcmp("delete_misses", key) == 0 ||/* New stats in the 1.3 beta */
+             strcmp("delete_hits", key) == 0 ||/* Just swallow them for now.. */
+             strcmp("incr_misses", key) == 0 ||
+             strcmp("incr_hits", key) == 0 ||
+             strcmp("decr_misses", key) == 0 ||
+             strcmp("decr_hits", key) == 0 ||
+             strcmp("cas_misses", key) == 0 ||
+             strcmp("cas_hits", key) == 0 ||
+             strcmp("cas_badval", key) == 0 ||
+             strcmp("cmd_flush", key) == 0 ||
+             strcmp("accepting_conns", key) == 0 ||
+             strcmp("listen_disabled_num", key) == 0))
   {
     fprintf(stderr, "Unknown key %s\n", key);
   }
@@ -340,6 +351,12 @@ memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_retur
   memcached_return rc;
   memcached_stat_st *stats;
 
+  if (ptr->flags & MEM_USE_UDP)
+  {
+    *error= MEMCACHED_NOT_SUPPORTED;
+    return NULL;
+  }
+
   if (ptr->call_malloc)
     stats= (memcached_stat_st *)ptr->call_malloc(ptr, sizeof(memcached_stat_st)*(ptr->number_of_hosts));
   else
@@ -348,11 +365,6 @@ memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_retur
   if (!stats)
   {
     *error= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
-    if (ptr->call_free)
-      ptr->call_free(ptr, stats);
-    else
-      free(stats);
-
     return NULL;
   }
   memset(stats, 0, sizeof(memcached_stat_st)*(ptr->number_of_hosts));