summaryrefslogtreecommitdiff
path: root/legacy/eina/src/include/eina_safety_checks.h
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2010-07-28 02:37:05 +0000
committerCarsten Haitzler <raster@rasterman.com>2010-07-28 02:37:05 +0000
commitddc6ba2c2a8386a0d87e3a2aea318cb77eef30bd (patch)
tree27a489ed763bf22239b2d4fca93063213b8001bd /legacy/eina/src/include/eina_safety_checks.h
parentc4da05607d5afdf472f85d036e1af6aab2f047a5 (diff)
uncrustify eina.
SVN revision: 50573
Diffstat (limited to '')
-rw-r--r--legacy/eina/src/include/eina_safety_checks.h250
1 files changed, 125 insertions, 125 deletions
diff --git a/legacy/eina/src/include/eina_safety_checks.h b/legacy/eina/src/include/eina_safety_checks.h
index 5a1c2df8b6..b668d0e9b9 100644
--- a/legacy/eina/src/include/eina_safety_checks.h
+++ b/legacy/eina/src/include/eina_safety_checks.h
@@ -78,113 +78,113 @@ EAPI extern Eina_Error EINA_ERROR_SAFETY_FAILED;
78 78
79#include "eina_log.h" 79#include "eina_log.h"
80 80
81#define EINA_SAFETY_ON_NULL_RETURN(exp) \ 81#define EINA_SAFETY_ON_NULL_RETURN(exp) \
82 do \ 82 do \
83 { \ 83 { \
84 if (EINA_UNLIKELY((exp) == NULL)) \ 84 if (EINA_UNLIKELY((exp) == NULL)) \
85 { \ 85 { \
86 eina_error_set(EINA_ERROR_SAFETY_FAILED); \ 86 eina_error_set(EINA_ERROR_SAFETY_FAILED); \
87 EINA_LOG_ERR("%s", "safety check failed: " #exp " == NULL"); \ 87 EINA_LOG_ERR("%s", "safety check failed: " # exp " == NULL"); \
88 return; \ 88 return; \
89 } \ 89 } \
90 } \ 90 } \
91 while (0) 91 while (0)
92 92
93#define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val) \ 93#define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val) \
94 do \ 94 do \
95 { \ 95 { \
96 if (EINA_UNLIKELY((exp) == NULL)) \ 96 if (EINA_UNLIKELY((exp) == NULL)) \
97 { \ 97 { \
98 eina_error_set(EINA_ERROR_SAFETY_FAILED); \ 98 eina_error_set(EINA_ERROR_SAFETY_FAILED); \
99 EINA_LOG_ERR("%s", "safety check failed: " #exp " == NULL"); \ 99 EINA_LOG_ERR("%s", "safety check failed: " # exp " == NULL"); \
100 return (val); \ 100 return (val); \
101 } \ 101 } \
102 } \ 102 } \
103 while (0) 103 while (0)
104 104
105#define EINA_SAFETY_ON_NULL_GOTO(exp, label) \ 105#define EINA_SAFETY_ON_NULL_GOTO(exp, label) \
106 do \ 106 do \
107 { \ 107 { \
108 if (EINA_UNLIKELY((exp) == NULL)) \ 108 if (EINA_UNLIKELY((exp) == NULL)) \
109 { \ 109 { \
110 eina_error_set(EINA_ERROR_SAFETY_FAILED); \ 110 eina_error_set(EINA_ERROR_SAFETY_FAILED); \
111 EINA_LOG_ERR("%s", "safety check failed: " #exp " == NULL"); \ 111 EINA_LOG_ERR("%s", "safety check failed: " # exp " == NULL"); \
112 goto label; \ 112 goto label; \
113 } \ 113 } \
114 } \ 114 } \
115 while (0) 115 while (0)
116 116
117#define EINA_SAFETY_ON_TRUE_RETURN(exp) \ 117#define EINA_SAFETY_ON_TRUE_RETURN(exp) \
118 do \ 118 do \
119 { \ 119 { \
120 if (EINA_UNLIKELY(exp)) \ 120 if (EINA_UNLIKELY(exp)) \
121 { \ 121 { \
122 eina_error_set(EINA_ERROR_SAFETY_FAILED); \ 122 eina_error_set(EINA_ERROR_SAFETY_FAILED); \
123 EINA_LOG_ERR("%s", "safety check failed: " #exp " is true"); \ 123 EINA_LOG_ERR("%s", "safety check failed: " # exp " is true"); \
124 return; \ 124 return; \
125 } \ 125 } \
126 } \ 126 } \
127 while (0) 127 while (0)
128 128
129#define EINA_SAFETY_ON_TRUE_RETURN_VAL(exp, val) \ 129#define EINA_SAFETY_ON_TRUE_RETURN_VAL(exp, val) \
130 do \ 130 do \
131 { \ 131 { \
132 if (EINA_UNLIKELY(exp)) \ 132 if (EINA_UNLIKELY(exp)) \
133 { \ 133 { \
134 eina_error_set(EINA_ERROR_SAFETY_FAILED); \ 134 eina_error_set(EINA_ERROR_SAFETY_FAILED); \
135 EINA_LOG_ERR("%s", "safety check failed: " #exp " is true"); \ 135 EINA_LOG_ERR("%s", "safety check failed: " # exp " is true"); \
136 return val; \ 136 return val; \
137 } \ 137 } \
138 } \ 138 } \
139 while (0) 139 while (0)
140 140
141#define EINA_SAFETY_ON_TRUE_GOTO(exp, label) \ 141#define EINA_SAFETY_ON_TRUE_GOTO(exp, label) \
142 do \ 142 do \
143 { \ 143 { \
144 if (EINA_UNLIKELY(exp)) \ 144 if (EINA_UNLIKELY(exp)) \
145 { \ 145 { \
146 eina_error_set(EINA_ERROR_SAFETY_FAILED); \ 146 eina_error_set(EINA_ERROR_SAFETY_FAILED); \
147 EINA_LOG_ERR("%s", "safety check failed: " #exp " is true"); \ 147 EINA_LOG_ERR("%s", "safety check failed: " # exp " is true"); \
148 goto label; \ 148 goto label; \
149 } \ 149 } \
150 } \ 150 } \
151 while (0) 151 while (0)
152 152
153#define EINA_SAFETY_ON_FALSE_RETURN(exp) \ 153#define EINA_SAFETY_ON_FALSE_RETURN(exp) \
154 do \ 154 do \
155 { \ 155 { \
156 if (EINA_UNLIKELY(!(exp))) \ 156 if (EINA_UNLIKELY(!(exp))) \
157 { \ 157 { \
158 eina_error_set(EINA_ERROR_SAFETY_FAILED); \ 158 eina_error_set(EINA_ERROR_SAFETY_FAILED); \
159 EINA_LOG_ERR("%s", "safety check failed: " #exp " is false"); \ 159 EINA_LOG_ERR("%s", "safety check failed: " # exp " is false"); \
160 return; \ 160 return; \
161 } \ 161 } \
162 } \ 162 } \
163 while (0) 163 while (0)
164 164
165#define EINA_SAFETY_ON_FALSE_RETURN_VAL(exp, val) \ 165#define EINA_SAFETY_ON_FALSE_RETURN_VAL(exp, val) \
166 do \ 166 do \
167 { \ 167 { \
168 if (EINA_UNLIKELY(!(exp))) \ 168 if (EINA_UNLIKELY(!(exp))) \
169 { \ 169 { \
170 eina_error_set(EINA_ERROR_SAFETY_FAILED); \ 170 eina_error_set(EINA_ERROR_SAFETY_FAILED); \
171 EINA_LOG_ERR("%s", "safety check failed: " #exp " is false"); \ 171 EINA_LOG_ERR("%s", "safety check failed: " # exp " is false"); \
172 return val; \ 172 return val; \
173 } \ 173 } \
174 } \ 174 } \
175 while (0) 175 while (0)
176 176
177#define EINA_SAFETY_ON_FALSE_GOTO(exp, label) \ 177#define EINA_SAFETY_ON_FALSE_GOTO(exp, label) \
178 do \ 178 do \
179 { \ 179 { \
180 if (EINA_UNLIKELY(!(exp))) \ 180 if (EINA_UNLIKELY(!(exp))) \
181 { \ 181 { \
182 eina_error_set(EINA_ERROR_SAFETY_FAILED); \ 182 eina_error_set(EINA_ERROR_SAFETY_FAILED); \
183 EINA_LOG_ERR("%s", "safety check failed: " #exp " is false"); \ 183 EINA_LOG_ERR("%s", "safety check failed: " # exp " is false"); \
184 goto label; \ 184 goto label; \
185 } \ 185 } \
186 } \ 186 } \
187 while (0) 187 while (0)
188 188
189#ifdef EINA_ARG_NONNULL 189#ifdef EINA_ARG_NONNULL
190/* make EINA_ARG_NONNULL void so GCC does not optimize safety checks */ 190/* make EINA_ARG_NONNULL void so GCC does not optimize safety checks */
@@ -195,32 +195,32 @@ EAPI extern Eina_Error EINA_ERROR_SAFETY_FAILED;
195 195
196#else /* no safety checks */ 196#else /* no safety checks */
197 197
198#define EINA_SAFETY_ON_NULL_RETURN(exp) \ 198#define EINA_SAFETY_ON_NULL_RETURN(exp) \
199 do { (void)((exp) == NULL); } while (0) 199 do { (void)((exp) == NULL); } while (0)
200 200
201#define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val) \ 201#define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val) \
202 do { if (0 && (exp) == NULL) (void)val; } while (0) 202 do { if (0 && (exp) == NULL) { (void)val; } } while (0)
203 203
204#define EINA_SAFETY_ON_NULL_GOTO(exp, label) \ 204#define EINA_SAFETY_ON_NULL_GOTO(exp, label) \
205 do { if (0 && (exp) == NULL) goto label; } while (0) 205 do { if (0 && (exp) == NULL) { goto label; } } while (0)
206 206
207#define EINA_SAFETY_ON_TRUE_RETURN(exp) \ 207#define EINA_SAFETY_ON_TRUE_RETURN(exp) \
208 do { (void)(exp); } while (0) 208 do { (void)(exp); } while (0)
209 209
210#define EINA_SAFETY_ON_TRUE_RETURN_VAL(exp, val) \ 210#define EINA_SAFETY_ON_TRUE_RETURN_VAL(exp, val) \
211 do { if (0 && (exp)) (void)val; } while (0) 211 do { if (0 && (exp)) { (void)val; } } while (0)
212 212
213#define EINA_SAFETY_ON_TRUE_GOTO(exp, label) \ 213#define EINA_SAFETY_ON_TRUE_GOTO(exp, label) \
214 do { if (0 && (exp)) goto label; } while (0) 214 do { if (0 && (exp)) { goto label; } } while (0)
215 215
216#define EINA_SAFETY_ON_FALSE_RETURN(exp) \ 216#define EINA_SAFETY_ON_FALSE_RETURN(exp) \
217 do { (void)(!(exp)); } while (0) 217 do { (void)(!(exp)); } while (0)
218 218
219#define EINA_SAFETY_ON_FALSE_RETURN_VAL(exp, val) \ 219#define EINA_SAFETY_ON_FALSE_RETURN_VAL(exp, val) \
220 do { if (0 && !(exp)) (void)val; } while (0) 220 do { if (0 && !(exp)) { (void)val; } } while (0)
221 221
222#define EINA_SAFETY_ON_FALSE_GOTO(exp, label) \ 222#define EINA_SAFETY_ON_FALSE_GOTO(exp, label) \
223 do { if (0 && !(exp)) goto label; } while (0) 223 do { if (0 && !(exp)) { goto label; } } while (0)
224 224
225#endif /* safety checks macros */ 225#endif /* safety checks macros */
226#endif /* EINA_SAFETY_CHECKS_H_ */ 226#endif /* EINA_SAFETY_CHECKS_H_ */