From: Tobias Brunner Date: Mon, 14 May 2012 16:04:09 +0000 (+0200) Subject: Implement strdupnull() macro as static inline function. X-Git-Tag: 5.0.0~144 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=753ca22f9c4f1e650fce3c0bed88e42fb28cc562;p=thirdparty%2Fstrongswan.git Implement strdupnull() macro as static inline function. This avoids compiler warnings if the argument is a const char*. --- 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