summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-10-31 16:29:18 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-10-31 16:31:35 +0100
commit4ae284bd0b50fabff8700619a097b713725faaa8 (patch)
treed8a23284c141efbd6572ae4bb5a45e817656fb5f
parent1013671a37379678a78715617ac1052a385204b2 (diff)
clouseau: move those macros to a header, they are usefull
-rw-r--r--src/lib/Clouseau_Debug.h34
-rw-r--r--src/lib/clouseau_debug.c32
2 files changed, 34 insertions, 32 deletions
diff --git a/src/lib/Clouseau_Debug.h b/src/lib/Clouseau_Debug.h
index e35684c..a93de1e 100644
--- a/src/lib/Clouseau_Debug.h
+++ b/src/lib/Clouseau_Debug.h
@@ -120,4 +120,38 @@ eolian_debug_object_information_decode(char *buffer, unsigned int size);
120 120
121EAPI Evas_Debug_Screenshot * 121EAPI Evas_Debug_Screenshot *
122evas_debug_screenshot_decode(char *buffer, unsigned int size); 122evas_debug_screenshot_decode(char *buffer, unsigned int size);
123
124typedef struct
125{
126 Eina_Debug_Session *session;
127 int srcid;
128 void *buffer;
129 unsigned int size;
130} Main_Loop_Info;
131
132#define WRAPPER_TO_XFER_MAIN_LOOP(foo) \
133static void \
134_intern_main_loop ## foo(void *data) \
135{ \
136 Main_Loop_Info *info = data; \
137 _main_loop ## foo(info->session, info->srcid, info->buffer, info->size); \
138 free(info->buffer); \
139 free(info); \
140} \
141static Eina_Bool \
142foo(Eina_Debug_Session *session, int srcid, void *buffer, int size) \
143{ \
144 Main_Loop_Info *info = calloc(1, sizeof(*info)); \
145 info->session = session; \
146 info->srcid = srcid; \
147 info->size = size; \
148 if (info->size) \
149 { \
150 info->buffer = malloc(info->size); \
151 memcpy(info->buffer, buffer, info->size); \
152 } \
153 ecore_main_loop_thread_safe_call_async(_intern_main_loop ## foo, info); \
154 return EINA_TRUE; \
155}
156
123#endif 157#endif
diff --git a/src/lib/clouseau_debug.c b/src/lib/clouseau_debug.c
index 7ae1bdb..5fb5c4e 100644
--- a/src/lib/clouseau_debug.c
+++ b/src/lib/clouseau_debug.c
@@ -63,30 +63,6 @@
63 _buf += sz; \ 63 _buf += sz; \
64} 64}
65 65
66#define WRAPPER_TO_XFER_MAIN_LOOP(foo) \
67static void \
68_intern_main_loop ## foo(void *data) \
69{ \
70 Main_Loop_Info *info = data; \
71 _main_loop ## foo(info->session, info->srcid, info->buffer, info->size); \
72 free(info->buffer); \
73 free(info); \
74} \
75static Eina_Bool \
76foo(Eina_Debug_Session *session, int srcid, void *buffer, int size) \
77{ \
78 Main_Loop_Info *info = calloc(1, sizeof(*info)); \
79 info->session = session; \
80 info->srcid = srcid; \
81 info->size = size; \
82 if (info->size) \
83 { \
84 info->buffer = malloc(info->size); \
85 memcpy(info->buffer, buffer, info->size); \
86 } \
87 ecore_main_loop_thread_safe_call_async(_intern_main_loop ## foo, info); \
88 return EINA_TRUE; \
89}
90 66
91static int _snapshot_start_op = EINA_DEBUG_OPCODE_INVALID; 67static int _snapshot_start_op = EINA_DEBUG_OPCODE_INVALID;
92static int _snapshot_done_op = EINA_DEBUG_OPCODE_INVALID; 68static int _snapshot_done_op = EINA_DEBUG_OPCODE_INVALID;
@@ -105,14 +81,6 @@ enum {
105 81
106typedef struct 82typedef struct
107{ 83{
108 Eina_Debug_Session *session;
109 int srcid;
110 void *buffer;
111 unsigned int size;
112} Main_Loop_Info;
113
114typedef struct
115{
116 Eolian_Type_Type etype; 84 Eolian_Type_Type etype;
117 const char *name; 85 const char *name;
118 Eolian_Debug_Basic_Type type; 86 Eolian_Debug_Basic_Type type;