X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Flibmemcachedprotocol%2Fbinary_handler.c;h=ada4c42599cc999fe62c50d796fbe175b2cebdae;hb=800db6e937f7e0e5a0a7028704950c78f51af41e;hp=51fa60be1fb671c512c449b769f57709ea6e6233;hpb=f48bae7d4b6a832b0d3a71812125770f09c76239;p=awesomized%2Flibmemcached diff --git a/src/libmemcachedprotocol/binary_handler.c b/src/libmemcachedprotocol/binary_handler.c index 51fa60be..ada4c425 100644 --- a/src/libmemcachedprotocol/binary_handler.c +++ b/src/libmemcachedprotocol/binary_handler.c @@ -265,7 +265,8 @@ static void print_cmd(protocol_binary_command cmd) { case PROTOCOL_BINARY_CMD_SCRUB: fprintf(stderr, "%s:%d PROTOCOL_BINARY_CMD_SCRUB\n", __FILE__, __LINE__); return; - default: abort(); + default: + abort(); } } @@ -404,7 +405,7 @@ add_command_handler(const void *cookie, protocol_binary_request_header *header, protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.add != NULL) { + if (client->root->callback->interface.v1.add) { uint16_t keylen = ntohs(header->request.keylen); uint32_t datalen = ntohl(header->request.bodylen) - keylen - 8; protocol_binary_request_add *request = (void *) header; @@ -449,7 +450,7 @@ decrement_command_handler(const void *cookie, protocol_binary_request_header *he protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.decrement != NULL) { + if (client->root->callback->interface.v1.decrement) { uint16_t keylen = ntohs(header->request.keylen); protocol_binary_request_decr *request = (void *) header; uint64_t init = memcached_ntohll(request->message.body.initial); @@ -496,7 +497,7 @@ delete_command_handler(const void *cookie, protocol_binary_request_header *heade protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.delete_object != NULL) { + if (client->root->callback->interface.v1.delete_object) { uint16_t keylen = ntohs(header->request.keylen); void *key = (header + 1); uint64_t cas = memcached_ntohll(header->request.cas); @@ -535,7 +536,7 @@ flush_command_handler(const void *cookie, protocol_binary_request_header *header protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.flush_object != NULL) { + if (client->root->callback->interface.v1.flush_object) { protocol_binary_request_flush *flush_object = (void *) header; uint32_t timeout = 0; if (htonl(header->request.bodylen) == 4) { @@ -576,7 +577,7 @@ get_command_handler(const void *cookie, protocol_binary_request_header *header, protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.get != NULL) { + if (client->root->callback->interface.v1.get) { uint16_t keylen = ntohs(header->request.keylen); void *key = (header + 1); rval = client->root->callback->interface.v1.get(cookie, key, keylen, get_response_handler); @@ -609,7 +610,7 @@ increment_command_handler(const void *cookie, protocol_binary_request_header *he protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.increment != NULL) { + if (client->root->callback->interface.v1.increment) { uint16_t keylen = ntohs(header->request.keylen); protocol_binary_request_incr *request = (void *) header; uint64_t init = memcached_ntohll(request->message.body.initial); @@ -656,7 +657,7 @@ static protocol_binary_response_status noop_command_handler(const void *cookie, protocol_binary_request_header *header, memcached_binary_protocol_raw_response_handler response_handler) { memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.noop != NULL) { + if (client->root->callback->interface.v1.noop) { client->root->callback->interface.v1.noop(cookie); } @@ -685,7 +686,7 @@ append_command_handler(const void *cookie, protocol_binary_request_header *heade protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.append != NULL) { + if (client->root->callback->interface.v1.append) { uint16_t keylen = ntohs(header->request.keylen); uint32_t datalen = ntohl(header->request.bodylen) - keylen; char *key = (void *) (header + 1); @@ -733,7 +734,7 @@ prepend_command_handler(const void *cookie, protocol_binary_request_header *head protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.prepend != NULL) { + if (client->root->callback->interface.v1.prepend) { uint16_t keylen = ntohs(header->request.keylen); uint32_t datalen = ntohl(header->request.bodylen) - keylen; char *key = (char *) (header + 1); @@ -777,7 +778,7 @@ static protocol_binary_response_status quit_command_handler(const void *cookie, protocol_binary_request_header *header, memcached_binary_protocol_raw_response_handler response_handler) { memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.quit != NULL) { + if (client->root->callback->interface.v1.quit) { client->root->callback->interface.v1.quit(cookie); } @@ -809,7 +810,7 @@ replace_command_handler(const void *cookie, protocol_binary_request_header *head protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.replace != NULL) { + if (client->root->callback->interface.v1.replace) { uint16_t keylen = ntohs(header->request.keylen); uint32_t datalen = ntohl(header->request.bodylen) - keylen - 8; protocol_binary_request_replace *request = (void *) header; @@ -860,7 +861,7 @@ set_command_handler(const void *cookie, protocol_binary_request_header *header, protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.set != NULL) { + if (client->root->callback->interface.v1.set) { uint16_t keylen = ntohs(header->request.keylen); uint32_t datalen = ntohl(header->request.bodylen) - keylen - 8; protocol_binary_request_replace *request = (void *) header; @@ -910,7 +911,7 @@ stat_command_handler(const void *cookie, protocol_binary_request_header *header, protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.stat != NULL) { + if (client->root->callback->interface.v1.stat) { uint16_t keylen = ntohs(header->request.keylen); rval = client->root->callback->interface.v1.stat(cookie, (void *) (header + 1), keylen, @@ -937,7 +938,7 @@ version_command_handler(const void *cookie, protocol_binary_request_header *head protocol_binary_response_status rval; memcached_protocol_client_st *client = (void *) cookie; - if (client->root->callback->interface.v1.version != NULL) { + if (client->root->callback->interface.v1.version) { rval = client->root->callback->interface.v1.version(cookie, version_response_handler); } else { rval = PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND; @@ -995,7 +996,7 @@ static protocol_binary_response_status execute_command(memcached_protocol_client } /* 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, header); } @@ -1008,14 +1009,14 @@ static protocol_binary_response_status execute_command(memcached_protocol_client switch (client->root->callback->interface_version) { case 0: - if (client->root->callback->interface.v0.comcode[cc] != NULL) { + if (client->root->callback->interface.v0.comcode[cc]) { rval = client->root->callback->interface.v0.comcode[cc](client, header, binary_raw_response_handler); } break; case 1: - if (comcode_v0_v1_remap[cc] != NULL) { + if (comcode_v0_v1_remap[cc]) { rval = comcode_v0_v1_remap[cc](client, header, binary_raw_response_handler); } break; @@ -1028,7 +1029,7 @@ static protocol_binary_response_status execute_command(memcached_protocol_client abort(); } - if (rval == PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND && client->root->callback->unknown != NULL) { + if (rval == PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND && client->root->callback->unknown) { rval = client->root->callback->unknown(client, header, binary_raw_response_handler); } @@ -1047,7 +1048,7 @@ static protocol_binary_response_status execute_command(memcached_protocol_client rval = binary_raw_response_handler(client, header, (void *) &response); } - if (client->root->callback->post_execute != NULL) { + if (client->root->callback->post_execute) { client->root->callback->post_execute(client, header); }