summaryrefslogtreecommitdiff
path: root/legacy/eina/src/include/eina_safety_checks.h
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2010-07-09 03:27:04 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2010-07-09 03:27:04 +0000
commit442fe3afae1a8b47b97984191179fa208b86d217 (patch)
treed1b78977052ce80e7e9974a496e6b24ab4ca1b24 /legacy/eina/src/include/eina_safety_checks.h
parentf723c133d731fe68810ac5caf60cf030a0cd8d29 (diff)
Add missing macros
Add missing EINA_SAFETY_ON_NULL_GOTO and define all the *GOTOs macros when safety checks are disabled. SVN revision: 50138
Diffstat (limited to '')
-rw-r--r--legacy/eina/src/include/eina_safety_checks.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/legacy/eina/src/include/eina_safety_checks.h b/legacy/eina/src/include/eina_safety_checks.h
index 1c0b4dd1c7..5a1c2df8b6 100644
--- a/legacy/eina/src/include/eina_safety_checks.h
+++ b/legacy/eina/src/include/eina_safety_checks.h
@@ -102,6 +102,18 @@ EAPI extern Eina_Error EINA_ERROR_SAFETY_FAILED;
102 } \ 102 } \
103 while (0) 103 while (0)
104 104
105#define EINA_SAFETY_ON_NULL_GOTO(exp, label) \
106 do \
107 { \
108 if (EINA_UNLIKELY((exp) == NULL)) \
109 { \
110 eina_error_set(EINA_ERROR_SAFETY_FAILED); \
111 EINA_LOG_ERR("%s", "safety check failed: " #exp " == NULL"); \
112 goto label; \
113 } \
114 } \
115 while (0)
116
105#define EINA_SAFETY_ON_TRUE_RETURN(exp) \ 117#define EINA_SAFETY_ON_TRUE_RETURN(exp) \
106 do \ 118 do \
107 { \ 119 { \
@@ -189,18 +201,27 @@ EAPI extern Eina_Error EINA_ERROR_SAFETY_FAILED;
189#define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val) \ 201#define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val) \
190 do { if (0 && (exp) == NULL) (void)val; } while (0) 202 do { if (0 && (exp) == NULL) (void)val; } while (0)
191 203
204#define EINA_SAFETY_ON_NULL_GOTO(exp, label) \
205 do { if (0 && (exp) == NULL) goto label; } while (0)
206
192#define EINA_SAFETY_ON_TRUE_RETURN(exp) \ 207#define EINA_SAFETY_ON_TRUE_RETURN(exp) \
193 do { (void)(exp); } while (0) 208 do { (void)(exp); } while (0)
194 209
195#define EINA_SAFETY_ON_TRUE_RETURN_VAL(exp, val) \ 210#define EINA_SAFETY_ON_TRUE_RETURN_VAL(exp, val) \
196 do { if (0 && (exp)) (void)val; } while (0) 211 do { if (0 && (exp)) (void)val; } while (0)
197 212
213#define EINA_SAFETY_ON_TRUE_GOTO(exp, label) \
214 do { if (0 && (exp)) goto label; } while (0)
215
198#define EINA_SAFETY_ON_FALSE_RETURN(exp) \ 216#define EINA_SAFETY_ON_FALSE_RETURN(exp) \
199 do { (void)(!(exp)); } while (0) 217 do { (void)(!(exp)); } while (0)
200 218
201#define EINA_SAFETY_ON_FALSE_RETURN_VAL(exp, val) \ 219#define EINA_SAFETY_ON_FALSE_RETURN_VAL(exp, val) \
202 do { if (0 && !(exp)) (void)val; } while (0) 220 do { if (0 && !(exp)) (void)val; } while (0)
203 221
222#define EINA_SAFETY_ON_FALSE_GOTO(exp, label) \
223 do { if (0 && !(exp)) goto label; } while (0)
224
204#endif /* safety checks macros */ 225#endif /* safety checks macros */
205#endif /* EINA_SAFETY_CHECKS_H_ */ 226#endif /* EINA_SAFETY_CHECKS_H_ */
206 227