From f45ddcf8136fabc8a14c66250e3be540661b3634 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 2 Aug 2014 20:20:16 +0200 Subject: misc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libmdsserver/macros.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/libmdsserver/macros.h') diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h index cbef69c..b7eb1d8 100644 --- a/src/libmdsserver/macros.h +++ b/src/libmdsserver/macros.h @@ -21,9 +21,10 @@ #include "config.h" +#include +#include /* -#include #include #include #include @@ -333,7 +334,15 @@ */ #define growalloc(old, var, elements, type) \ (old = var, xrealloc(var, (elements) <<= 1, type) ? (var = old, (elements) >>= 1, perror(*argv), 1) : 0) - + + +/** + * Call `perror` if `errno` is non-zero and set `errno` to zero + * + * @param str:const char* The argument passed to `perror` + */ +#define xperror(str) \ + (errno ? perror(str), errno = 0 : 0) /** -- cgit v1.2.3-70-g09d2