From: Brian Aker Date: Fri, 25 Mar 2011 00:42:33 +0000 (-0700) Subject: Fix a few spots where when I did the update for EXIT_ I made more X-Git-Tag: 0.51~20^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=54b628acfd0aa4915d97de81e68355b07c980a7d;p=awesomized%2Flibmemcached Fix a few spots where when I did the update for EXIT_ I made more replacements then what I should have. --- diff --git a/clients/execute.c b/clients/execute.c index dbc102c6..0beaae4b 100644 --- a/clients/execute.c +++ b/clients/execute.c @@ -116,7 +116,7 @@ unsigned int execute_mget(memcached_st *memc, fprintf(stderr, "Failed to execute mget: %s\n", memcached_strerror(memc, rc)); memcached_quit(memc); - return EXIT_SUCCESS; + return 0; } } else @@ -124,7 +124,7 @@ unsigned int execute_mget(memcached_st *memc, fprintf(stderr, "Failed to execute mget: %s\n", memcached_strerror(memc, rc)); memcached_quit(memc); - return EXIT_SUCCESS; + return 0; } return retrieved; diff --git a/example/memcached_light.c b/example/memcached_light.c index 8465ff28..6a87ff19 100644 --- a/example/memcached_light.c +++ b/example/memcached_light.c @@ -180,7 +180,7 @@ static int server_socket(const char *port) else perror("getaddrinfo()"); - return EXIT_FAILURE; + return 0; } struct linger ling= {0, 0}; diff --git a/libhashkit/digest.c b/libhashkit/digest.c index f418dc0b..4ff6de29 100644 --- a/libhashkit/digest.c +++ b/libhashkit/digest.c @@ -35,13 +35,13 @@ uint32_t libhashkit_digest(const char *key, size_t key_length, hashkit_hash_algo #ifdef HAVE_HSIEH_HASH return libhashkit_hsieh(key, key_length); #else - return EXIT_FAILURE; + return 1; #endif case HASHKIT_HASH_MURMUR: #ifdef HAVE_MURMUR_HASH return libhashkit_murmur(key, key_length); #else - return EXIT_FAILURE; + return 1; #endif case HASHKIT_HASH_JENKINS: return libhashkit_jenkins(key, key_length); @@ -56,5 +56,5 @@ uint32_t libhashkit_digest(const char *key, size_t key_length, hashkit_hash_algo break; } - return EXIT_FAILURE; + return 1; } diff --git a/libhashkit/hsieh.c b/libhashkit/hsieh.c index cb5af8ae..ba46ed2c 100644 --- a/libhashkit/hsieh.c +++ b/libhashkit/hsieh.c @@ -23,7 +23,7 @@ uint32_t hashkit_hsieh(const char *key, size_t key_length, void *context __attri int rem; if (key_length <= 0 || key == NULL) - return EXIT_SUCCESS; + return 0; rem = key_length & 3; key_length >>= 2; diff --git a/libhashkit/ketama.c b/libhashkit/ketama.c index 560de300..a510e57a 100644 --- a/libhashkit/ketama.c +++ b/libhashkit/ketama.c @@ -27,9 +27,9 @@ static int continuum_points_cmp(const void *t1, const void *t2) hashkit_continuum_point_st *ct2= (hashkit_continuum_point_st *)t2; if (ct1->value == ct2->value) - return EXIT_SUCCESS; + return 0; else if (ct1->value > ct2->value) - return EXIT_FAILURE; + return 1; else return -1; } @@ -71,7 +71,7 @@ int update_continuum(hashkit_st *hashkit) live_servers= (uint32_t)hashkit->list_size; if (live_servers == 0) - return EXIT_SUCCESS; + return 0; if (hashkit->weight_fn == NULL) { @@ -159,6 +159,6 @@ int update_continuum(hashkit_st *hashkit) qsort(hashkit->continuum, hashkit->continuum_points_count, sizeof(hashkit_continuum_point_st), continuum_points_cmp); - return EXIT_SUCCESS; + return 0; } #endif diff --git a/libmemcached/behavior.c b/libmemcached/behavior.c index f88f0a77..2b6ccdf9 100644 --- a/libmemcached/behavior.c +++ b/libmemcached/behavior.c @@ -314,18 +314,18 @@ uint64_t memcached_behavior_get(memcached_st *ptr, /* We just try the first host, and if it is down we return zero */ if ((memcached_connect(instance)) != MEMCACHED_SUCCESS) { - return EXIT_SUCCESS; + return 0; } if (memcached_io_wait_for_write(instance) != MEMCACHED_SUCCESS) { - return EXIT_SUCCESS; + return 0; } if (getsockopt(instance->fd, SOL_SOCKET, SO_SNDBUF, &sock_size, &sock_length) < 0) { ptr->cached_errno= errno; - return EXIT_SUCCESS; /* Zero means error */ + return 0; /* Zero means error */ } } @@ -350,18 +350,18 @@ uint64_t memcached_behavior_get(memcached_st *ptr, /* We just try the first host, and if it is down we return zero */ if ((memcached_connect(instance)) != MEMCACHED_SUCCESS) { - return EXIT_SUCCESS; + return 0; } if (memcached_io_wait_for_write(instance) != MEMCACHED_SUCCESS) { - return EXIT_SUCCESS; + return 0; } if (getsockopt(instance->fd, SOL_SOCKET, SO_RCVBUF, &sock_size, &sock_length) < 0) { ptr->cached_errno= errno; - return EXIT_SUCCESS; /* Zero means error */ + return 0; /* Zero means error */ } } @@ -385,7 +385,7 @@ uint64_t memcached_behavior_get(memcached_st *ptr, case MEMCACHED_BEHAVIOR_MAX: default: WATCHPOINT_ASSERT(0); /* Programming mistake if it gets this far */ - return EXIT_SUCCESS; + return 0; } /* NOTREACHED */ diff --git a/libmemcached/hash.c b/libmemcached/hash.c index abad4f5b..dda30395 100644 --- a/libmemcached/hash.c +++ b/libmemcached/hash.c @@ -70,7 +70,7 @@ static inline uint32_t _generate_hash_wrapper(const memcached_st *ptr, const cha WATCHPOINT_ASSERT(memcached_server_count(ptr)); if (memcached_server_count(ptr) == 1) - return EXIT_SUCCESS; + return 0; if (ptr->flags.hash_with_prefix_key) { @@ -78,7 +78,7 @@ static inline uint32_t _generate_hash_wrapper(const memcached_st *ptr, const cha char temp[temp_length]; if (temp_length > MEMCACHED_MAX_KEY -1) - return EXIT_SUCCESS; + return 0; strncpy(temp, ptr->prefix_key, ptr->prefix_key_length); strncpy(temp + ptr->prefix_key_length, key, key_length); diff --git a/libmemcached/hosts.c b/libmemcached/hosts.c index 7034d3ec..9723f8b6 100644 --- a/libmemcached/hosts.c +++ b/libmemcached/hosts.c @@ -92,9 +92,9 @@ static int continuum_item_cmp(const void *t1, const void *t2) /* Why 153? Hmmm... */ WATCHPOINT_ASSERT(ct1->value != 153); if (ct1->value == ct2->value) - return EXIT_SUCCESS; + return 0; else if (ct1->value > ct2->value) - return EXIT_FAILURE; + return 1; else return -1; } diff --git a/libmemcached/io.c b/libmemcached/io.c index 2515dc1e..dedcdaf9 100644 --- a/libmemcached/io.c +++ b/libmemcached/io.c @@ -314,7 +314,7 @@ memcached_return_t memcached_io_read(memcached_server_write_instance_st ptr, and protocol enforcement happens at memcached_response() looking for '\n'. We do not care for UDB which requests 8 bytes at once. Generally, this means that connection went away. Since - for blocking I/O we do not return EXIT_SUCCESS and for non-blocking case + for blocking I/O we do not return 0 and for non-blocking case it will return EGAIN if data is not immediatly available. */ WATCHPOINT_STRING("We had a zero length recv()"); @@ -600,7 +600,7 @@ static ssize_t io_flush(memcached_server_write_instance_st ptr, if (ptr->write_buffer_offset == 0 || (ptr->type == MEMCACHED_CONNECTION_UDP && ptr->write_buffer_offset == UDP_DATAGRAM_HEADER_LENGTH)) - return EXIT_SUCCESS; + return 0; /* Looking for memory overflows */ #if defined(DEBUG) diff --git a/libmemcached/protocol/ascii_handler.c b/libmemcached/protocol/ascii_handler.c index 802b0859..465b7396 100644 --- a/libmemcached/protocol/ascii_handler.c +++ b/libmemcached/protocol/ascii_handler.c @@ -34,7 +34,7 @@ static uint16_t parse_ascii_key(char **start) if (len == 0 || len > 240 || (*c != '\0' && *c != '\r' && iscntrl(*c))) { - return EXIT_SUCCESS; + return 0; } return len; @@ -558,7 +558,7 @@ static inline int process_storage_command(memcached_protocol_client_st *client, { /* Keep on reading */ recover_tokenize_command(start, *end); - return EXIT_FAILURE; + return 1; } void *data= (*end) + 1; @@ -658,7 +658,7 @@ static inline int process_storage_command(memcached_protocol_client_st *client, *end += nbytes + 2; - return EXIT_SUCCESS; + return 0; } static int process_cas_command(memcached_protocol_client_st *client,