BNX2X: spatch signed typedefs
[akaros.git] / kern / include / err.h
index c710032..09bbcc7 100644 (file)
@@ -10,19 +10,18 @@ struct errbuf {
        struct jmpbuf jmpbuf;
 };
 
-/* add 1 in case they forget they need an entry for the passed-in errbuf */
 #define ERRSTACK(x) struct errbuf *prev_errbuf; struct errbuf errstack[(x)];   \
                     int curindex = 0;
 #define waserror() (errpush(errstack, ARRAY_SIZE(errstack), &curindex,         \
                             &prev_errbuf) ||                                   \
                     setjmp(&(get_cur_errbuf()->jmpbuf)))
-#define error(x,...) {set_errstr(x, ##__VA_ARGS__);                            \
-                      longjmp(&get_cur_errbuf()->jmpbuf, 1);}
-#define nexterror() {errpop(errstack, ARRAY_SIZE(errstack), &curindex,         \
+#define error(x,...) do {set_errstr(x, ##__VA_ARGS__);                         \
+                            longjmp(&get_cur_errbuf()->jmpbuf, 1);} while(0)
+#define nexterror() do {errpop(errstack, ARRAY_SIZE(errstack), &curindex,      \
                             prev_errbuf);                                      \
-                     longjmp(&(get_cur_errbuf())->jmpbuf, 1);}
-#define poperror() {errpop(errstack, ARRAY_SIZE(errstack), &curindex,          \
-                           prev_errbuf);}
+                     longjmp(&(get_cur_errbuf())->jmpbuf, 1);} while (0)
+#define poperror() do {errpop(errstack, ARRAY_SIZE(errstack), &curindex,       \
+                       prev_errbuf);} while (0)
 
 int errpush(struct errbuf *errstack, int stacksize, int *curindex,
             struct errbuf **prev_errbuf);