From: Date: Mon, 10 Mar 2008 18:17:55 +0000 (-0400) Subject: Refactored debug library out of main include. X-Git-Tag: _20~1^2~58 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=2f44187ce709c4524aef74f9d2e788d5845829d5;p=m6w6%2Flibmemcached Refactored debug library out of main include. --- diff --git a/clients/utilities.h b/clients/utilities.h index 6d4d72d4..6f8967af 100644 --- a/clients/utilities.h +++ b/clients/utilities.h @@ -1,4 +1,3 @@ -#include #include #include #include "client_options.h" diff --git a/configure.ac b/configure.ac index a4d12058..40e1d67e 100644 --- a/configure.ac +++ b/configure.ac @@ -57,9 +57,9 @@ if test "$GCC" = "yes" then if test "$ENABLE_DEBUG" = "yes" then - CFLAGS="-Wall -ggdb -DHAVE_DEBUG" + CFLAGS="-Wall -ggdb -DMEMCACHED_INTERNAL -DHAVE_DEBUG" else - CFLAGS="-Wall -O3" + CFLAGS="-Wall -O3 -DMEMCACHED_INTERNAL " fi else CFLAGS="-Xa -xstrconst -mt -D_FORTEC_ -fast -m64" diff --git a/libmemcached/Makefile.am b/libmemcached/Makefile.am index 01adbefa..06480a5d 100644 --- a/libmemcached/Makefile.am +++ b/libmemcached/Makefile.am @@ -31,7 +31,8 @@ pkginclude_HEADERS= memcached.h \ memcached_result.h \ memcached_server.h \ memcached_string.h \ - memcached_types.h + memcached_types.h \ + memcached_watchpoint.h lib_LTLIBRARIES = libmemcached.la diff --git a/libmemcached/memcached.h b/libmemcached/memcached.h index 4db72e94..edf49157 100644 --- a/libmemcached/memcached.h +++ b/libmemcached/memcached.h @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -268,34 +269,6 @@ memcached_return memcached_server_cursor(memcached_st *ptr, void *context, unsigned int number_of_callbacks); -#ifndef __WATCHPOINT_H__ -#define __WATCHPOINT_H__ -/* Some personal debugging functions */ -#ifdef HAVE_DEBUG -#define WATCHPOINT fprintf(stderr, "\nWATCHPOINT %s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout); -#ifdef __MEMCACHED_H__ -#define WATCHPOINT_ERROR(A) fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout); -#define WATCHPOINT_IFERROR(A) if(A != MEMCACHED_SUCCESS)fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout); -#endif -#define WATCHPOINT_STRING(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__,A);fflush(stdout); -#define WATCHPOINT_STRING_LENGTH(A,B) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %.*s\n", __FILE__, __LINE__,__func__,(int)B,A);fflush(stdout); -#define WATCHPOINT_NUMBER(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %zu\n", __FILE__, __LINE__,__func__,(size_t)(A));fflush(stdout); -#define WATCHPOINT_ERRNO(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));fflush(stdout); -#define WATCHPOINT_ASSERT(A) assert((A)); -#else -#define WATCHPOINT -#ifdef __MEMCACHED_H__ -#define WATCHPOINT_ERROR(A) -#define WATCHPOINT_IFERROR(A) -#endif -#define WATCHPOINT_STRING(A) -#define WATCHPOINT_NUMBER(A) -#define WATCHPOINT_ERRNO(A) -#define WATCHPOINT_ASSERT(A) -#endif - -#endif /* __WATCHPOINT_H__ */ - #ifdef __cplusplus } diff --git a/libmemcached/memcached.hh b/libmemcached/memcached.hh index e482f4bf..f7e349e7 100644 --- a/libmemcached/memcached.hh +++ b/libmemcached/memcached.hh @@ -19,9 +19,7 @@ public: Memcached(memcached_st *clone) { - WATCHPOINT; memcached_clone(&memc, clone); - WATCHPOINT; } char *get(char *key, size_t *value_length) diff --git a/libmemcached/memcached_hosts.c b/libmemcached/memcached_hosts.c index fb53fa22..c62c3b41 100644 --- a/libmemcached/memcached_hosts.c +++ b/libmemcached/memcached_hosts.c @@ -1,4 +1,3 @@ -#include #include "common.h" /* Protoypes (static) */ diff --git a/libmemcached/memcached_watchpoint.h b/libmemcached/memcached_watchpoint.h new file mode 100644 index 00000000..b0270b61 --- /dev/null +++ b/libmemcached/memcached_watchpoint.h @@ -0,0 +1,42 @@ +/* + * Summary: Localized copy of WATCHPOINT debug symbols + * + * Copy: See Copyright for the status of this software. + * + * Author: Brian Aker + */ + +#ifndef __MEMCACHED_WATCHPOINT_H__ +#define __MEMCACHED_WATCHPOINT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Some personal debugging functions */ +#ifdef MEMCACHED_INTERNAL +#ifdef HAVE_DEBUG +#define WATCHPOINT fprintf(stderr, "\nWATCHPOINT %s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout); +#define WATCHPOINT_ERROR(A) fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout); +#define WATCHPOINT_IFERROR(A) if(A != MEMCACHED_SUCCESS)fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout); +#define WATCHPOINT_STRING(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__,A);fflush(stdout); +#define WATCHPOINT_STRING_LENGTH(A,B) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %.*s\n", __FILE__, __LINE__,__func__,(int)B,A);fflush(stdout); +#define WATCHPOINT_NUMBER(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %zu\n", __FILE__, __LINE__,__func__,(size_t)(A));fflush(stdout); +#define WATCHPOINT_ERRNO(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));fflush(stdout); +#define WATCHPOINT_ASSERT(A) assert((A)); +#else +#define WATCHPOINT +#define WATCHPOINT_ERROR(A) +#define WATCHPOINT_IFERROR(A) +#define WATCHPOINT_STRING(A) +#define WATCHPOINT_NUMBER(A) +#define WATCHPOINT_ERRNO(A) +#define WATCHPOINT_ASSERT(A) +#endif +#endif /* MEMCACHED_INTERNAL */ + +#ifdef __cplusplus +} +#endif + +#endif /* __MEMCACHED_WATCHPOINT_H__ */ diff --git a/tests/atomsmasher.c b/tests/atomsmasher.c index 6ff68ca9..11b4258f 100644 --- a/tests/atomsmasher.c +++ b/tests/atomsmasher.c @@ -2,7 +2,6 @@ Sample test application. */ #include -#include #include #include #include diff --git a/tests/server.c b/tests/server.c index 58f45233..f5e44a9b 100644 --- a/tests/server.c +++ b/tests/server.c @@ -3,6 +3,7 @@ */ #define TEST_PORT_BASE MEMCACHED_DEFAULT_PORT+10 + #include #include #include