Handling merge
[m6w6/libmemcached] / clients / memslap.c
index 52abb4b1e2707fcf071bed31a4a18b50cbbd7341..ddb18f3e7f303b9a95081cf1c269677b3a8c087d 100644 (file)
@@ -6,7 +6,6 @@
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <fcntl.h>
-#include <assert.h>
 #include <sys/time.h>
 #include <getopt.h>
 #include <pthread.h>
@@ -68,6 +67,7 @@ pairs_st *load_create_data(memcached_st *memc, unsigned int number_of,
                            unsigned int *actual_loaded);
 void flush_all(memcached_st *memc);
 
+static int opt_binary= 0;
 static int opt_verbose= 0;
 static int opt_flush= 0;
 static int opt_non_blocking_io= 0;
@@ -141,6 +141,8 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion)
   memc= memcached_create(NULL);
   memcached_server_push(memc, servers);
 
+  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, opt_binary);
+  
   if (opt_flush)
     flush_all(memc);
   if (opt_createial_load)
@@ -244,6 +246,7 @@ void options_parse(int argc, char *argv[])
       {"test", required_argument, NULL, OPT_SLAP_TEST},
       {"verbose", no_argument, &opt_verbose, OPT_VERBOSE},
       {"version", no_argument, NULL, OPT_VERSION},
+      {"binary", no_argument, NULL, OPT_BINARY},
       {0, 0, 0, 0},
     };
 
@@ -258,6 +261,9 @@ void options_parse(int argc, char *argv[])
     {
     case 0:
       break;
+    case OPT_BINARY:
+      opt_binary = 1;
+      break;
     case OPT_VERBOSE: /* --verbose or -v */
       opt_verbose = OPT_VERBOSE;
       break;
@@ -355,9 +361,6 @@ void *run_task(void *p)
   if (context->execute_pairs)
     pairs_free(context->execute_pairs);
 
-  if (context->initial_pairs)
-    pairs_free(context->initial_pairs);
-
   free(context);
 
   pthread_mutex_lock(&counter_mutex);