d7f759fd6d14622eaf729338ddef804be3812e7a
[awesomized/libmemcached] / libmemcached / memcached_watchpoint.h
1 /*
2 * Summary: Localized copy of WATCHPOINT debug symbols
3 *
4 * Copy: See Copyright for the status of this software.
5 *
6 * Author: Brian Aker
7 */
8
9 #ifndef LIBMEMCACHED_MEMCACHED_WATCHPOINT_H
10 #define LIBMEMCACHED_MEMCACHED_WATCHPOINT_H
11
12 /* Some personal debugging functions */
13 #if defined(DEBUG)
14
15 #include <assert.h>
16
17 #define WATCHPOINT fprintf(stderr, "\nWATCHPOINT %s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout);
18 #define WATCHPOINT_ERROR(A) fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout);
19 #define WATCHPOINT_IFERROR(A) if(A != MEMCACHED_SUCCESS)fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout);
20 #define WATCHPOINT_STRING(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__,A);fflush(stdout);
21 #define WATCHPOINT_STRING_LENGTH(A,B) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %.*s\n", __FILE__, __LINE__,__func__,(int)B,A);fflush(stdout);
22 #define WATCHPOINT_NUMBER(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %zu\n", __FILE__, __LINE__,__func__,(size_t)(A));fflush(stdout);
23 #define WATCHPOINT_ERRNO(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));fflush(stdout);
24 #define WATCHPOINT_ASSERT_PRINT(A,B,C) if(!(A)){fprintf(stderr, "\nWATCHPOINT ASSERT %s:%d (%s) ", __FILE__, __LINE__,__func__);fprintf(stderr, (B),(C));fprintf(stderr,"\n");fflush(stdout);}assert((A));
25 #define WATCHPOINT_ASSERT(A) assert((A));
26 #define WATCHPOINT_ASSERT_INITIALIZED(A) (memcached_is_initialized((A));
27
28 #else
29
30 #define WATCHPOINT
31 #define WATCHPOINT_ERROR(A)
32 #define WATCHPOINT_IFERROR(A)
33 #define WATCHPOINT_STRING(A)
34 #define WATCHPOINT_NUMBER(A)
35 #define WATCHPOINT_ERRNO(A)
36 #define WATCHPOINT_ASSERT_PRINT(A,B,C)
37 #define WATCHPOINT_ASSERT(A)
38 #define WATCHPOINT_ASSERT_INITIALIZED(A)
39
40 #endif /* DEBUG */
41
42 #endif /* LIBMEMCACHED_MEMCACHED_WATCHPOINT_H */