X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=example%2Fmemcached_light.c;h=c064e5199efff18a16635bbc07f477d6e9e78743;hb=9c5fa1db34c5fb1ffed88742caeffa5a9afd0a9e;hp=84635b2a29387e1526d7e2fc2146c46eedfae311;hpb=831d9dafc253a93f28b5c8db2d37481a93b220e7;p=awesomized%2Flibmemcached diff --git a/example/memcached_light.c b/example/memcached_light.c index 84635b2a..c064e519 100644 --- a/example/memcached_light.c +++ b/example/memcached_light.c @@ -34,10 +34,11 @@ #include #include -#include -#include -#include "storage.h" -#include "memcached_light.h" +#include +#include +#include +#include "example/storage.h" +#include "example/memcached_light.h" extern memcached_binary_protocol_callback_st interface_v0_impl; extern memcached_binary_protocol_callback_st interface_v1_impl; @@ -180,7 +181,7 @@ static int server_socket(const char *port) else perror("getaddrinfo()"); - return 1; + return 0; } struct linger ling= {0, 0}; @@ -343,7 +344,7 @@ static protocol_binary_response_status unknown(const void *cookie, * * @param argc number of items in the argument vector * @param argv argument vector - * @return 0 on success, 1 otherwise + * @return EXIT_SUCCESS on success, 1 otherwise */ int main(int argc, char **argv) { @@ -356,7 +357,7 @@ int main(int argc, char **argv) if (event_base == NULL) { fprintf(stderr, "Failed to create an instance of libevent\n"); - return 1; + return EXIT_FAILURE; } /* @@ -389,14 +390,14 @@ int main(int argc, char **argv) default: (void)fprintf(stderr, "Usage: %s [-p port] [-v] [-1] [-c #clients] [-P pidfile]\n", argv[0]); - return 1; + return EXIT_FAILURE; } } if (! initialize_storage()) { /* Error message already printed */ - return 1; + return EXIT_FAILURE; } if (! global_options.has_port) @@ -423,7 +424,7 @@ int main(int argc, char **argv) if (num_server_sockets == 0) { fprintf(stderr, "I don't have any server sockets\n"); - return 1; + return EXIT_FAILURE; } /* @@ -439,14 +440,14 @@ int main(int argc, char **argv) if ((protocol_handle= memcached_protocol_create_instance()) == NULL) { fprintf(stderr, "Failed to allocate protocol handle\n"); - return 1; + return EXIT_FAILURE; } socket_userdata_map= calloc((size_t)(maxconns), sizeof(struct connection)); if (socket_userdata_map == NULL) { fprintf(stderr, "Failed to allocate room for connections\n"); - return 1; + return EXIT_FAILURE; } memcached_binary_protocol_set_callbacks(protocol_handle, interface); @@ -470,5 +471,5 @@ int main(int argc, char **argv) event_base_loop(event_base, 0); /* NOTREACHED */ - return 0; + return EXIT_SUCCESS; }