AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
-AllowShortCaseLabelsOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: false
#AllowShortEnumsOnASingleLine: true (in v11)
-AllowShortFunctionsOnASingleLine: Inline
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
static const char *lookup_help(memcached_options option) {
switch (option) {
- case OPT_SERVERS: return ("List which servers you wish to connect to.");
- case OPT_VERSION: return ("Display the version of the application and then exit.");
- case OPT_HELP: return ("Display this message and then exit.");
- case OPT_VERBOSE: return ("Give more details on the progression of the application.");
- case OPT_QUIET: return ("stderr and stdin will be closed at application startup.");
- case OPT_DEBUG: return ("Provide output only useful for debugging.");
- case OPT_FLAG: return ("Provide flag information for storage operation.");
- case OPT_EXPIRE: return ("Set the expire option for the object.");
- case OPT_SET: return ("Use set command with memcached when storing.");
- case OPT_REPLACE: return ("Use replace command with memcached when storing.");
- case OPT_ADD: return ("Use add command with memcached when storing.");
- case OPT_SLAP_EXECUTE_NUMBER: return ("Number of times to execute the given test.");
- case OPT_SLAP_INITIAL_LOAD: return ("Number of key pairs to load before executing tests.");
- case OPT_SLAP_TEST: return ("Test to run (currently \"get\" or \"set\").");
- case OPT_SLAP_CONCURRENCY: return ("Number of users to simulate with load.");
- case OPT_SLAP_NON_BLOCK: return ("Set TCP up to use non-blocking IO.");
- case OPT_SLAP_TCP_NODELAY: return ("Set TCP socket up to use nodelay.");
- case OPT_FLUSH: return ("Flush servers before running tests.");
- case OPT_HASH: return ("Select hash type.");
- case OPT_BINARY: return ("Switch to binary protocol.");
- case OPT_ANALYZE: return ("Analyze the provided servers.");
- case OPT_UDP: return ("Use UDP protocol when communicating with server.");
- case OPT_BUFFER: return ("Enable request buffering.");
- case OPT_USERNAME: return "Username to use for SASL authentication";
- case OPT_PASSWD: return "Password to use for SASL authentication";
- case OPT_FILE: return "Path to file in which to save result";
- case OPT_STAT_ARGS: return "Argument for statistics";
- case OPT_SERVER_VERSION: return "Memcached daemon software version";
- default: break;
+ case OPT_SERVERS:
+ return ("List which servers you wish to connect to.");
+ case OPT_VERSION:
+ return ("Display the version of the application and then exit.");
+ case OPT_HELP:
+ return ("Display this message and then exit.");
+ case OPT_VERBOSE:
+ return ("Give more details on the progression of the application.");
+ case OPT_QUIET:
+ return ("stderr and stdin will be closed at application startup.");
+ case OPT_DEBUG:
+ return ("Provide output only useful for debugging.");
+ case OPT_FLAG:
+ return ("Provide flag information for storage operation.");
+ case OPT_EXPIRE:
+ return ("Set the expire option for the object.");
+ case OPT_SET:
+ return ("Use set command with memcached when storing.");
+ case OPT_REPLACE:
+ return ("Use replace command with memcached when storing.");
+ case OPT_ADD:
+ return ("Use add command with memcached when storing.");
+ case OPT_SLAP_EXECUTE_NUMBER:
+ return ("Number of times to execute the given test.");
+ case OPT_SLAP_INITIAL_LOAD:
+ return ("Number of key pairs to load before executing tests.");
+ case OPT_SLAP_TEST:
+ return ("Test to run (currently \"get\" or \"set\").");
+ case OPT_SLAP_CONCURRENCY:
+ return ("Number of users to simulate with load.");
+ case OPT_SLAP_NON_BLOCK:
+ return ("Set TCP up to use non-blocking IO.");
+ case OPT_SLAP_TCP_NODELAY:
+ return ("Set TCP socket up to use nodelay.");
+ case OPT_FLUSH:
+ return ("Flush servers before running tests.");
+ case OPT_HASH:
+ return ("Select hash type.");
+ case OPT_BINARY:
+ return ("Switch to binary protocol.");
+ case OPT_ANALYZE:
+ return ("Analyze the provided servers.");
+ case OPT_UDP:
+ return ("Use UDP protocol when communicating with server.");
+ case OPT_BUFFER:
+ return ("Enable request buffering.");
+ case OPT_USERNAME:
+ return "Username to use for SASL authentication";
+ case OPT_PASSWD:
+ return "Password to use for SASL authentication";
+ case OPT_FILE:
+ return "Path to file in which to save result";
+ case OPT_STAT_ARGS:
+ return "Argument for statistics";
+ case OPT_SERVER_VERSION:
+ return "Memcached daemon software version";
+ default:
+ break;
};
assert(0);
return "List one or more servers to connect. Servers count must be less than\n"
" threads count. e.g.: --servers=localhost:1234,localhost:11211";
- case OPT_VERSION: return "Display the version of the application and then exit.";
+ case OPT_VERSION:
+ return "Display the version of the application and then exit.";
- case OPT_HELP: return "Display this message and then exit.";
+ case OPT_HELP:
+ return "Display this message and then exit.";
case OPT_EXECUTE_NUMBER:
return "Number of operations(get and set) to execute for the\n"
case OPT_THREAD_NUMBER:
return "Number of threads to startup, better equal to CPU numbers. Default 8.";
- case OPT_CONCURRENCY: return "Number of concurrency to simulate with load. Default 128.";
+ case OPT_CONCURRENCY:
+ return "Number of concurrency to simulate with load. Default 128.";
- case OPT_FIXED_LTH: return "Fixed length of value.";
+ case OPT_FIXED_LTH:
+ return "Fixed length of value.";
- case OPT_VERIFY: return "The proportion of date verification, e.g.: --verify=0.01";
+ case OPT_VERIFY:
+ return "The proportion of date verification, e.g.: --verify=0.01";
- case OPT_GETS_DIVISION: return "Number of keys to multi-get once. Default 1, means single get.";
+ case OPT_GETS_DIVISION:
+ return "Number of keys to multi-get once. Default 1, means single get.";
case OPT_TIME:
return "How long the test to run, suffix: s-seconds, m-minutes, h-hours,\n"
return "Frequency of dumping statistic information. suffix: s-seconds,\n"
" m-minutes, e.g.: --resp_freq=10s.";
- case OPT_SOCK_PER_CONN: return "Number of TCP socks per concurrency. Default 1.";
+ case OPT_SOCK_PER_CONN:
+ return "Number of TCP socks per concurrency. Default 1.";
- case OPT_RECONNECT: return "Reconnect support, when connection is closed it will be reconnected.";
+ case OPT_RECONNECT:
+ return "Reconnect support, when connection is closed it will be reconnected.";
- case OPT_VERBOSE: return "Whether it outputs detailed information when verification fails.";
+ case OPT_VERBOSE:
+ return "Whether it outputs detailed information when verification fails.";
case OPT_FACEBOOK_TEST:
return "Whether it enables facebook test feature, set with TCP and multi-get with UDP.";
case OPT_BINARY_PROTOCOL:
return "Whether it enables binary protocol. Default with ASCII protocol.";
- case OPT_TPS: return "Expected throughput, suffix: K, e.g.: --tps=10k.";
+ case OPT_TPS:
+ return "Expected throughput, suffix: K, e.g.: --tps=10k.";
- case OPT_REP_WRITE_SRV: return "The first nth servers can write data, e.g.: --rep_write=2.";
+ case OPT_REP_WRITE_SRV:
+ return "The first nth servers can write data, e.g.: --rep_write=2.";
- default: return "Forgot to document this option :)";
+ default:
+ return "Forgot to document this option :)";
} /* switch */
} /* ms_lookup_help */
ret *= 60;
/* fall through */
case 's':
- case 'S': break;
+ case 'S':
+ break;
- default: ret = -1; break;
+ default:
+ ret = -1;
+ break;
} /* switch */
return ret;
switch (unit) {
case 'k':
- case 'K': ret *= 1024; break;
+ case 'K':
+ ret *= 1024;
+ break;
case 'm':
- case 'M': ret *= 1024 * 1024; break;
+ case 'M':
+ ret *= 1024 * 1024;
+ break;
case 'g':
- case 'G': ret *= 1024 * 1024 * 1024; break;
+ case 'G':
+ ret *= 1024 * 1024 * 1024;
+ break;
- default: ret = -1; break;
+ default:
+ ret = -1;
+ break;
} /* switch */
return ret;
!= -1)
{
switch (option_rv) {
- case 0: break;
+ case 0:
+ break;
- case OPT_VERSION: /* --version or -V */ ms_version_command(PROGRAM_NAME); break;
+ case OPT_VERSION: /* --version or -V */
+ ms_version_command(PROGRAM_NAME);
+ break;
case OPT_HELP: /* --help or -h */
ms_help_command(PROGRAM_NAME, PROGRAM_DESCRIPTION);
exit(0);
break;
- case OPT_SERVERS: /* --servers or -s */ ms_setting.srv_str = strdup(optarg); break;
+ case OPT_SERVERS: /* --servers or -s */
+ ms_setting.srv_str = strdup(optarg);
+ break;
case OPT_CONCURRENCY: /* --concurrency or -c */
errno = 0;
}
break;
- case OPT_CONFIG_CMD: /* --cfg_cmd or -F */ ms_setting.cfg_file = strdup(optarg); break;
+ case OPT_CONFIG_CMD: /* --cfg_cmd or -F */
+ ms_setting.cfg_file = strdup(optarg);
+ break;
case OPT_WINDOW_SIZE: /* --win_size or -w */
ms_setting.win_size = (size_t) ms_parse_size();
}
break;
- case OPT_UDP: /* --udp or -U*/ ms_setting.udp = true; break;
+ case OPT_UDP: /* --udp or -U*/
+ ms_setting.udp = true;
+ break;
case OPT_EXPIRE: /* --exp_verify or -e */
ms_setting.exp_ver_per = atof(optarg);
}
break;
- case OPT_RECONNECT: /* --reconnect or -R */ ms_setting.reconnect = true; break;
+ case OPT_RECONNECT: /* --reconnect or -R */
+ ms_setting.reconnect = true;
+ break;
- case OPT_VERBOSE: /* --verbose or -b */ ms_setting.verbose = true; break;
+ case OPT_VERBOSE: /* --verbose or -b */
+ ms_setting.verbose = true;
+ break;
- case OPT_FACEBOOK_TEST: /* --facebook or -a */ ms_setting.facebook_test = true; break;
+ case OPT_FACEBOOK_TEST: /* --facebook or -a */
+ ms_setting.facebook_test = true;
+ break;
- case OPT_BINARY_PROTOCOL: /* --binary or -B */ ms_setting.binary_prot_ = true; break;
+ case OPT_BINARY_PROTOCOL: /* --binary or -B */
+ ms_setting.binary_prot_ = true;
+ break;
case OPT_TPS: /* --tps or -P */
ms_setting.expected_tps = (int) ms_parse_size();
/* getopt_long already printed an error message. */
exit(1);
- default: abort();
+ default:
+ abort();
} /* switch */
}
} /* ms_options_parse */
break;
- case 'O': /* OK */ c->currcmd.retstat = MCD_SUCCESS; break;
+ case 'O': /* OK */
+ c->currcmd.retstat = MCD_SUCCESS;
+ break;
case 'S': /* STORED STATS SERVER_ERROR */
if (buffer[2] == 'A') /* STORED STATS */ { /* STATS*/
c->currcmd.retstat = MCD_CLIENT_ERROR;
break;
- default: c->currcmd.retstat = MCD_UNKNOWN_READ_FAILURE; break;
+ default:
+ c->currcmd.retstat = MCD_UNKNOWN_READ_FAILURE;
+ break;
} /* switch */
return ret;
stop = true;
break;
- case TRANSMIT_INCOMPLETE: c->ctnwrite = true; break; /* Continue in state machine. */
+ case TRANSMIT_INCOMPLETE:
+ c->ctnwrite = true;
+ break; /* Continue in state machine. */
- case TRANSMIT_HARD_ERROR: c->ctnwrite = false; break;
+ case TRANSMIT_HARD_ERROR:
+ c->ctnwrite = false;
+ break;
case TRANSMIT_SOFT_ERROR:
c->ctnwrite = true;
stop = true;
break;
- default: break;
+ default:
+ break;
} /* switch */
break;
break;
}
- default: assert(0);
+ default:
+ assert(0);
} /* switch */
}
} /* ms_drive_machine */
}
break;
- default: break;
+ default:
+ break;
} /* switch */
if (!c->udp && (c->total_sfds > 1)) {
c->currcmd.retstat = MCD_PROTOCOL_ERROR;
break;
- case PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS: errstr = "Data exists for key."; break;
+ case PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS:
+ errstr = "Data exists for key.";
+ break;
case PROTOCOL_BINARY_RESPONSE_E2BIG:
errstr = "Too large.";
}
break;
- default: assert(0); break;
+ default:
+ assert(0);
+ break;
} /* switch */
}
distr[i].value_size = tmp_size;
break;
- default: break;
+ default:
+ break;
} /* switch */
}
break;
case MCD_SERVER_ERROR:
- default: break;
+ default:
+ break;
} /* switch */
}
} /* ms_update_set_result */
pthread_mutex_lock(&ms_statistic.stat_mutex);
switch (c->precmd.cmd) {
- case CMD_SET: ms_record_event(&ms_statistic.set_stat, time_diff, false); break;
+ case CMD_SET:
+ ms_record_event(&ms_statistic.set_stat, time_diff, false);
+ break;
case CMD_GET:
if (c->curr_task.get_miss) {
ms_record_event(&ms_statistic.get_stat, time_diff, get_miss);
break;
- default: break;
+ default:
+ break;
} /* switch */
ms_record_event(&ms_statistic.total_stat, time_diff, get_miss);
verify(get_socket_errno() == EINTR || get_socket_errno() == EAGAIN);
break;
- case 0: return TEST_FAIL;
+ case 0:
+ return TEST_FAIL;
- default: offset += (size_t) nr;
+ default:
+ offset += (size_t) nr;
}
} while (offset < len);
case PROTOCOL_BINARY_CMD_SETQ:
verify("Quiet command shouldn't return on success" == NULL);
/* fall through */
- default: break;
+ default:
+ break;
}
switch (cc) {
}
break;
- case 'v': verbose = true; break;
+ case 'v':
+ verbose = true;
+ break;
- case 'c': do_core = true; break;
+ case 'c':
+ do_core = true;
+ break;
- case 'h': hostname = optarg; break;
+ case 'h':
+ hostname = optarg;
+ break;
- case 'p': port = optarg; break;
+ case 'p':
+ port = optarg;
+ break;
- case 'q': close_stdio(); break;
+ case 'q':
+ close_stdio();
+ break;
- case 'P': prompt = true; break;
+ case 'P':
+ prompt = true;
+ break;
- case 'T': testname = optarg; break;
+ case 'T':
+ testname = optarg;
+ break;
default:
fprintf(stderr,
if (option_rv == -1)
break;
switch (option_rv) {
- case 0: break;
- case OPT_BINARY: opt_binary = 1; 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_VERSION: /* --version or -V */ version_command(PROGRAM_NAME); break;
+ case 0:
+ break;
+ case OPT_BINARY:
+ opt_binary = 1;
+ 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_VERSION: /* --version or -V */
+ version_command(PROGRAM_NAME);
+ break;
case OPT_HELP: /* --help or -h */
help_command(PROGRAM_NAME, PROGRAM_DESCRIPTION, long_options, help_options);
break;
- case OPT_SERVERS: /* --servers or -s */ opt_servers = strdup(optarg); break;
- case OPT_HASH: opt_hash = strdup(optarg); break;
- case OPT_USERNAME: opt_username = optarg; break;
- case OPT_PASSWD: opt_passwd = optarg; break;
- case OPT_FILE: opt_file = optarg; break;
+ case OPT_SERVERS: /* --servers or -s */
+ opt_servers = strdup(optarg);
+ break;
+ case OPT_HASH:
+ opt_hash = strdup(optarg);
+ break;
+ case OPT_USERNAME:
+ opt_username = optarg;
+ break;
+ case OPT_PASSWD:
+ opt_passwd = optarg;
+ break;
+ case OPT_FILE:
+ opt_file = optarg;
+ 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();
}
}
}
break;
switch (option_rv) {
- case 0: break;
+ case 0:
+ 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_FLAG: /* --flag */
{
}
} break;
- case OPT_SET: opt_method = OPT_SET; break;
+ case OPT_SET:
+ opt_method = OPT_SET;
+ break;
- case OPT_REPLACE: opt_method = OPT_REPLACE; break;
+ case OPT_REPLACE:
+ opt_method = OPT_REPLACE;
+ break;
- case OPT_ADD: opt_method = OPT_ADD; break;
+ case OPT_ADD:
+ opt_method = OPT_ADD;
+ break;
- case OPT_HASH: opt_hash = strdup(optarg); break;
+ case OPT_HASH:
+ opt_hash = strdup(optarg);
+ break;
- case OPT_USERNAME: opt_username = optarg; break;
+ case OPT_USERNAME:
+ opt_username = optarg;
+ break;
- case OPT_PASSWD: opt_passwd = optarg; break;
+ case OPT_PASSWD:
+ opt_passwd = optarg;
+ break;
- case OPT_QUIET: close_stdio(); break;
+ case OPT_QUIET:
+ close_stdio();
+ break;
- case OPT_UDP: opt_udp = true; break;
+ case OPT_UDP:
+ opt_udp = true;
+ break;
- case OPT_BUFFER: opt_buffer = true; break;
+ case OPT_BUFFER:
+ opt_buffer = true;
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(1);
- default: abort();
+ default:
+ abort();
}
}
break;
switch (option_rv) {
- case 0: break;
+ case 0:
+ 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_verbose = true; break;
+ case OPT_VERSION: /* --version or -V */
+ opt_verbose = 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_HASH: opt_hash = strdup(optarg); break;
+ case OPT_HASH:
+ opt_hash = strdup(optarg);
+ break;
- case OPT_USERNAME: opt_username = optarg; break;
+ case OPT_USERNAME:
+ opt_username = optarg;
+ break;
- case OPT_PASSWD: opt_passwd = optarg; break;
+ case OPT_PASSWD:
+ opt_passwd = optarg;
+ break;
- case OPT_QUIET: close_stdio(); break;
+ case OPT_QUIET:
+ close_stdio();
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(1);
- default: abort();
+ default:
+ abort();
}
}
}
switch (option_rv) {
- case 0: break;
+ case 0:
+ 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 '?':
/* getopt_long already printed an error message. */
exit(EXIT_FAILURE);
- default: exit(EXIT_FAILURE);
+ default:
+ exit(EXIT_FAILURE);
}
}
}
switch (option_rv) {
- case 0: break;
+ case 0:
+ break;
- case OPT_BINARY: opt_binary = 1; break;
+ case OPT_BINARY:
+ opt_binary = 1;
+ 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_HASH: opt_hash = strdup(optarg); break;
+ case OPT_HASH:
+ opt_hash = strdup(optarg);
+ break;
- case OPT_USERNAME: opt_username = optarg; break;
+ case OPT_USERNAME:
+ opt_username = optarg;
+ break;
- case OPT_PASSWD: opt_passwd = optarg; break;
+ case OPT_PASSWD:
+ opt_passwd = optarg;
+ break;
- case OPT_QUIET: close_stdio(); break;
+ case OPT_QUIET:
+ close_stdio();
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(EXIT_SUCCESS);
- default: abort();
+ default:
+ abort();
}
}
if (option_rv == -1)
break;
switch (option_rv) {
- case 0: break;
+ case 0:
+ 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_EXPIRE: /* --expire */
errno = 0;
}
break;
- case OPT_USERNAME: opt_username = optarg; break;
+ case OPT_USERNAME:
+ opt_username = optarg;
+ break;
- case OPT_PASSWD: opt_passwd = optarg; break;
+ case OPT_PASSWD:
+ opt_passwd = optarg;
+ 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();
}
}
break;
switch (option_rv) {
- case 0: break;
+ case 0:
+ 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 */ version_command(PROGRAM_NAME); break;
+ case OPT_VERSION: /* --version or -V */
+ version_command(PROGRAM_NAME);
+ break;
case OPT_HELP: /* --help or -h */
help_command(PROGRAM_NAME, PROGRAM_DESCRIPTION, long_options, help_options);
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_EXPIRE: /* --expire */
errno = 0;
opt_binary = true;
break;
- case OPT_PASSWD: opt_passwd = optarg; break;
+ case OPT_PASSWD:
+ opt_passwd = optarg;
+ break;
- case OPT_QUIET: close_stdio(); break;
+ case OPT_QUIET:
+ close_stdio();
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(1);
- default: abort();
+ default:
+ abort();
}
}
}
switch (option_rv) {
- case 0: break;
+ case 0:
+ break;
- case OPT_BINARY: opt_binary = 1; break;
+ case OPT_BINARY:
+ opt_binary = 1;
+ 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_EXPIRE: /* --expire */
errno = 0;
}
break;
- case OPT_HASH: opt_hash = strdup(optarg); break;
+ case OPT_HASH:
+ opt_hash = strdup(optarg);
+ break;
- case OPT_USERNAME: opt_username = optarg; break;
+ case OPT_USERNAME:
+ opt_username = optarg;
+ break;
- case OPT_PASSWD: opt_passwd = optarg; break;
+ case OPT_PASSWD:
+ opt_passwd = optarg;
+ break;
- case OPT_QUIET: close_stdio(); break;
+ case OPT_QUIET:
+ close_stdio();
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(EXIT_SUCCESS);
- default: abort();
+ default:
+ abort();
}
}
, 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) {
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,
break;
switch (option_rv) {
- case 0: break;
+ case 0:
+ break;
case OPT_UDP:
if (opt_test == GET_TEST) {
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) {
}
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();
}
}
break;
switch (option_rv) {
- case 0: break;
+ case 0:
+ break;
- case OPT_VERBOSE: /* --verbose or -v */ opt_verbose = true; break;
+ case OPT_VERBOSE: /* --verbose or -v */
+ opt_verbose = true;
+ break;
- case OPT_DEBUG: /* --debug or -d */ opt_verbose = true; break;
+ case OPT_DEBUG: /* --debug or -d */
+ opt_verbose = true;
+ break;
- case OPT_BINARY: opt_binary = true; break;
+ case OPT_BINARY:
+ opt_binary = true;
+ break;
- case OPT_SERVER_VERSION: opt_server_version = true; break;
+ case OPT_SERVER_VERSION:
+ opt_server_version = true;
+ 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_STAT_ARGS: stat_args = strdup(optarg); break;
+ case OPT_STAT_ARGS:
+ stat_args = strdup(optarg);
+ break;
case OPT_ANALYZE: /* --analyze or -a */
opt_analyze = true;
analyze_mode = (optarg) ? strdup(optarg) : NULL;
break;
- case OPT_QUIET: close_stdio(); break;
+ case OPT_QUIET:
+ close_stdio();
+ break;
case OPT_USERNAME:
opt_username = optarg;
opt_binary = true;
break;
- case OPT_PASSWD: opt_passwd = optarg; break;
+ case OPT_PASSWD:
+ opt_passwd = optarg;
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(1);
- default: abort();
+ default:
+ abort();
}
}
}
switch (option_rv) {
- case 0: break;
+ case 0:
+ 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_HASH: opt_hash = strdup(optarg); break;
+ case OPT_HASH:
+ opt_hash = strdup(optarg);
+ break;
- case OPT_USERNAME: opt_username = optarg; break;
+ case OPT_USERNAME:
+ opt_username = optarg;
+ break;
- case OPT_PASSWD: opt_passwd = optarg; break;
+ case OPT_PASSWD:
+ opt_passwd = optarg;
+ break;
case OPT_EXPIRE:
errno = 0;
}
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();
}
}
uint32_t libhashkit_digest(const char *key, size_t key_length,
hashkit_hash_algorithm_t hash_algorithm) {
switch (hash_algorithm) {
- case HASHKIT_HASH_DEFAULT: return libhashkit_one_at_a_time(key, key_length);
- case HASHKIT_HASH_MD5: return libhashkit_md5(key, key_length);
- case HASHKIT_HASH_CRC: return libhashkit_crc32(key, key_length);
- case HASHKIT_HASH_FNV1_64: return libhashkit_fnv1_64(key, key_length);
- case HASHKIT_HASH_FNV1A_64: return libhashkit_fnv1a_64(key, key_length);
- case HASHKIT_HASH_FNV1_32: return libhashkit_fnv1_32(key, key_length);
- case HASHKIT_HASH_FNV1A_32: return libhashkit_fnv1a_32(key, key_length);
+ case HASHKIT_HASH_DEFAULT:
+ return libhashkit_one_at_a_time(key, key_length);
+ case HASHKIT_HASH_MD5:
+ return libhashkit_md5(key, key_length);
+ case HASHKIT_HASH_CRC:
+ return libhashkit_crc32(key, key_length);
+ case HASHKIT_HASH_FNV1_64:
+ return libhashkit_fnv1_64(key, key_length);
+ case HASHKIT_HASH_FNV1A_64:
+ return libhashkit_fnv1a_64(key, key_length);
+ case HASHKIT_HASH_FNV1_32:
+ return libhashkit_fnv1_32(key, key_length);
+ case HASHKIT_HASH_FNV1A_32:
+ return libhashkit_fnv1a_32(key, key_length);
case HASHKIT_HASH_HSIEH:
#ifdef HAVE_HSIEH_HASH
return libhashkit_hsieh(key, key_length);
#else
return 1;
#endif
- case HASHKIT_HASH_MURMUR3: return libhashkit_murmur3(key, key_length);
+ case HASHKIT_HASH_MURMUR3:
+ return libhashkit_murmur3(key, key_length);
case HASHKIT_HASH_MURMUR:
#ifdef HAVE_MURMUR_HASH
#else
return 1;
#endif
- case HASHKIT_HASH_JENKINS: return libhashkit_jenkins(key, key_length);
+ case HASHKIT_HASH_JENKINS:
+ return libhashkit_jenkins(key, key_length);
case HASHKIT_HASH_CUSTOM:
case HASHKIT_HASH_MAX:
default:
}
switch (hash_algorithm) {
- case HASHKIT_HASH_MD5: self->function = hashkit_md5; break;
+ case HASHKIT_HASH_MD5:
+ self->function = hashkit_md5;
+ break;
- case HASHKIT_HASH_CRC: self->function = hashkit_crc32; break;
+ case HASHKIT_HASH_CRC:
+ self->function = hashkit_crc32;
+ break;
case HASHKIT_HASH_FNV1_64:
if (libhashkit_has_algorithm(HASHKIT_HASH_FNV1_64)) {
}
return HASHKIT_INVALID_ARGUMENT;
- case HASHKIT_HASH_FNV1_32: self->function = hashkit_fnv1_32; break;
+ case HASHKIT_HASH_FNV1_32:
+ self->function = hashkit_fnv1_32;
+ break;
- case HASHKIT_HASH_FNV1A_32: self->function = hashkit_fnv1a_32; break;
+ case HASHKIT_HASH_FNV1A_32:
+ self->function = hashkit_fnv1a_32;
+ break;
case HASHKIT_HASH_HSIEH:
if (libhashkit_has_algorithm(HASHKIT_HASH_HSIEH)) {
}
return HASHKIT_INVALID_ARGUMENT;
- case HASHKIT_HASH_JENKINS: self->function = hashkit_jenkins; break;
+ case HASHKIT_HASH_JENKINS:
+ self->function = hashkit_jenkins;
+ break;
- case HASHKIT_HASH_CUSTOM: return HASHKIT_INVALID_ARGUMENT;
+ case HASHKIT_HASH_CUSTOM:
+ return HASHKIT_INVALID_ARGUMENT;
- case HASHKIT_HASH_DEFAULT: self->function = hashkit_one_at_a_time; break;
+ case HASHKIT_HASH_DEFAULT:
+ self->function = hashkit_one_at_a_time;
+ break;
- case HASHKIT_HASH_MAX: self->function = hashkit_one_at_a_time; return HASHKIT_INVALID_HASH;
+ case HASHKIT_HASH_MAX:
+ self->function = hashkit_one_at_a_time;
+ return HASHKIT_INVALID_HASH;
}
self->context = NULL;
case HASHKIT_HASH_MD5:
case HASHKIT_HASH_CRC:
case HASHKIT_HASH_JENKINS:
- case HASHKIT_HASH_CUSTOM: return true;
+ case HASHKIT_HASH_CUSTOM:
+ return true;
- case HASHKIT_HASH_MAX: break;
+ case HASHKIT_HASH_MAX:
+ break;
}
return false;
hash += (unsigned char) (*key);
hash ^= hash << 10;
hash += hash >> 1;
- default: break;
+ default:
+ break;
}
/* Force "avalanching" of final 127 bits */
b += k[1] & 0xff;
a += k[0];
break;
- case 4: a += k[0]; break;
- case 3: a += k[0] & 0xffffff; break;
- case 2: a += k[0] & 0xffff; break;
- case 1: a += k[0] & 0xff; break;
- case 0: return c; /* zero length strings require no mixing */
- default: return c;
+ case 4:
+ a += k[0];
+ break;
+ case 3:
+ a += k[0] & 0xffffff;
+ break;
+ case 2:
+ a += k[0] & 0xffff;
+ break;
+ case 1:
+ a += k[0] & 0xff;
+ break;
+ case 0:
+ return c; /* zero length strings require no mixing */
+ default:
+ return c;
}
} else if ((u.i & 0x1) == 0) {
case 5:
b += k8[4];
/* fall through */
- case 4: a += k[0] + (((uint32_t) k[1]) << 16); break;
+ case 4:
+ a += k[0] + (((uint32_t) k[1]) << 16);
+ break;
case 3:
a += ((uint32_t) k8[2]) << 16;
/* fall through */
- case 2: a += k[0]; break;
- case 1: a += k8[0]; break;
- case 0: return c; /* zero length requires no mixing */
- default: return c;
+ case 2:
+ a += k[0];
+ break;
+ case 1:
+ a += k8[0];
+ break;
+ case 0:
+ return c; /* zero length requires no mixing */
+ default:
+ return c;
}
} else { /* need to read the key one byte at a time */
case 2:
a += ((uint32_t) k[1]) << 8;
/* fall through */
- case 1: a += k[0]; break;
- case 0: return c;
- default: return c;
+ case 1:
+ a += k[0];
+ break;
+ case 0:
+ return c;
+ default:
+ return c;
}
#if !WORDS_BIGENDIAN
}
const char *libhashkit_string_hash(hashkit_hash_algorithm_t type) {
switch (type) {
- case HASHKIT_HASH_DEFAULT: return "DEFAULT";
- case HASHKIT_HASH_MD5: return "MD5";
- case HASHKIT_HASH_CRC: return "CRC";
- case HASHKIT_HASH_FNV1_64: return "FNV1_64";
- case HASHKIT_HASH_FNV1A_64: return "FNV1A_64";
- case HASHKIT_HASH_FNV1_32: return "FNV1_32";
- case HASHKIT_HASH_FNV1A_32: return "FNV1A_32";
- case HASHKIT_HASH_HSIEH: return "HSIEH";
- case HASHKIT_HASH_MURMUR: return "MURMUR";
- case HASHKIT_HASH_MURMUR3: return "MURMUR3";
- case HASHKIT_HASH_JENKINS: return "JENKINS";
- case HASHKIT_HASH_CUSTOM: return "CUSTOM";
+ case HASHKIT_HASH_DEFAULT:
+ return "DEFAULT";
+ case HASHKIT_HASH_MD5:
+ return "MD5";
+ case HASHKIT_HASH_CRC:
+ return "CRC";
+ case HASHKIT_HASH_FNV1_64:
+ return "FNV1_64";
+ case HASHKIT_HASH_FNV1A_64:
+ return "FNV1A_64";
+ case HASHKIT_HASH_FNV1_32:
+ return "FNV1_32";
+ case HASHKIT_HASH_FNV1A_32:
+ return "FNV1A_32";
+ case HASHKIT_HASH_HSIEH:
+ return "HSIEH";
+ case HASHKIT_HASH_MURMUR:
+ return "MURMUR";
+ case HASHKIT_HASH_MURMUR3:
+ return "MURMUR3";
+ case HASHKIT_HASH_JENKINS:
+ return "JENKINS";
+ case HASHKIT_HASH_CUSTOM:
+ return "CUSTOM";
default:
- case HASHKIT_HASH_MAX: return "INVALID";
+ case HASHKIT_HASH_MAX:
+ return "INVALID";
}
}
const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc) {
(void) ptr;
switch (rc) {
- case HASHKIT_SUCCESS: return "SUCCESS";
- case HASHKIT_FAILURE: return "FAILURE";
- case HASHKIT_MEMORY_ALLOCATION_FAILURE: return "MEMORY ALLOCATION FAILURE";
- case HASHKIT_INVALID_ARGUMENT: return "INVALID ARGUMENT";
- case HASHKIT_INVALID_HASH: return "INVALID hashkit_hash_algorithm_t";
+ case HASHKIT_SUCCESS:
+ return "SUCCESS";
+ case HASHKIT_FAILURE:
+ return "FAILURE";
+ case HASHKIT_MEMORY_ALLOCATION_FAILURE:
+ return "MEMORY ALLOCATION FAILURE";
+ case HASHKIT_INVALID_ARGUMENT:
+ return "INVALID ARGUMENT";
+ case HASHKIT_INVALID_HASH:
+ return "INVALID hashkit_hash_algorithm_t";
case HASHKIT_MAXIMUM_RETURN:
- default: return "INVALID hashkit_return_t";
+ default:
+ return "INVALID hashkit_return_t";
}
}
case MEMCACHED_DISTRIBUTION_CONSISTENT:
case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA:
case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY:
- case MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED: return true;
+ case MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED:
+ return true;
case MEMCACHED_DISTRIBUTION_MODULA:
case MEMCACHED_DISTRIBUTION_RANDOM:
case MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET:
- case MEMCACHED_DISTRIBUTION_CONSISTENT_MAX: break;
+ case MEMCACHED_DISTRIBUTION_CONSISTENT_MAX:
+ break;
}
return false;
}
switch (flag) {
- case MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS: ptr->number_of_replicas = (uint32_t) data; break;
+ case MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS:
+ ptr->number_of_replicas = (uint32_t) data;
+ break;
- case MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK: ptr->io_msg_watermark = (uint32_t) data; break;
+ case MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK:
+ ptr->io_msg_watermark = (uint32_t) data;
+ break;
- case MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK: ptr->io_bytes_watermark = (uint32_t) data; break;
+ case MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK:
+ ptr->io_bytes_watermark = (uint32_t) data;
+ break;
- case MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH: ptr->io_key_prefetch = (uint32_t) data; break;
+ case MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH:
+ ptr->io_key_prefetch = (uint32_t) data;
+ break;
- case MEMCACHED_BEHAVIOR_SND_TIMEOUT: ptr->snd_timeout = (int32_t) data; break;
+ case MEMCACHED_BEHAVIOR_SND_TIMEOUT:
+ ptr->snd_timeout = (int32_t) data;
+ break;
- case MEMCACHED_BEHAVIOR_RCV_TIMEOUT: ptr->rcv_timeout = (int32_t) data; break;
+ case MEMCACHED_BEHAVIOR_RCV_TIMEOUT:
+ ptr->rcv_timeout = (int32_t) data;
+ break;
- case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS: ptr->flags.auto_eject_hosts = bool(data); break;
+ case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS:
+ ptr->flags.auto_eject_hosts = bool(data);
+ break;
case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT:
if (data == 0) {
ptr->server_failure_limit = uint32_t(data);
break;
- case MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT: ptr->server_timeout_limit = uint32_t(data); break;
+ case MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT:
+ ptr->server_timeout_limit = uint32_t(data);
+ break;
case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL:
send_quit(
ptr->flags.binary_protocol = bool(data);
break;
- case MEMCACHED_BEHAVIOR_SUPPORT_CAS: ptr->flags.support_cas = bool(data); break;
+ case MEMCACHED_BEHAVIOR_SUPPORT_CAS:
+ ptr->flags.support_cas = bool(data);
+ break;
case MEMCACHED_BEHAVIOR_NO_BLOCK:
ptr->flags.no_block = bool(data);
return run_distribution(ptr);
}
- case MEMCACHED_BEHAVIOR_POLL_TIMEOUT: ptr->poll_timeout = (int32_t) data; break;
+ case MEMCACHED_BEHAVIOR_POLL_TIMEOUT:
+ ptr->poll_timeout = (int32_t) data;
+ break;
- case MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT: ptr->connect_timeout = (int32_t) data; break;
+ case MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT:
+ ptr->connect_timeout = (int32_t) data;
+ break;
- case MEMCACHED_BEHAVIOR_RETRY_TIMEOUT: ptr->retry_timeout = int32_t(data); break;
+ case MEMCACHED_BEHAVIOR_RETRY_TIMEOUT:
+ ptr->retry_timeout = int32_t(data);
+ break;
- case MEMCACHED_BEHAVIOR_DEAD_TIMEOUT: ptr->dead_timeout = int32_t(data); break;
+ case MEMCACHED_BEHAVIOR_DEAD_TIMEOUT:
+ ptr->dead_timeout = int32_t(data);
+ break;
case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE:
ptr->send_size = (int32_t) data;
return memcached_set_error(*ptr, MEMCACHED_DEPRECATED, MEMCACHED_AT,
memcached_literal_param("MEMCACHED_BEHAVIOR_USER_DATA deprecated."));
- case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY: ptr->flags.hash_with_namespace = bool(data); break;
+ case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY:
+ ptr->flags.hash_with_namespace = bool(data);
+ break;
case MEMCACHED_BEHAVIOR_NOREPLY:
if (memcached_is_udp(ptr) and bool(data) == false) {
ptr->flags.reply = bool(data) ? false : true;
break;
- case MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS: ptr->flags.auto_eject_hosts = bool(data); break;
+ case MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS:
+ ptr->flags.auto_eject_hosts = bool(data);
+ break;
case MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ:
srandom((uint32_t) time(NULL));
}
switch (flag) {
- case MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS: return ptr->number_of_replicas;
+ case MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS:
+ return ptr->number_of_replicas;
- case MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK: return ptr->io_msg_watermark;
+ case MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK:
+ return ptr->io_msg_watermark;
- case MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK: return ptr->io_bytes_watermark;
+ case MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK:
+ return ptr->io_bytes_watermark;
- case MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH: return ptr->io_key_prefetch;
+ case MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH:
+ return ptr->io_key_prefetch;
- case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL: return ptr->flags.binary_protocol;
+ case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL:
+ return ptr->flags.binary_protocol;
- case MEMCACHED_BEHAVIOR_SUPPORT_CAS: return ptr->flags.support_cas;
+ case MEMCACHED_BEHAVIOR_SUPPORT_CAS:
+ return ptr->flags.support_cas;
- case MEMCACHED_BEHAVIOR_CACHE_LOOKUPS: return true;
+ case MEMCACHED_BEHAVIOR_CACHE_LOOKUPS:
+ return true;
- case MEMCACHED_BEHAVIOR_NO_BLOCK: return ptr->flags.no_block;
+ case MEMCACHED_BEHAVIOR_NO_BLOCK:
+ return ptr->flags.no_block;
- case MEMCACHED_BEHAVIOR_BUFFER_REQUESTS: return ptr->flags.buffer_requests;
+ case MEMCACHED_BEHAVIOR_BUFFER_REQUESTS:
+ return ptr->flags.buffer_requests;
- case MEMCACHED_BEHAVIOR_USE_UDP: return memcached_is_udp(ptr);
+ case MEMCACHED_BEHAVIOR_USE_UDP:
+ return memcached_is_udp(ptr);
- case MEMCACHED_BEHAVIOR_TCP_NODELAY: return ptr->flags.tcp_nodelay;
+ case MEMCACHED_BEHAVIOR_TCP_NODELAY:
+ return ptr->flags.tcp_nodelay;
- case MEMCACHED_BEHAVIOR_VERIFY_KEY: return ptr->flags.verify_key;
+ case MEMCACHED_BEHAVIOR_VERIFY_KEY:
+ return ptr->flags.verify_key;
case MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED:
if (memcached_is_consistent_distribution(ptr)) {
}
return false;
- case MEMCACHED_BEHAVIOR_DISTRIBUTION: return ptr->distribution;
+ case MEMCACHED_BEHAVIOR_DISTRIBUTION:
+ return ptr->distribution;
- case MEMCACHED_BEHAVIOR_KETAMA: return memcached_is_consistent_distribution(ptr);
+ case MEMCACHED_BEHAVIOR_KETAMA:
+ return memcached_is_consistent_distribution(ptr);
- case MEMCACHED_BEHAVIOR_HASH: return hashkit_get_function(&ptr->hashkit);
+ case MEMCACHED_BEHAVIOR_HASH:
+ return hashkit_get_function(&ptr->hashkit);
- case MEMCACHED_BEHAVIOR_KETAMA_HASH: return hashkit_get_distribution_function(&ptr->hashkit);
+ case MEMCACHED_BEHAVIOR_KETAMA_HASH:
+ return hashkit_get_distribution_function(&ptr->hashkit);
- case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS: return ptr->flags.auto_eject_hosts;
+ case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS:
+ return ptr->flags.auto_eject_hosts;
- case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT: return ptr->server_failure_limit;
+ case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT:
+ return ptr->server_failure_limit;
- case MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT: return ptr->server_timeout_limit;
+ case MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT:
+ return ptr->server_timeout_limit;
- case MEMCACHED_BEHAVIOR_SORT_HOSTS: return ptr->flags.use_sort_hosts;
+ case MEMCACHED_BEHAVIOR_SORT_HOSTS:
+ return ptr->flags.use_sort_hosts;
- case MEMCACHED_BEHAVIOR_POLL_TIMEOUT: return (uint64_t) ptr->poll_timeout;
+ case MEMCACHED_BEHAVIOR_POLL_TIMEOUT:
+ return (uint64_t) ptr->poll_timeout;
- case MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT: return (uint64_t) ptr->connect_timeout;
+ case MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT:
+ return (uint64_t) ptr->connect_timeout;
- case MEMCACHED_BEHAVIOR_RETRY_TIMEOUT: return (uint64_t) ptr->retry_timeout;
+ case MEMCACHED_BEHAVIOR_RETRY_TIMEOUT:
+ return (uint64_t) ptr->retry_timeout;
- case MEMCACHED_BEHAVIOR_DEAD_TIMEOUT: return uint64_t(ptr->dead_timeout);
+ case MEMCACHED_BEHAVIOR_DEAD_TIMEOUT:
+ return uint64_t(ptr->dead_timeout);
- case MEMCACHED_BEHAVIOR_SND_TIMEOUT: return (uint64_t) ptr->snd_timeout;
+ case MEMCACHED_BEHAVIOR_SND_TIMEOUT:
+ return (uint64_t) ptr->snd_timeout;
- case MEMCACHED_BEHAVIOR_RCV_TIMEOUT: return (uint64_t) ptr->rcv_timeout;
+ case MEMCACHED_BEHAVIOR_RCV_TIMEOUT:
+ return (uint64_t) ptr->rcv_timeout;
- case MEMCACHED_BEHAVIOR_TCP_KEEPIDLE: return (uint64_t) ptr->tcp_keepidle;
+ case MEMCACHED_BEHAVIOR_TCP_KEEPIDLE:
+ return (uint64_t) ptr->tcp_keepidle;
case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE: {
int sock_size = 0;
memcached_literal_param("MEMCACHED_BEHAVIOR_USER_DATA deprecated."));
return 0;
- case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY: return ptr->flags.hash_with_namespace;
+ case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY:
+ return ptr->flags.hash_with_namespace;
- case MEMCACHED_BEHAVIOR_NOREPLY: return ptr->flags.reply ? false : true;
+ case MEMCACHED_BEHAVIOR_NOREPLY:
+ return ptr->flags.reply ? false : true;
- case MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS: return ptr->flags.auto_eject_hosts;
+ case MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS:
+ return ptr->flags.auto_eject_hosts;
- case MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ: return ptr->flags.randomize_replica_read;
+ case MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ:
+ return ptr->flags.randomize_replica_read;
case MEMCACHED_BEHAVIOR_CORK:
#ifdef HAVE_MSG_MORE
return false;
#endif
- case MEMCACHED_BEHAVIOR_TCP_KEEPALIVE: return ptr->flags.tcp_keepalive;
+ case MEMCACHED_BEHAVIOR_TCP_KEEPALIVE:
+ return ptr->flags.tcp_keepalive;
- case MEMCACHED_BEHAVIOR_LOAD_FROM_FILE: return bool(memcached_parse_filename(ptr));
+ case MEMCACHED_BEHAVIOR_LOAD_FROM_FILE:
+ return bool(memcached_parse_filename(ptr));
case MEMCACHED_BEHAVIOR_MAX:
- default: assert_msg(0, "Invalid behavior passed to memcached_behavior_get()"); return 0;
+ default:
+ assert_msg(0, "Invalid behavior passed to memcached_behavior_get()");
+ return 0;
}
/* NOTREACHED */
Memcached *ptr = memcached2Memcached(shell);
if (ptr) {
switch (type) {
- case MEMCACHED_DISTRIBUTION_MODULA: break;
+ case MEMCACHED_DISTRIBUTION_MODULA:
+ break;
case MEMCACHED_DISTRIBUTION_CONSISTENT:
- case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA: memcached_set_weighted_ketama(ptr, false); break;
+ case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA:
+ memcached_set_weighted_ketama(ptr, false);
+ break;
- case MEMCACHED_DISTRIBUTION_RANDOM: break;
+ case MEMCACHED_DISTRIBUTION_RANDOM:
+ break;
- case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY: break;
+ case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY:
+ break;
case MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED:
memcached_set_weighted_ketama(ptr, true);
break;
- case MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET: break;
+ case MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET:
+ break;
default:
case MEMCACHED_DISTRIBUTION_CONSISTENT_MAX:
const char *libmemcached_string_behavior(const memcached_behavior_t flag) {
switch (flag) {
- case MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT: return "MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT";
- case MEMCACHED_BEHAVIOR_NO_BLOCK: return "MEMCACHED_BEHAVIOR_NO_BLOCK";
- case MEMCACHED_BEHAVIOR_TCP_NODELAY: return "MEMCACHED_BEHAVIOR_TCP_NODELAY";
- case MEMCACHED_BEHAVIOR_HASH: return "MEMCACHED_BEHAVIOR_HASH";
- case MEMCACHED_BEHAVIOR_KETAMA: return "MEMCACHED_BEHAVIOR_KETAMA";
- case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE: return "MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE";
- case MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE: return "MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE";
- case MEMCACHED_BEHAVIOR_CACHE_LOOKUPS: return "MEMCACHED_BEHAVIOR_CACHE_LOOKUPS";
- case MEMCACHED_BEHAVIOR_SUPPORT_CAS: return "MEMCACHED_BEHAVIOR_SUPPORT_CAS";
- case MEMCACHED_BEHAVIOR_POLL_TIMEOUT: return "MEMCACHED_BEHAVIOR_POLL_TIMEOUT";
- case MEMCACHED_BEHAVIOR_DISTRIBUTION: return "MEMCACHED_BEHAVIOR_DISTRIBUTION";
- case MEMCACHED_BEHAVIOR_BUFFER_REQUESTS: return "MEMCACHED_BEHAVIOR_BUFFER_REQUESTS";
- case MEMCACHED_BEHAVIOR_USER_DATA: return "MEMCACHED_BEHAVIOR_USER_DATA";
- case MEMCACHED_BEHAVIOR_SORT_HOSTS: return "MEMCACHED_BEHAVIOR_SORT_HOSTS";
- case MEMCACHED_BEHAVIOR_VERIFY_KEY: return "MEMCACHED_BEHAVIOR_VERIFY_KEY";
- case MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT: return "MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT";
- case MEMCACHED_BEHAVIOR_RETRY_TIMEOUT: return "MEMCACHED_BEHAVIOR_RETRY_TIMEOUT";
- case MEMCACHED_BEHAVIOR_DEAD_TIMEOUT: return "MEMCACHED_BEHAVIOR_DEAD_TIMEOUT";
- case MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED: return "MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED";
- case MEMCACHED_BEHAVIOR_KETAMA_HASH: return "MEMCACHED_BEHAVIOR_KETAMA_HASH";
- case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL: return "MEMCACHED_BEHAVIOR_BINARY_PROTOCOL";
- case MEMCACHED_BEHAVIOR_SND_TIMEOUT: return "MEMCACHED_BEHAVIOR_SND_TIMEOUT";
- case MEMCACHED_BEHAVIOR_RCV_TIMEOUT: return "MEMCACHED_BEHAVIOR_RCV_TIMEOUT";
- case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT: return "MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT";
- case MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK: return "MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK";
- case MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK: return "MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK";
- case MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH: return "MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH";
- case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY: return "MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY";
- case MEMCACHED_BEHAVIOR_NOREPLY: return "MEMCACHED_BEHAVIOR_NOREPLY";
- case MEMCACHED_BEHAVIOR_USE_UDP: return "MEMCACHED_BEHAVIOR_USE_UDP";
- case MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS: return "MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS";
- case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS: return "MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS";
- case MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS: return "MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS";
+ case MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT:
+ return "MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT";
+ case MEMCACHED_BEHAVIOR_NO_BLOCK:
+ return "MEMCACHED_BEHAVIOR_NO_BLOCK";
+ case MEMCACHED_BEHAVIOR_TCP_NODELAY:
+ return "MEMCACHED_BEHAVIOR_TCP_NODELAY";
+ case MEMCACHED_BEHAVIOR_HASH:
+ return "MEMCACHED_BEHAVIOR_HASH";
+ case MEMCACHED_BEHAVIOR_KETAMA:
+ return "MEMCACHED_BEHAVIOR_KETAMA";
+ case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE:
+ return "MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE";
+ case MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE:
+ return "MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE";
+ case MEMCACHED_BEHAVIOR_CACHE_LOOKUPS:
+ return "MEMCACHED_BEHAVIOR_CACHE_LOOKUPS";
+ case MEMCACHED_BEHAVIOR_SUPPORT_CAS:
+ return "MEMCACHED_BEHAVIOR_SUPPORT_CAS";
+ case MEMCACHED_BEHAVIOR_POLL_TIMEOUT:
+ return "MEMCACHED_BEHAVIOR_POLL_TIMEOUT";
+ case MEMCACHED_BEHAVIOR_DISTRIBUTION:
+ return "MEMCACHED_BEHAVIOR_DISTRIBUTION";
+ case MEMCACHED_BEHAVIOR_BUFFER_REQUESTS:
+ return "MEMCACHED_BEHAVIOR_BUFFER_REQUESTS";
+ case MEMCACHED_BEHAVIOR_USER_DATA:
+ return "MEMCACHED_BEHAVIOR_USER_DATA";
+ case MEMCACHED_BEHAVIOR_SORT_HOSTS:
+ return "MEMCACHED_BEHAVIOR_SORT_HOSTS";
+ case MEMCACHED_BEHAVIOR_VERIFY_KEY:
+ return "MEMCACHED_BEHAVIOR_VERIFY_KEY";
+ case MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT:
+ return "MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT";
+ case MEMCACHED_BEHAVIOR_RETRY_TIMEOUT:
+ return "MEMCACHED_BEHAVIOR_RETRY_TIMEOUT";
+ case MEMCACHED_BEHAVIOR_DEAD_TIMEOUT:
+ return "MEMCACHED_BEHAVIOR_DEAD_TIMEOUT";
+ case MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED:
+ return "MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED";
+ case MEMCACHED_BEHAVIOR_KETAMA_HASH:
+ return "MEMCACHED_BEHAVIOR_KETAMA_HASH";
+ case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL:
+ return "MEMCACHED_BEHAVIOR_BINARY_PROTOCOL";
+ case MEMCACHED_BEHAVIOR_SND_TIMEOUT:
+ return "MEMCACHED_BEHAVIOR_SND_TIMEOUT";
+ case MEMCACHED_BEHAVIOR_RCV_TIMEOUT:
+ return "MEMCACHED_BEHAVIOR_RCV_TIMEOUT";
+ case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT:
+ return "MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT";
+ case MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK:
+ return "MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK";
+ case MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK:
+ return "MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK";
+ case MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH:
+ return "MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH";
+ case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY:
+ return "MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY";
+ case MEMCACHED_BEHAVIOR_NOREPLY:
+ return "MEMCACHED_BEHAVIOR_NOREPLY";
+ case MEMCACHED_BEHAVIOR_USE_UDP:
+ return "MEMCACHED_BEHAVIOR_USE_UDP";
+ case MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS:
+ return "MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS";
+ case MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS:
+ return "MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS";
+ case MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS:
+ return "MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS";
case MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ:
return "MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ";
- case MEMCACHED_BEHAVIOR_CORK: return "MEMCACHED_BEHAVIOR_CORK";
- case MEMCACHED_BEHAVIOR_TCP_KEEPALIVE: return "MEMCACHED_BEHAVIOR_TCP_KEEPALIVE";
- case MEMCACHED_BEHAVIOR_TCP_KEEPIDLE: return "MEMCACHED_BEHAVIOR_TCP_KEEPIDLE";
- case MEMCACHED_BEHAVIOR_LOAD_FROM_FILE: return "MEMCACHED_BEHAVIOR_LOAD_FROM_FILE";
+ case MEMCACHED_BEHAVIOR_CORK:
+ return "MEMCACHED_BEHAVIOR_CORK";
+ case MEMCACHED_BEHAVIOR_TCP_KEEPALIVE:
+ return "MEMCACHED_BEHAVIOR_TCP_KEEPALIVE";
+ case MEMCACHED_BEHAVIOR_TCP_KEEPIDLE:
+ return "MEMCACHED_BEHAVIOR_TCP_KEEPIDLE";
+ case MEMCACHED_BEHAVIOR_LOAD_FROM_FILE:
+ return "MEMCACHED_BEHAVIOR_LOAD_FROM_FILE";
default:
- case MEMCACHED_BEHAVIOR_MAX: return "INVALID memcached_behavior_t";
+ case MEMCACHED_BEHAVIOR_MAX:
+ return "INVALID memcached_behavior_t";
}
}
const char *libmemcached_string_distribution(const memcached_server_distribution_t flag) {
switch (flag) {
- case MEMCACHED_DISTRIBUTION_MODULA: return "MEMCACHED_DISTRIBUTION_MODULA";
- case MEMCACHED_DISTRIBUTION_CONSISTENT: return "MEMCACHED_DISTRIBUTION_CONSISTENT";
- case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA: return "MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA";
- case MEMCACHED_DISTRIBUTION_RANDOM: return "MEMCACHED_DISTRIBUTION_RANDOM";
+ case MEMCACHED_DISTRIBUTION_MODULA:
+ return "MEMCACHED_DISTRIBUTION_MODULA";
+ case MEMCACHED_DISTRIBUTION_CONSISTENT:
+ return "MEMCACHED_DISTRIBUTION_CONSISTENT";
+ case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA:
+ return "MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA";
+ case MEMCACHED_DISTRIBUTION_RANDOM:
+ return "MEMCACHED_DISTRIBUTION_RANDOM";
case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY:
return "MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY";
case MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED:
return "MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED";
- case MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET: return "MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET";
+ case MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET:
+ return "MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET";
default:
- case MEMCACHED_DISTRIBUTION_CONSISTENT_MAX: return "INVALID memcached_server_distribution_t";
+ case MEMCACHED_DISTRIBUTION_CONSISTENT_MAX:
+ return "INVALID memcached_server_distribution_t";
}
}
return *(void **) &ptr->delete_trigger;
}
- case MEMCACHED_CALLBACK_MAX: break;
+ case MEMCACHED_CALLBACK_MAX:
+ break;
}
assert_msg(0, "Invalid callback passed to memcached_callback_get()");
#ifdef __linux__
case ERESTART:
#endif
- case EINTR: continue;
+ case EINTR:
+ continue;
case EFAULT:
case ENOMEM:
switch (errno) {
case EINPROGRESS:
case EALREADY:
- case EAGAIN: server->events(POLLOUT); break;
+ case EAGAIN:
+ server->events(POLLOUT);
+ break;
- case EINTR: server->reset_socket(); continue;
+ case EINTR:
+ server->reset_socket();
+ continue;
case EISCONN: /* We were spinning waiting on connect */
{
/* An error occurred */
int local_error = get_socket_errno();
switch (local_error) {
- case ETIMEDOUT: timeout_error_occured = true; break;
+ case ETIMEDOUT:
+ timeout_error_occured = true;
+ break;
#if EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
case ECONNREFUSED:
// Probably not running service
- default: memcached_set_errno(*server, local_error, MEMCACHED_AT); break;
+ default:
+ memcached_set_errno(*server, local_error, MEMCACHED_AT);
+ break;
}
WATCHPOINT_ASSERT(server->fd != INVALID_SOCKET);
/* We need to clean up the multi startup piece */
switch (server->type) {
case MEMCACHED_CONNECTION_UDP:
- case MEMCACHED_CONNECTION_TCP: rc = network_connect(server);
+ case MEMCACHED_CONNECTION_TCP:
+ rc = network_connect(server);
#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT)
if (LIBMEMCACHED_WITH_SASL_SUPPORT) {
#endif
break;
- case MEMCACHED_CONNECTION_UNIX_SOCKET: rc = unix_socket_connect(server); break;
+ case MEMCACHED_CONNECTION_UNIX_SOCKET:
+ rc = unix_socket_connect(server);
+ break;
}
if (memcached_success(rc)) {
memcached_string_create(memc, &_string_buffer, 1024);
}
- bool end() { return _end; }
+ bool end() {
+ return _end;
+ }
void start();
bool set_hash(memcached_hash_t hash);
- void set_server() { _is_server = true; }
+ void set_server() {
+ _is_server = true;
+ }
- void unset_server() { _is_server = false; }
+ void unset_server() {
+ _is_server = false;
+ }
- bool is_server() const { return _is_server; }
+ bool is_server() const {
+ return _is_server;
+ }
void hostname(const char *, size_t, server_t &);
bool string_buffer(const char *, size_t, memcached_string_t &);
- const char *hostname() const { return _hostname; }
+ const char *hostname() const {
+ return _hostname;
+ }
void abort(const char *, config_tokentype, const char *);
void error(const char *, config_tokentype, const char *);
bool memcached_flag(const memcached_st &memc, const memcached_flag_t flag) {
switch (flag) {
- case MEMCACHED_FLAG_AUTO_EJECT_HOSTS: return memcached_is_auto_eject_hosts(&memc);
+ case MEMCACHED_FLAG_AUTO_EJECT_HOSTS:
+ return memcached_is_auto_eject_hosts(&memc);
- case MEMCACHED_FLAG_BINARY_PROTOCOL: return memcached_is_binary(&memc);
+ case MEMCACHED_FLAG_BINARY_PROTOCOL:
+ return memcached_is_binary(&memc);
- case MEMCACHED_FLAG_BUFFER_REQUESTS: return memcached_is_buffering(&memc);
+ case MEMCACHED_FLAG_BUFFER_REQUESTS:
+ return memcached_is_buffering(&memc);
- case MEMCACHED_FLAG_HASH_WITH_NAMESPACE: return memcached_is_hash_with_namespace(&memc);
+ case MEMCACHED_FLAG_HASH_WITH_NAMESPACE:
+ return memcached_is_hash_with_namespace(&memc);
- case MEMCACHED_FLAG_NO_BLOCK: return memcached_is_no_block(&memc);
+ case MEMCACHED_FLAG_NO_BLOCK:
+ return memcached_is_no_block(&memc);
- case MEMCACHED_FLAG_REPLY: return memcached_is_replying(&memc);
+ case MEMCACHED_FLAG_REPLY:
+ return memcached_is_replying(&memc);
- case MEMCACHED_FLAG_RANDOMIZE_REPLICA_READ: return memcached_is_randomize_replica_read(&memc);
+ case MEMCACHED_FLAG_RANDOMIZE_REPLICA_READ:
+ return memcached_is_randomize_replica_read(&memc);
- case MEMCACHED_FLAG_SUPPORT_CAS: return memcached_is_cas(&memc);
+ case MEMCACHED_FLAG_SUPPORT_CAS:
+ return memcached_is_cas(&memc);
- case MEMCACHED_FLAG_TCP_NODELAY: return memcached_is_tcp_nodelay(&memc);
+ case MEMCACHED_FLAG_TCP_NODELAY:
+ return memcached_is_tcp_nodelay(&memc);
- case MEMCACHED_FLAG_USE_SORT_HOSTS: return memcached_is_use_sort_hosts(&memc);
+ case MEMCACHED_FLAG_USE_SORT_HOSTS:
+ return memcached_is_use_sort_hosts(&memc);
- case MEMCACHED_FLAG_USE_UDP: return memcached_is_udp(&memc);
+ case MEMCACHED_FLAG_USE_UDP:
+ return memcached_is_udp(&memc);
- case MEMCACHED_FLAG_VERIFY_KEY: return memcached_is_verify_key(&memc);
+ case MEMCACHED_FLAG_VERIFY_KEY:
+ return memcached_is_verify_key(&memc);
- case MEMCACHED_FLAG_TCP_KEEPALIVE: return memcached_is_use_sort_hosts(&memc);
+ case MEMCACHED_FLAG_TCP_KEEPALIVE:
+ return memcached_is_use_sort_hosts(&memc);
- case MEMCACHED_FLAG_IS_AES: return memcached_is_aes(&memc);
+ case MEMCACHED_FLAG_IS_AES:
+ return memcached_is_aes(&memc);
- case MEMCACHED_FLAG_IS_FETCHING_VERSION: return memcached_is_fetching_version(&memc);
+ case MEMCACHED_FLAG_IS_FETCHING_VERSION:
+ return memcached_is_fetching_version(&memc);
}
abort();
void memcached_flag(memcached_st &memc, const memcached_flag_t flag, const bool arg) {
switch (flag) {
- case MEMCACHED_FLAG_AUTO_EJECT_HOSTS: memcached_set_auto_eject_hosts(memc, arg); break;
+ case MEMCACHED_FLAG_AUTO_EJECT_HOSTS:
+ memcached_set_auto_eject_hosts(memc, arg);
+ break;
- case MEMCACHED_FLAG_BINARY_PROTOCOL: memcached_set_binary(memc, arg); break;
+ case MEMCACHED_FLAG_BINARY_PROTOCOL:
+ memcached_set_binary(memc, arg);
+ break;
- case MEMCACHED_FLAG_BUFFER_REQUESTS: memcached_set_buffering(memc, arg); break;
+ case MEMCACHED_FLAG_BUFFER_REQUESTS:
+ memcached_set_buffering(memc, arg);
+ break;
- case MEMCACHED_FLAG_HASH_WITH_NAMESPACE: memcached_set_hash_with_namespace(memc, arg); break;
+ case MEMCACHED_FLAG_HASH_WITH_NAMESPACE:
+ memcached_set_hash_with_namespace(memc, arg);
+ break;
- case MEMCACHED_FLAG_NO_BLOCK: memcached_set_no_block(memc, arg); break;
+ case MEMCACHED_FLAG_NO_BLOCK:
+ memcached_set_no_block(memc, arg);
+ break;
- case MEMCACHED_FLAG_REPLY: memcached_set_replying(memc, arg); break;
+ case MEMCACHED_FLAG_REPLY:
+ memcached_set_replying(memc, arg);
+ break;
case MEMCACHED_FLAG_RANDOMIZE_REPLICA_READ:
memcached_set_randomize_replica_read(memc, arg);
break;
- case MEMCACHED_FLAG_SUPPORT_CAS: memcached_set_cas(memc, arg); break;
+ case MEMCACHED_FLAG_SUPPORT_CAS:
+ memcached_set_cas(memc, arg);
+ break;
- case MEMCACHED_FLAG_TCP_NODELAY: memcached_set_tcp_nodelay(memc, arg); break;
+ case MEMCACHED_FLAG_TCP_NODELAY:
+ memcached_set_tcp_nodelay(memc, arg);
+ break;
- case MEMCACHED_FLAG_USE_SORT_HOSTS: memcached_set_use_sort_hosts(memc, arg); break;
+ case MEMCACHED_FLAG_USE_SORT_HOSTS:
+ memcached_set_use_sort_hosts(memc, arg);
+ break;
- case MEMCACHED_FLAG_USE_UDP: memcached_set_udp(memc, arg); break;
+ case MEMCACHED_FLAG_USE_UDP:
+ memcached_set_udp(memc, arg);
+ break;
- case MEMCACHED_FLAG_VERIFY_KEY: memcached_set_verify_key(memc, arg); break;
+ case MEMCACHED_FLAG_VERIFY_KEY:
+ memcached_set_verify_key(memc, arg);
+ break;
- case MEMCACHED_FLAG_TCP_KEEPALIVE: memcached_set_use_sort_hosts(memc, arg); break;
+ case MEMCACHED_FLAG_TCP_KEEPALIVE:
+ memcached_set_use_sort_hosts(memc, arg);
+ break;
- case MEMCACHED_FLAG_IS_AES: memcached_set_aes(memc, arg); break;
+ case MEMCACHED_FLAG_IS_AES:
+ memcached_set_aes(memc, arg);
+ break;
- case MEMCACHED_FLAG_IS_FETCHING_VERSION: memcached_set_fetching_version(memc, arg); break;
+ case MEMCACHED_FLAG_IS_FETCHING_VERSION:
+ memcached_set_fetching_version(memc, arg);
+ break;
}
}
right = begin;
return right->index;
}
- case MEMCACHED_DISTRIBUTION_MODULA: return hash % memcached_server_count(ptr);
- case MEMCACHED_DISTRIBUTION_RANDOM: return (uint32_t) random() % memcached_server_count(ptr);
+ case MEMCACHED_DISTRIBUTION_MODULA:
+ return hash % memcached_server_count(ptr);
+ case MEMCACHED_DISTRIBUTION_RANDOM:
+ return (uint32_t) random() % memcached_server_count(ptr);
case MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET: {
return memcached_virtual_bucket_get(ptr, hash);
}
case MEMCACHED_DISTRIBUTION_CONSISTENT:
case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA:
case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY:
- case MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED: return update_continuum(ptr);
+ case MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED:
+ return update_continuum(ptr);
case MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET:
- case MEMCACHED_DISTRIBUTION_MODULA: break;
+ case MEMCACHED_DISTRIBUTION_MODULA:
+ break;
- case MEMCACHED_DISTRIBUTION_RANDOM: srandom((uint32_t) time(NULL)); break;
+ case MEMCACHED_DISTRIBUTION_RANDOM:
+ srandom((uint32_t) time(NULL));
+ break;
case MEMCACHED_DISTRIBUTION_CONSISTENT_MAX:
- default: assert_msg(0, "Invalid distribution type passed to run_distribution()");
+ default:
+ assert_msg(0, "Invalid distribution type passed to run_distribution()");
}
return MEMCACHED_SUCCESS;
memcached_set_error(*instance, MEMCACHED_CONNECTION_FAILURE, MEMCACHED_AT);
} else {
switch (get_socket_errno()) {
- case EINTR: continue;
+ case EINTR:
+ continue;
#if EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
break; // No IO is fine, we can just move on
- default: memcached_set_errno(*instance, get_socket_errno(), MEMCACHED_AT);
+ default:
+ memcached_set_errno(*instance, get_socket_errno(), MEMCACHED_AT);
}
}
#ifdef __linux
case ERESTART:
#endif
- case EINTR: continue;
+ case EINTR:
+ continue;
case EFAULT:
case ENOMEM:
WATCHPOINT_NUMBER(get_socket_errno());
#endif
switch (get_socket_errno()) {
- case ENOBUFS: continue;
+ case ENOBUFS:
+ continue;
#if EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
case EINVAL:
case EFAULT:
case ECONNREFUSED:
- default: return MEMCACHED_CONNECTION_FAILURE; // We want this!
+ default:
+ return MEMCACHED_CONNECTION_FAILURE; // We want this!
}
}
} while (data_read > 0);
case -1:
memcached_set_errno(*memc, get_socket_errno(), MEMCACHED_AT);
/* FALLTHROUGH */
- case 0: break;
+ case 0:
+ break;
default:
for (nfds_t x = 0; x < host_index; ++x) {
memcached_set_purging(_memc, true);
}
- ~Purge() { memcached_set_purging(_memc, false); }
+ ~Purge() {
+ memcached_set_purging(_memc, false);
+ }
private:
Memcached *_memc;
_origin = ms;
}
- ~PollTimeout() { _origin = _timeout; }
+ ~PollTimeout() {
+ _origin = _timeout;
+ }
private:
int32_t _timeout;
return MEMCACHED_SUCCESS;
}
- default: break;
+ default:
+ break;
}
buffer[total_read] = 0;
case PROTOCOL_BINARY_CMD_ADDQ:
case PROTOCOL_BINARY_CMD_REPLACEQ:
case PROTOCOL_BINARY_CMD_APPENDQ:
- case PROTOCOL_BINARY_CMD_PREPENDQ: return MEMCACHED_FETCH_NOTFINISHED;
+ case PROTOCOL_BINARY_CMD_PREPENDQ:
+ return MEMCACHED_FETCH_NOTFINISHED;
- default: break;
+ default:
+ break;
}
}
rc = MEMCACHED_SUCCESS;
if (header.response.status != 0) {
switch (header.response.status) {
- case PROTOCOL_BINARY_RESPONSE_KEY_ENOENT: rc = MEMCACHED_NOTFOUND; break;
+ case PROTOCOL_BINARY_RESPONSE_KEY_ENOENT:
+ rc = MEMCACHED_NOTFOUND;
+ break;
- case PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS: rc = MEMCACHED_DATA_EXISTS; break;
+ case PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS:
+ rc = MEMCACHED_DATA_EXISTS;
+ break;
- case PROTOCOL_BINARY_RESPONSE_NOT_STORED: rc = MEMCACHED_NOTSTORED; break;
+ case PROTOCOL_BINARY_RESPONSE_NOT_STORED:
+ rc = MEMCACHED_NOTSTORED;
+ break;
- case PROTOCOL_BINARY_RESPONSE_E2BIG: rc = MEMCACHED_E2BIG; break;
+ case PROTOCOL_BINARY_RESPONSE_E2BIG:
+ rc = MEMCACHED_E2BIG;
+ break;
- case PROTOCOL_BINARY_RESPONSE_ENOMEM: rc = MEMCACHED_MEMORY_ALLOCATION_FAILURE; break;
+ case PROTOCOL_BINARY_RESPONSE_ENOMEM:
+ rc = MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+ break;
- case PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE: rc = MEMCACHED_AUTH_CONTINUE; break;
+ case PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE:
+ rc = MEMCACHED_AUTH_CONTINUE;
+ break;
- case PROTOCOL_BINARY_RESPONSE_AUTH_ERROR: rc = MEMCACHED_AUTH_FAILURE; break;
+ case PROTOCOL_BINARY_RESPONSE_AUTH_ERROR:
+ rc = MEMCACHED_AUTH_FAILURE;
+ break;
case PROTOCOL_BINARY_RESPONSE_EINVAL:
case PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND:
switch (source->sasl.callbacks[total].id) {
case SASL_CB_USER:
case SASL_CB_AUTHNAME:
- case SASL_CB_PASS: break;
+ case SASL_CB_PASS:
+ break;
default:
/* I don't know how to deal with this... */
return MEMCACHED_NOT_SUPPORTED;
const char *memcached_server_type(const memcached_instance_st *ptr) {
if (ptr) {
switch (ptr->type) {
- case MEMCACHED_CONNECTION_TCP: return "TCP";
+ case MEMCACHED_CONNECTION_TCP:
+ return "TCP";
- case MEMCACHED_CONNECTION_UDP: return "UDP";
+ case MEMCACHED_CONNECTION_UDP:
+ return "UDP";
- case MEMCACHED_CONNECTION_UNIX_SOCKET: return "SOCKET";
+ case MEMCACHED_CONNECTION_UNIX_SOCKET:
+ return "SOCKET";
}
}
/* Inline this */
static inline const char *storage_op_string(memcached_storage_action_t verb) {
switch (verb) {
- case REPLACE_OP: return "replace ";
+ case REPLACE_OP:
+ return "replace ";
- case ADD_OP: return "add ";
+ case ADD_OP:
+ return "add ";
- case PREPEND_OP: return "prepend ";
+ case PREPEND_OP:
+ return "prepend ";
- case APPEND_OP: return "append ";
+ case APPEND_OP:
+ return "append ";
- case CAS_OP: return "cas ";
+ case CAS_OP:
+ return "cas ";
- case SET_OP: break;
+ case SET_OP:
+ break;
}
return "set ";
case SET_OP:
case ADD_OP:
case CAS_OP:
- case REPLACE_OP: return true;
+ case REPLACE_OP:
+ return true;
case APPEND_OP:
- case PREPEND_OP: break;
+ case PREPEND_OP:
+ break;
}
return false;
static inline uint8_t get_com_code(const memcached_storage_action_t verb, const bool reply) {
if (reply == false) {
switch (verb) {
- case SET_OP: return PROTOCOL_BINARY_CMD_SETQ;
+ case SET_OP:
+ return PROTOCOL_BINARY_CMD_SETQ;
- case ADD_OP: return PROTOCOL_BINARY_CMD_ADDQ;
+ case ADD_OP:
+ return PROTOCOL_BINARY_CMD_ADDQ;
case CAS_OP: /* FALLTHROUGH */
- case REPLACE_OP: return PROTOCOL_BINARY_CMD_REPLACEQ;
+ case REPLACE_OP:
+ return PROTOCOL_BINARY_CMD_REPLACEQ;
- case APPEND_OP: return PROTOCOL_BINARY_CMD_APPENDQ;
+ case APPEND_OP:
+ return PROTOCOL_BINARY_CMD_APPENDQ;
- case PREPEND_OP: return PROTOCOL_BINARY_CMD_PREPENDQ;
+ case PREPEND_OP:
+ return PROTOCOL_BINARY_CMD_PREPENDQ;
}
}
switch (verb) {
- case SET_OP: break;
+ case SET_OP:
+ break;
- case ADD_OP: return PROTOCOL_BINARY_CMD_ADD;
+ case ADD_OP:
+ return PROTOCOL_BINARY_CMD_ADD;
case CAS_OP: /* FALLTHROUGH */
- case REPLACE_OP: return PROTOCOL_BINARY_CMD_REPLACE;
+ case REPLACE_OP:
+ return PROTOCOL_BINARY_CMD_REPLACE;
- case APPEND_OP: return PROTOCOL_BINARY_CMD_APPEND;
+ case APPEND_OP:
+ return PROTOCOL_BINARY_CMD_APPEND;
- case PREPEND_OP: return PROTOCOL_BINARY_CMD_PREPEND;
+ case PREPEND_OP:
+ return PROTOCOL_BINARY_CMD_PREPEND;
}
return PROTOCOL_BINARY_CMD_SET;
const char *memcached_strerror(const memcached_st *, memcached_return_t rc) {
switch (rc) {
- case MEMCACHED_SUCCESS: return "SUCCESS";
+ case MEMCACHED_SUCCESS:
+ return "SUCCESS";
- case MEMCACHED_FAILURE: return "FAILURE";
+ case MEMCACHED_FAILURE:
+ return "FAILURE";
case MEMCACHED_HOST_LOOKUP_FAILURE: // getaddrinfo only
return "getaddrinfo() or getnameinfo() HOSTNAME LOOKUP FAILURE";
- case MEMCACHED_CONNECTION_FAILURE: return "CONNECTION FAILURE";
+ case MEMCACHED_CONNECTION_FAILURE:
+ return "CONNECTION FAILURE";
case MEMCACHED_CONNECTION_BIND_FAILURE: // DEPRECATED, see MEMCACHED_HOST_LOOKUP_FAILURE
return "CONNECTION BIND FAILURE";
- case MEMCACHED_READ_FAILURE: return "READ FAILURE";
+ case MEMCACHED_READ_FAILURE:
+ return "READ FAILURE";
- case MEMCACHED_UNKNOWN_READ_FAILURE: return "UNKNOWN READ FAILURE";
+ case MEMCACHED_UNKNOWN_READ_FAILURE:
+ return "UNKNOWN READ FAILURE";
- case MEMCACHED_PROTOCOL_ERROR: return "PROTOCOL ERROR";
+ case MEMCACHED_PROTOCOL_ERROR:
+ return "PROTOCOL ERROR";
- case MEMCACHED_CLIENT_ERROR: return "CLIENT ERROR";
+ case MEMCACHED_CLIENT_ERROR:
+ return "CLIENT ERROR";
- case MEMCACHED_SERVER_ERROR: return "SERVER ERROR";
+ case MEMCACHED_SERVER_ERROR:
+ return "SERVER ERROR";
- case MEMCACHED_WRITE_FAILURE: return "WRITE FAILURE";
+ case MEMCACHED_WRITE_FAILURE:
+ return "WRITE FAILURE";
- case MEMCACHED_ERROR: return "ERROR was returned by server";
+ case MEMCACHED_ERROR:
+ return "ERROR was returned by server";
- case MEMCACHED_DATA_EXISTS: return "CONNECTION DATA EXISTS";
+ case MEMCACHED_DATA_EXISTS:
+ return "CONNECTION DATA EXISTS";
- case MEMCACHED_DATA_DOES_NOT_EXIST: return "CONNECTION DATA DOES NOT EXIST";
+ case MEMCACHED_DATA_DOES_NOT_EXIST:
+ return "CONNECTION DATA DOES NOT EXIST";
- case MEMCACHED_NOTSTORED: return "NOT STORED";
+ case MEMCACHED_NOTSTORED:
+ return "NOT STORED";
- case MEMCACHED_STORED: return "STORED";
+ case MEMCACHED_STORED:
+ return "STORED";
- case MEMCACHED_NOTFOUND: return "NOT FOUND";
+ case MEMCACHED_NOTFOUND:
+ return "NOT FOUND";
- case MEMCACHED_MEMORY_ALLOCATION_FAILURE: return "MEMORY ALLOCATION FAILURE";
+ case MEMCACHED_MEMORY_ALLOCATION_FAILURE:
+ return "MEMORY ALLOCATION FAILURE";
- case MEMCACHED_PARTIAL_READ: return "PARTIAL READ";
+ case MEMCACHED_PARTIAL_READ:
+ return "PARTIAL READ";
- case MEMCACHED_SOME_ERRORS: return "SOME ERRORS WERE REPORTED";
+ case MEMCACHED_SOME_ERRORS:
+ return "SOME ERRORS WERE REPORTED";
- case MEMCACHED_NO_SERVERS: return "NO SERVERS DEFINED";
+ case MEMCACHED_NO_SERVERS:
+ return "NO SERVERS DEFINED";
- case MEMCACHED_END: return "SERVER END";
+ case MEMCACHED_END:
+ return "SERVER END";
- case MEMCACHED_DELETED: return "SERVER DELETE";
+ case MEMCACHED_DELETED:
+ return "SERVER DELETE";
- case MEMCACHED_VALUE: return "SERVER VALUE";
+ case MEMCACHED_VALUE:
+ return "SERVER VALUE";
- case MEMCACHED_STAT: return "STAT VALUE";
+ case MEMCACHED_STAT:
+ return "STAT VALUE";
- case MEMCACHED_ITEM: return "ITEM VALUE";
+ case MEMCACHED_ITEM:
+ return "ITEM VALUE";
- case MEMCACHED_ERRNO: return "SYSTEM ERROR";
+ case MEMCACHED_ERRNO:
+ return "SYSTEM ERROR";
- case MEMCACHED_FAIL_UNIX_SOCKET: return "COULD NOT OPEN UNIX SOCKET";
+ case MEMCACHED_FAIL_UNIX_SOCKET:
+ return "COULD NOT OPEN UNIX SOCKET";
- case MEMCACHED_NOT_SUPPORTED: return "ACTION NOT SUPPORTED";
+ case MEMCACHED_NOT_SUPPORTED:
+ return "ACTION NOT SUPPORTED";
- case MEMCACHED_FETCH_NOTFINISHED: return "FETCH WAS NOT COMPLETED";
+ case MEMCACHED_FETCH_NOTFINISHED:
+ return "FETCH WAS NOT COMPLETED";
- case MEMCACHED_NO_KEY_PROVIDED: return "A KEY LENGTH OF ZERO WAS PROVIDED";
+ case MEMCACHED_NO_KEY_PROVIDED:
+ return "A KEY LENGTH OF ZERO WAS PROVIDED";
- case MEMCACHED_BUFFERED: return "ACTION QUEUED";
+ case MEMCACHED_BUFFERED:
+ return "ACTION QUEUED";
- case MEMCACHED_TIMEOUT: return "A TIMEOUT OCCURRED";
+ case MEMCACHED_TIMEOUT:
+ return "A TIMEOUT OCCURRED";
- case MEMCACHED_BAD_KEY_PROVIDED: return "A BAD KEY WAS PROVIDED/CHARACTERS OUT OF RANGE";
+ case MEMCACHED_BAD_KEY_PROVIDED:
+ return "A BAD KEY WAS PROVIDED/CHARACTERS OUT OF RANGE";
case MEMCACHED_INVALID_HOST_PROTOCOL:
return "THE HOST TRANSPORT PROTOCOL DOES NOT MATCH THAT OF THE CLIENT";
- case MEMCACHED_SERVER_MARKED_DEAD: return "SERVER IS MARKED DEAD";
+ case MEMCACHED_SERVER_MARKED_DEAD:
+ return "SERVER IS MARKED DEAD";
- case MEMCACHED_UNKNOWN_STAT_KEY: return "ENCOUNTERED AN UNKNOWN STAT KEY";
+ case MEMCACHED_UNKNOWN_STAT_KEY:
+ return "ENCOUNTERED AN UNKNOWN STAT KEY";
- case MEMCACHED_E2BIG: return "ITEM TOO BIG";
+ case MEMCACHED_E2BIG:
+ return "ITEM TOO BIG";
- case MEMCACHED_INVALID_ARGUMENTS: return "INVALID ARGUMENTS";
+ case MEMCACHED_INVALID_ARGUMENTS:
+ return "INVALID ARGUMENTS";
- case MEMCACHED_KEY_TOO_BIG: return "KEY RETURNED FROM SERVER WAS TOO LARGE";
+ case MEMCACHED_KEY_TOO_BIG:
+ return "KEY RETURNED FROM SERVER WAS TOO LARGE";
- case MEMCACHED_AUTH_PROBLEM: return "FAILED TO SEND AUTHENTICATION TO SERVER";
+ case MEMCACHED_AUTH_PROBLEM:
+ return "FAILED TO SEND AUTHENTICATION TO SERVER";
- case MEMCACHED_AUTH_FAILURE: return "AUTHENTICATION FAILURE";
+ case MEMCACHED_AUTH_FAILURE:
+ return "AUTHENTICATION FAILURE";
- case MEMCACHED_AUTH_CONTINUE: return "CONTINUE AUTHENTICATION";
+ case MEMCACHED_AUTH_CONTINUE:
+ return "CONTINUE AUTHENTICATION";
- case MEMCACHED_PARSE_ERROR: return "ERROR OCCURED WHILE PARSING";
+ case MEMCACHED_PARSE_ERROR:
+ return "ERROR OCCURED WHILE PARSING";
- case MEMCACHED_PARSE_USER_ERROR: return "USER INITIATED ERROR OCCURED WHILE PARSING";
+ case MEMCACHED_PARSE_USER_ERROR:
+ return "USER INITIATED ERROR OCCURED WHILE PARSING";
- case MEMCACHED_DEPRECATED: return "DEPRECATED";
+ case MEMCACHED_DEPRECATED:
+ return "DEPRECATED";
- case MEMCACHED_IN_PROGRESS: return "OPERATION IN PROCESS";
+ case MEMCACHED_IN_PROGRESS:
+ return "OPERATION IN PROCESS";
case MEMCACHED_SERVER_TEMPORARILY_DISABLED:
return "SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY";
- case MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE: return "SERVER FAILED TO ALLOCATE OBJECT";
+ case MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE:
+ return "SERVER FAILED TO ALLOCATE OBJECT";
default:
- case MEMCACHED_MAXIMUM_RETURN: return "INVALID memcached_return_t";
+ case MEMCACHED_MAXIMUM_RETURN:
+ return "INVALID memcached_return_t";
}
}
static void print_ascii_command(memcached_protocol_client_st *client) {
if (client->is_verbose) {
switch (client->ascii_command) {
- case SET_CMD: fprintf(stderr, "%s:%d SET_CMD\n", __FILE__, __LINE__); break;
+ case SET_CMD:
+ fprintf(stderr, "%s:%d SET_CMD\n", __FILE__, __LINE__);
+ break;
- case ADD_CMD: fprintf(stderr, "%s:%d ADD_CMD\n", __FILE__, __LINE__); break;
+ case ADD_CMD:
+ fprintf(stderr, "%s:%d ADD_CMD\n", __FILE__, __LINE__);
+ break;
- case REPLACE_CMD: fprintf(stderr, "%s:%d REPLACE_CMD\n", __FILE__, __LINE__); break;
+ case REPLACE_CMD:
+ fprintf(stderr, "%s:%d REPLACE_CMD\n", __FILE__, __LINE__);
+ break;
- case CAS_CMD: fprintf(stderr, "%s:%d CAS_CMD\n", __FILE__, __LINE__); break;
+ case CAS_CMD:
+ fprintf(stderr, "%s:%d CAS_CMD\n", __FILE__, __LINE__);
+ break;
- case APPEND_CMD: fprintf(stderr, "%s:%d APPEND_CMD\n", __FILE__, __LINE__); break;
+ case APPEND_CMD:
+ fprintf(stderr, "%s:%d APPEND_CMD\n", __FILE__, __LINE__);
+ break;
- case PREPEND_CMD: fprintf(stderr, "%s:%d PREPEND_CMD\n", __FILE__, __LINE__); break;
+ case PREPEND_CMD:
+ fprintf(stderr, "%s:%d PREPEND_CMD\n", __FILE__, __LINE__);
+ break;
- case DELETE_CMD: fprintf(stderr, "%s:%d DELETE_CMD\n", __FILE__, __LINE__); break;
+ case DELETE_CMD:
+ fprintf(stderr, "%s:%d DELETE_CMD\n", __FILE__, __LINE__);
+ break;
- case INCR_CMD: /* FALLTHROUGH */ fprintf(stderr, "%s:%d INCR_CMD\n", __FILE__, __LINE__); break;
+ case INCR_CMD: /* FALLTHROUGH */
+ fprintf(stderr, "%s:%d INCR_CMD\n", __FILE__, __LINE__);
+ break;
- case DECR_CMD: fprintf(stderr, "%s:%d DECR_CMD\n", __FILE__, __LINE__); break;
+ case DECR_CMD:
+ fprintf(stderr, "%s:%d DECR_CMD\n", __FILE__, __LINE__);
+ break;
- case STATS_CMD: fprintf(stderr, "%s:%d STATS_CMD\n", __FILE__, __LINE__); break;
+ case STATS_CMD:
+ fprintf(stderr, "%s:%d STATS_CMD\n", __FILE__, __LINE__);
+ break;
- case FLUSH_ALL_CMD: fprintf(stderr, "%s:%d FLUSH_ALL_CMD\n", __FILE__, __LINE__); break;
+ case FLUSH_ALL_CMD:
+ fprintf(stderr, "%s:%d FLUSH_ALL_CMD\n", __FILE__, __LINE__);
+ break;
- case VERSION_CMD: fprintf(stderr, "%s:%d VERSION_CMD\n", __FILE__, __LINE__); break;
+ case VERSION_CMD:
+ fprintf(stderr, "%s:%d VERSION_CMD\n", __FILE__, __LINE__);
+ break;
- case QUIT_CMD: fprintf(stderr, "%s:%d QUIT_CMD\n", __FILE__, __LINE__); break;
+ case QUIT_CMD:
+ fprintf(stderr, "%s:%d QUIT_CMD\n", __FILE__, __LINE__);
+ break;
- case VERBOSITY_CMD: fprintf(stderr, "%s:%d VERBOSITY_CMD\n", __FILE__, __LINE__); break;
+ case VERBOSITY_CMD:
+ fprintf(stderr, "%s:%d VERBOSITY_CMD\n", __FILE__, __LINE__);
+ break;
- case GET_CMD: fprintf(stderr, "%s:%d GET_CMD\n", __FILE__, __LINE__); break;
+ case GET_CMD:
+ fprintf(stderr, "%s:%d GET_CMD\n", __FILE__, __LINE__);
+ break;
- case GETS_CMD: fprintf(stderr, "%s:%d GETS_CMD\n", __FILE__, __LINE__); break;
+ case GETS_CMD:
+ fprintf(stderr, "%s:%d GETS_CMD\n", __FILE__, __LINE__);
+ break;
default:
- case UNKNOWN_CMD: fprintf(stderr, "%s:%d UNKNOWN_CMD\n", __FILE__, __LINE__); break;
+ case UNKNOWN_CMD:
+ fprintf(stderr, "%s:%d UNKNOWN_CMD\n", __FILE__, __LINE__);
+ break;
}
}
}
case QUIT_CMD:
case VERBOSITY_CMD:
case UNKNOWN_CMD:
- default: abort(); /* impossible */
+ default:
+ abort(); /* impossible */
}
if (rval == PROTOCOL_BINARY_RESPONSE_SUCCESS) {
print_ascii_command(client);
switch (client->ascii_command) {
- case SET_CMD: error = process_set_command(client, tokens, ntokens, ptr, &end, *length); break;
+ case SET_CMD:
+ error = process_set_command(client, tokens, ntokens, ptr, &end, *length);
+ break;
- case ADD_CMD: error = process_add_command(client, tokens, ntokens, ptr, &end, *length); break;
+ case ADD_CMD:
+ error = process_add_command(client, tokens, ntokens, ptr, &end, *length);
+ break;
case REPLACE_CMD:
error = process_replace_command(client, tokens, ntokens, ptr, &end, *length);
break;
- case CAS_CMD: error = process_cas_command(client, tokens, ntokens, ptr, &end, *length); break;
+ case CAS_CMD:
+ error = process_cas_command(client, tokens, ntokens, ptr, &end, *length);
+ break;
case APPEND_CMD:
error = process_append_command(client, tokens, ntokens, ptr, &end, *length);
error = process_prepend_command(client, tokens, ntokens, ptr, &end, *length);
break;
- case DELETE_CMD: process_delete(client, tokens, ntokens); break;
+ case DELETE_CMD:
+ process_delete(client, tokens, ntokens);
+ break;
case INCR_CMD: /* FALLTHROUGH */
- case DECR_CMD: process_arithmetic(client, tokens, ntokens); break;
+ case DECR_CMD:
+ process_arithmetic(client, tokens, ntokens);
+ break;
case STATS_CMD:
if (client->mute) {
}
break;
- case FLUSH_ALL_CMD: process_flush(client, tokens, ntokens); break;
+ case FLUSH_ALL_CMD:
+ process_flush(client, tokens, ntokens);
+ break;
case VERSION_CMD:
if (client->mute) {
}
break;
- case UNKNOWN_CMD: send_command_usage(client); break;
+ case UNKNOWN_CMD:
+ send_command_usage(client);
+ break;
case GET_CMD:
case GETS_CMD:
case PROTOCOL_BINARY_CMD_SCRUB:
fprintf(stderr, "%s:%d PROTOCOL_BINARY_CMD_SCRUB\n", __FILE__, __LINE__);
return;
- default: abort();
+ default:
+ abort();
}
}
case PROTOCOL_BINARY_CMD_SETQ:
/* Quiet command shouldn't return on success */
return false;
- default: break;
+ default:
+ break;
}
switch (opcode) {
_timeout.tv_nsec = 0;
}
- const struct timespec &timeout() const { return _timeout; }
+ const struct timespec &timeout() const {
+ return _timeout;
+ }
bool release(memcached_st *, memcached_return_t &rc);
}
}
- void increment_version() { ++master->configure.version; }
+ void increment_version() {
+ ++master->configure.version;
+ }
bool compare_version(const memcached_st *arg) const {
return (arg->configure.version == version());
}
- int32_t version() const { return master->configure.version; }
+ int32_t version() const {
+ return master->configure.version;
+ }
};
/**