utils: add EXIT_IF
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 21 Mar 2017 09:51:15 +0000 (11:51 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 21 Mar 2017 09:51:15 +0000 (11:51 +0200)
kms++util/inc/kms++util/kms++util.h

index 3745a3181446131f80cdc9ccef7d93bd400330f0..c1e3c8c90963b0a9624e023b3d6df2ffdfa4601f 100644 (file)
@@ -63,3 +63,9 @@ void draw_test_pattern(IMappedFramebuffer &fb);
                fprintf(stderr, fmt "\n", ##__VA_ARGS__); \
                exit(-1); \
        } while(0)
+
+#define EXIT_IF(x, fmt, ...) \
+       if (unlikely(x)) { \
+               fprintf(stderr, fmt "\n", ##__VA_ARGS__); \
+               exit(-1); \
+       }