e87b0b04f7a5d9d2a0c4a4f5560445600f74ee9c
[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 __MEMCACHED_WATCHPOINT_H__
10 #define __MEMCACHED_WATCHPOINT_H__
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 /* Some personal debugging functions */
17 #ifdef MEMCACHED_INTERNAL
18 #ifdef HAVE_DEBUG
19 #include <assert.h>
20
21 #define WATCHPOINT fprintf(stderr, "\nWATCHPOINT %s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout);
22 #define WATCHPOINT_ERROR(A) fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout);
23 #define WATCHPOINT_IFERROR(A) if(A != MEMCACHED_SUCCESS)fprintf(stderr, "\nWATCHPOINT %s:%d %s\n", __FILE__, __LINE__, memcached_strerror(NULL, A));fflush(stdout);
24 #define WATCHPOINT_STRING(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__,A);fflush(stdout);
25 #define WATCHPOINT_STRING_LENGTH(A,B) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %.*s\n", __FILE__, __LINE__,__func__,(int)B,A);fflush(stdout);
26 #define WATCHPOINT_NUMBER(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %zu\n", __FILE__, __LINE__,__func__,(size_t)(A));fflush(stdout);
27 #define WATCHPOINT_ERRNO(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));fflush(stdout);
28 #define WATCHPOINT_ASSERT(A) assert((A));
29 #else
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(A)
37 #endif
38 #endif /* MEMCACHED_INTERNAL */
39
40 #ifdef __cplusplus
41 }
42 #endif
43
44 #endif /* __MEMCACHED_WATCHPOINT_H__ */