From: Jay Freeman (saurik) Date: Thu, 15 Oct 2009 06:12:13 +0000 (+0000) Subject: Added _aprcall and did some gcc specific _syscall magic. X-Git-Url: https://git.saurik.com/minimal.git/commitdiff_plain/d28d515cbeeee1cf10f68188531b31b54d4c1666 Added _aprcall and did some gcc specific _syscall magic. --- diff --git a/stdlib.h b/stdlib.h index 81033a3..bc3461d 100644 --- a/stdlib.h +++ b/stdlib.h @@ -60,15 +60,24 @@ _assert_(#expr); \ } while (false) -#define _syscall(expr) \ - do if ((long) (expr) != -1) \ +#define _syscall(expr) ({ \ + __typeof__(expr) value; \ + do if ((long) (value = (expr)) != -1) \ break; \ else switch (errno) { \ case EINTR: \ continue; \ default: \ _assert(false); \ - } while (true) + } while (true); \ + value; \ +}) + +#define _aprcall(expr) \ + do { \ + apr_status_t status((expr)); \ + _assert(status == APR_SUCCESS); \ + } while (false) #define _forever \ for (;;)