summaryrefslogtreecommitdiff
path: root/toxcore/misc_tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/misc_tools.h')
-rw-r--r--toxcore/misc_tools.h36
1 files changed, 1 insertions, 35 deletions
diff --git a/toxcore/misc_tools.h b/toxcore/misc_tools.h
index 4bf28ac7..170dd2b1 100644
--- a/toxcore/misc_tools.h
+++ b/toxcore/misc_tools.h
@@ -28,41 +28,7 @@
28#include <stdint.h> 28#include <stdint.h>
29#include <string.h> /* for memcpy() */ 29#include <string.h> /* for memcpy() */
30 30
31/*********************Debugging Macros******************** 31
32 * wiki.tox.im/index.php/Internal_functions_and_data_structures#Debugging
33 *********************************************************/
34#ifdef DEBUG
35#include <assert.h>
36#include <stdio.h>
37#include <string.h>
38
39#define DEBUG_PRINT(str, ...) do { \
40 char msg[1000]; \
41 sprintf(msg, "%s(): line %d (file %s): %s%%c\n", __FUNCTION__, __LINE__, __FILE__, str); \
42 fprintf(stderr, msg, __VA_ARGS__); \
43 } while (0)
44
45#define WARNING(...) do { \
46 fprintf(stderr, "warning in "); \
47 DEBUG_PRINT(__VA_ARGS__, ' '); \
48 } while (0)
49
50#define INFO(...) do { \
51 DEBUG_PRINT(__VA_ARGS__, ' '); \
52 } while (0)
53
54#undef ERROR
55#define ERROR(exit_status, ...) do { \
56 fprintf(stderr, "error in "); \
57 DEBUG_PRINT(__VA_ARGS__, ' '); \
58 exit(exit_status); \
59 } while (0)
60#else
61#define WARNING(...)
62#define INFO(...)
63#undef ERROR
64#define ERROR(...)
65#endif // DEBUG
66 32
67/************************Linked List*********************** 33/************************Linked List***********************
68 * http://wiki.tox.im/index.php/Internal_functions_and_data_structures#Linked_List 34 * http://wiki.tox.im/index.php/Internal_functions_and_data_structures#Linked_List