testing: memcat
[awesomized/libmemcached] / src / bin / memslap.cc
index b7b606e97e9bbc05870e583b879c8f17fa40706a..621217e20b0891bdab1be2dc205a5f1ae745dc67 100644 (file)
@@ -80,7 +80,9 @@ struct thread_context_st {
   , memc(NULL)
   , root(memc_arg) {}
 
-  void init() { memc = memcached_clone(NULL, root); }
+  void init() {
+    memc = memcached_clone(NULL, root);
+  }
 
   ~thread_context_st() {
     if (execute_pairs) {
@@ -143,7 +145,9 @@ static __attribute__((noreturn)) void *run_task(void *p) {
     execute_set(context->memc, context->execute_pairs, context->execute_number);
     break;
 
-  case GET_TEST: execute_get(context->memc, context->initial_pairs, context->initial_number); break;
+  case GET_TEST:
+    execute_get(context->memc, context->initial_pairs, context->initial_number);
+    break;
 
   case MGET_TEST:
     execute_mget(context->memc, (const char *const *) context->keys, context->key_lengths,
@@ -281,7 +285,7 @@ void scheduler(memcached_server_st *servers, conclusions_st *conclusion) {
     }
 
     /* now you create the thread */
-    if (pthread_create(threads + x, NULL, run_task, (void *) context) != 0) {
+    if (pthread_create(threads + x, NULL, run_task, (void *) context)) {
       fprintf(stderr, "Could not create thread\n");
       exit(1);
     }
@@ -345,7 +349,8 @@ void options_parse(int argc, char *argv[]) {
       break;
 
     switch (option_rv) {
-    case 0: break;
+    case 0:
+      break;
 
     case OPT_UDP:
       if (opt_test == GET_TEST) {
@@ -357,17 +362,29 @@ void options_parse(int argc, char *argv[]) {
       opt_udp_io = true;
       break;
 
-    case OPT_BINARY: opt_binary = true; break;
+    case OPT_BINARY:
+      opt_binary = true;
+      break;
 
-    case OPT_VERBOSE: /* --verbose or -v */ opt_verbose = OPT_VERBOSE; break;
+    case OPT_VERBOSE: /* --verbose or -v */
+      opt_verbose = OPT_VERBOSE;
+      break;
 
-    case OPT_DEBUG: /* --debug or -d */ opt_verbose = OPT_DEBUG; break;
+    case OPT_DEBUG: /* --debug or -d */
+      opt_verbose = OPT_DEBUG;
+      break;
 
-    case OPT_VERSION: /* --version or -V */ opt_version = true; break;
+    case OPT_VERSION: /* --version or -V */
+      opt_version = true;
+      break;
 
-    case OPT_HELP: /* --help or -h */ opt_help = true; break;
+    case OPT_HELP: /* --help or -h */
+      opt_help = true;
+      break;
 
-    case OPT_SERVERS: /* --servers or -s */ opt_servers = strdup(optarg); break;
+    case OPT_SERVERS: /* --servers or -s */
+      opt_servers = strdup(optarg);
+      break;
 
     case OPT_SLAP_TEST:
       if (strcmp(optarg, "get") == 0) {
@@ -391,7 +408,7 @@ void options_parse(int argc, char *argv[]) {
     case OPT_SLAP_CONCURRENCY:
       errno = 0;
       opt_concurrency = (unsigned int) strtoul(optarg, (char **) NULL, 10);
-      if (errno != 0) {
+      if (errno) {
         fprintf(stderr, "Invalid value for concurrency: %s\n", optarg);
         exit(EXIT_FAILURE);
       }
@@ -400,7 +417,7 @@ void options_parse(int argc, char *argv[]) {
     case OPT_SLAP_EXECUTE_NUMBER:
       errno = 0;
       opt_execute_number = (unsigned int) strtoul(optarg, (char **) NULL, 10);
-      if (errno != 0) {
+      if (errno) {
         fprintf(stderr, "Invalid value for execute: %s\n", optarg);
         exit(EXIT_FAILURE);
       }
@@ -409,19 +426,22 @@ void options_parse(int argc, char *argv[]) {
     case OPT_SLAP_INITIAL_LOAD:
       errno = 0;
       opt_createial_load = (unsigned int) strtoul(optarg, (char **) NULL, 10);
-      if (errno != 0) {
+      if (errno) {
         fprintf(stderr, "Invalid value for initial load: %s\n", optarg);
         exit(EXIT_FAILURE);
       }
       break;
 
-    case OPT_QUIET: close_stdio(); break;
+    case OPT_QUIET:
+      close_stdio();
+      break;
 
     case '?':
       /* getopt_long already printed an error message. */
       exit(EXIT_FAILURE);
 
-    default: abort();
+    default:
+      abort();
     }
   }