aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/macros.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-08-02 20:20:16 +0200
committerMattias Andrée <maandree@operamail.com>2014-08-02 20:20:16 +0200
commitf45ddcf8136fabc8a14c66250e3be540661b3634 (patch)
tree5701cb54f6b5f463575d4601a3560ec0fd305d83 /src/libmdsserver/macros.h
parentmisc (diff)
downloadmds-f45ddcf8136fabc8a14c66250e3be540661b3634.tar.gz
mds-f45ddcf8136fabc8a14c66250e3be540661b3634.tar.bz2
mds-f45ddcf8136fabc8a14c66250e3be540661b3634.tar.xz
misc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/libmdsserver/macros.h13
1 files changed, 11 insertions, 2 deletions
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 <stdio.h>
+#include <errno.h>
/*
-#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <string.h>
@@ -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)
/**