X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Flibmemcachedprotocol%2Fhandler.c;h=535795cab49bb40bb16b20ec16211c7edad934aa;hb=20690cd266ff724e3ea1c543ea6a5fe47fec27e7;hp=885c798fa6edd113dddee77b5ac1161bd503fdca;hpb=f48bae7d4b6a832b0d3a71812125770f09c76239;p=awesomized%2Flibmemcached diff --git a/src/libmemcachedprotocol/handler.c b/src/libmemcachedprotocol/handler.c index 885c798f..535795ca 100644 --- a/src/libmemcachedprotocol/handler.c +++ b/src/libmemcachedprotocol/handler.c @@ -20,12 +20,13 @@ #include #include #include -#include +#if HAVE_STRINGS_H +# include +#endif #include #include -#include -#include +#include "p9y/socket.hpp" /* ** ********************************************************************** @@ -82,7 +83,7 @@ static bool drain_output(struct memcached_protocol_client_st *client) { } /* Do we have pending data to send? */ - while (client->output != NULL) { + while (client->output) { ssize_t len = client->root->send(client, client->sock, client->output->data + client->output->offset, client->output->nbytes - client->output->offset); @@ -238,7 +239,7 @@ static memcached_protocol_event_t determine_protocol(struct memcached_protocol_c */ struct memcached_protocol_st *memcached_protocol_create_instance(void) { struct memcached_protocol_st *ret = calloc(1, sizeof(*ret)); - if (ret != NULL) { + if (ret) { ret->recv = default_recv; ret->send = default_send; ret->drain = drain_output; @@ -273,7 +274,7 @@ void memcached_protocol_destroy_instance(struct memcached_protocol_st *instance) struct memcached_protocol_client_st * memcached_protocol_create_client(struct memcached_protocol_st *instance, memcached_socket_t sock) { struct memcached_protocol_client_st *ret = calloc(1, sizeof(memcached_protocol_client_st)); - if (ret != NULL) { + if (ret) { ret->root = instance; ret->sock = sock; ret->work = determine_protocol;