aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libmdsserver/macros.h13
-rw-r--r--src/mds-kbdc/validate-tree.c1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h
index 7d661a1..e307384 100644
--- a/src/libmdsserver/macros.h
+++ b/src/libmdsserver/macros.h
@@ -37,6 +37,9 @@
*/
+/* # pragma GCC diagnostic ignored "-Wpedantic" */
+
+
/**
* Wrapper around `asprintf` that makes sure that first
* argument gets set to `NULL` on error and that zero is
@@ -49,6 +52,16 @@
*/
#define xasprintf(VAR, ...) \
(asprintf(&(VAR), __VA_ARGS__) < 0 ? (VAR = NULL, -1) : 0)
+/*
+#define xasprintf(VAR, ...) \
+ ({ \
+ int _x_rc = (asprintf(&(VAR), __VA_ARGS__) < 0 ? (VAR = NULL, -1) : 0); \
+ fprintf(stderr, "xasprintf(%s, %s)(=%zu) @ %s:%i\n", \
+ #VAR, #__VA_ARGS__, _x_rc ? 0 : (strlen(VAR) + 1), __FILE__, __LINE__); \
+ _x_rc; \
+ })
+*/
+
/**
* Wrapper for `snprintf` that allows you to forget about the buffer size
diff --git a/src/mds-kbdc/validate-tree.c b/src/mds-kbdc/validate-tree.c
index 3c676eb..d8824f5 100644
--- a/src/mds-kbdc/validate-tree.c
+++ b/src/mds-kbdc/validate-tree.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <errno.h>
+#include <string.h>