commit 3498357f619b82fa08d6aa5e7f9ec2feff2374e7
parent cc1fa56fd0bd641f07b666bdf05f75a0e00ca9d2
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Fri, 16 Mar 2018 13:52:37 +0100
In debug builds, print a msg if an error code is set
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/senc_internal_types.h b/src/senc_internal_types.h
@@ -21,12 +21,16 @@
#include <stdint.h>
/* Utility macros */
+#ifdef NDEBUG
#define OK2(Expr, Label)\
- res = (Expr);\
- if(res != RES_OK) {\
+ if((res = (Expr)) != RES_OK) goto Label;
+#else
+#define OK2(Expr, Label)\
+ if((res = (Expr)) != RES_OK) {\
fprintf(stderr, "%s: error code set to %d at line %d\n", FUNC_NAME, res, __LINE__);\
goto Label;\
}
+#endif
#define OK(Expr) OK2((Expr), error)