From 753ca22f9c4f1e650fce3c0bed88e42fb28cc562 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Mon, 14 May 2012 18:04:09 +0200 Subject: [PATCH] Implement strdupnull() macro as static inline function. This avoids compiler warnings if the argument is a const char*. --- src/libstrongswan/utils.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 6334b8e010..aeaa4e74b7 100644 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -74,7 +74,10 @@ /** * NULL-safe strdup variant */ -#define strdupnull(x) ({ char *_x = x; _x ? strdup(_x) : NULL; }) +static inline char *strdupnull(const char *s) +{ + return s ? strdup(s) : NULL; +} /** * Macro compares two binary blobs for equality -- 2.47.2