Add missing macros
authorlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 9 Jul 2010 03:27:04 +0000 (03:27 +0000)
committerlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 9 Jul 2010 03:27:04 +0000 (03:27 +0000)
Add missing EINA_SAFETY_ON_NULL_GOTO and define all the *GOTOs macros when
safety checks are disabled.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@50138 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/include/eina_safety_checks.h

index 1c0b4dd..5a1c2df 100644 (file)
@@ -102,6 +102,18 @@ EAPI extern Eina_Error EINA_ERROR_SAFETY_FAILED;
     }                                                                  \
   while (0)
 
+#define EINA_SAFETY_ON_NULL_GOTO(exp, label)                           \
+  do                                                                   \
+    {                                                                  \
+       if (EINA_UNLIKELY((exp) == NULL))                               \
+        {                                                              \
+           eina_error_set(EINA_ERROR_SAFETY_FAILED);                   \
+           EINA_LOG_ERR("%s", "safety check failed: " #exp " == NULL"); \
+           goto label;                                                 \
+        }                                                              \
+    }                                                                  \
+  while (0)
+
 #define EINA_SAFETY_ON_TRUE_RETURN(exp)                                        \
   do                                                                   \
     {                                                                  \
@@ -189,18 +201,27 @@ EAPI extern Eina_Error EINA_ERROR_SAFETY_FAILED;
 #define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val)                       \
   do { if (0 && (exp) == NULL) (void)val; } while (0)
 
+#define EINA_SAFETY_ON_NULL_GOTO(exp, label)                           \
+  do { if (0 && (exp) == NULL) goto label; } while (0)
+
 #define EINA_SAFETY_ON_TRUE_RETURN(exp)                                        \
   do { (void)(exp); } while (0)
 
 #define EINA_SAFETY_ON_TRUE_RETURN_VAL(exp, val)                       \
   do { if (0 && (exp)) (void)val; } while (0)
 
+#define EINA_SAFETY_ON_TRUE_GOTO(exp, label)                           \
+  do { if (0 && (exp)) goto label; } while (0)
+
 #define EINA_SAFETY_ON_FALSE_RETURN(exp)                               \
   do { (void)(!(exp)); } while (0)
 
 #define EINA_SAFETY_ON_FALSE_RETURN_VAL(exp, val)                      \
   do { if (0 && !(exp)) (void)val; } while (0)
 
+#define EINA_SAFETY_ON_FALSE_GOTO(exp, label)                  \
+  do { if (0 && !(exp)) goto label; } while (0)
+
 #endif /* safety checks macros */
 #endif /* EINA_SAFETY_CHECKS_H_ */