#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <inttypes.h>
static void print_ascii_command(memcached_protocol_client_st *client) {
if (client->is_verbose) {
return PROTOCOL_BINARY_RESPONSE_EINTERNAL;
}
- assert(client->output != NULL);
+ assert(client->output);
#if 0
if (client->output == NULL)
{
uint32_t bodylen) {
memcached_protocol_client_st *client = (void *) cookie;
- if (key != NULL) {
+ if (key) {
ascii_raw_response_handler(client, "STAT ");
client->root->spool(client, key, keylen);
ascii_raw_response_handler(client, " ");
uint64_t result;
errno = 0;
uint64_t delta = strtoull(tokens[2], NULL, 10);
- if (errno != 0) {
+ if (errno) {
return; // Error
}
if (ntokens == 2) {
errno = 0;
timeout = (uint32_t) strtoul(tokens[1], NULL, 10);
- if (errno != 0) {
+ if (errno) {
return; // Error
}
}
errno = 0;
uint32_t flags = (uint32_t) strtoul(tokens[2], NULL, 10);
- if (errno != 0) {
+ if (errno) {
/* return error */
ascii_raw_response_handler(client, "CLIENT_ERROR: bad key\r\n");
return -1;
}
uint32_t timeout = (uint32_t) strtoul(tokens[3], NULL, 10);
- if (errno != 0) {
+ if (errno) {
/* return error */
ascii_raw_response_handler(client, "CLIENT_ERROR: bad key\r\n");
return -1;
}
unsigned long nbytes = strtoul(tokens[4], NULL, 10);
- if (errno != 0) {
+ if (errno) {
/* return error */
ascii_raw_response_handler(client, "CLIENT_ERROR: bad key\r\n");
return -1;
case CAS_CMD:
errno = 0;
cas = strtoull(tokens[5], NULL, 10);
- if (errno != 0) {
+ if (errno) {
/* return error */
ascii_raw_response_handler(client, "CLIENT_ERROR: bad key\r\n");
return -1;
client->ascii_command = ascii_to_cmd(ptr, (size_t)(*length));
/* we got all data available, execute the callback! */
- if (client->root->callback->pre_execute != NULL) {
+ if (client->root->callback->pre_execute) {
client->root->callback->pre_execute(client, NULL);
}
* just handle them immediately
*/
if (client->ascii_command == GET_CMD || client->ascii_command == GETS_CMD) {
- if (client->root->callback->interface.v1.get != NULL) {
+ if (client->root->callback->interface.v1.get) {
ascii_process_gets(client, ptr, end);
} else {
ascii_raw_response_handler(client, "SERVER_ERROR: Command not implemented\n");
if (ntokens != 1 || client->mute) {
send_command_usage(client);
} else {
- if (client->root->callback->interface.v1.quit != NULL) {
+ if (client->root->callback->interface.v1.quit) {
client->root->callback->interface.v1.quit(client);
}
}
}
- if (client->root->callback->post_execute != NULL) {
+ if (client->root->callback->post_execute) {
client->root->callback->post_execute(client, NULL);
}