From: Brian Aker Date: Tue, 18 Dec 2007 01:31:56 +0000 (-0800) Subject: Portability patches from Kevin Dalley for Freebsd 4.0. X-Git-Tag: 0.13~22 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=acca3c7ad60716bf073ae8de0652517542cdd224;p=m6w6%2Flibmemcached Portability patches from Kevin Dalley for Freebsd 4.0. --- diff --git a/ChangeLog b/ChangeLog index 0f9fd436..f364840d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * Fixed uint16_t issues around flags. Turns out the documentation on the protocol was wrong. * Lingering socket fixes for FreeBSD. + * Patches from Kevin Dalley for FreeBSD 4.0 0.12 Tue Dec 11 15:20:55 PST 2007 * Updates for consistent hashing diff --git a/configure.ac b/configure.ac index 3e3acbc4..f052f5f0 100644 --- a/configure.ac +++ b/configure.ac @@ -70,4 +70,5 @@ fi AC_C_CONST AC_HEADER_TIME AC_TYPE_SIZE_T +AC_SEARCH_LIBS(getopt_long, gnugetopt) AC_OUTPUT(Makefile src/Makefile tests/Makefile docs/Makefile lib/Makefile include/Makefile support/Makefile support/libmemcached.pc support/libmemcached.spec) diff --git a/lib/common.h b/lib/common.h index 76c734ed..395b80ef 100644 --- a/lib/common.h +++ b/lib/common.h @@ -17,11 +17,22 @@ #include #include #include -#include #include #include #include #include +#include "libmemcached_config.h" + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif diff --git a/lib/memcached_connect.c b/lib/memcached_connect.c index 0bb28177..42390a9a 100644 --- a/lib/memcached_connect.c +++ b/lib/memcached_connect.c @@ -110,9 +110,10 @@ static memcached_return tcp_connect(memcached_st *ptr, unsigned int server_key) { if (ptr->hosts[server_key].fd == -1) { + struct addrinfo *use; + /* Old connection junk still is in the structure */ WATCHPOINT_ASSERT(ptr->hosts[server_key].cursor_active == 0); - struct addrinfo *use; if (ptr->hosts[server_key].sockaddr_inited == MEMCACHED_NOT_ALLOCATED || (!(ptr->flags & MEM_USE_CACHE_LOOKUPS))) diff --git a/src/memcat.c b/src/memcat.c index 79dc6220..4aaffb95 100644 --- a/src/memcat.c +++ b/src/memcat.c @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/src/memerror.c b/src/memerror.c index d6bfbf7f..f6cf1aba 100644 --- a/src/memerror.c +++ b/src/memerror.c @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/src/utilities.h b/src/utilities.h index 857f7803..1fba99bf 100644 --- a/src/utilities.h +++ b/src/utilities.h @@ -1,6 +1,18 @@ #include #include #include "client_options.h" +#include "libmemcached_config.h" + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif typedef struct memcached_programs_help_st memcached_programs_help_st; diff --git a/tests/function.c b/tests/function.c index 0be895d6..e717c3b8 100644 --- a/tests/function.c +++ b/tests/function.c @@ -15,6 +15,14 @@ #include "../src/generator.h" #include "../src/execute.h" +#ifndef INT64_MAX +#define INT64_MAX LONG_MAX +#endif +#ifndef INT32_MAX +#define INT32_MAX INT_MAX +#endif + + #include "test.h" #define GLOBAL_COUNT 100000 @@ -1099,6 +1107,10 @@ uint8_t user_supplied_bug4(memcached_st *memc) size_t key_length[]= {5, 3, 4}; unsigned int x; uint32_t flags; + char return_key[MEMCACHED_MAX_KEY]; + size_t return_key_length; + char *return_value; + size_t return_value_length; /* Here we free everything before running a bunch of mget tests */ { @@ -1107,10 +1119,6 @@ uint8_t user_supplied_bug4(memcached_st *memc) memc->number_of_hosts= 0; } - char return_key[MEMCACHED_MAX_KEY]; - size_t return_key_length; - char *return_value; - size_t return_value_length; /* We need to empty the server before continueing test */ rc= memcached_flush(memc, 0); diff --git a/tests/test.c b/tests/test.c index 60db54cb..653a3ddc 100644 --- a/tests/test.c +++ b/tests/test.c @@ -76,6 +76,7 @@ int main(int argc, char *argv[]) char *wildcard= NULL; memcached_server_st *servers; collection_st *collection; + collection_st *next; uint8_t failed; collection= gets_collections(); @@ -113,7 +114,6 @@ int main(int argc, char *argv[]) printf("\n"); - collection_st *next; for (next= collection; next->name; next++) { test_st *run; @@ -130,6 +130,7 @@ int main(int argc, char *argv[]) memcached_st *memc; memcached_return rc; struct timeval start_time, end_time; + long int load_time; if (wildcard && fnmatch(wildcard, run->name, 0)) continue; @@ -169,7 +170,7 @@ int main(int argc, char *argv[]) gettimeofday(&start_time, NULL); failed= run->function(memc); gettimeofday(&end_time, NULL); - long int load_time= timedif(end_time, start_time); + load_time= timedif(end_time, start_time); if (failed) fprintf(stderr, "\t\t\t\t\t %ld.%03ld [ failed ]\n", load_time / 1000, load_time % 1000);