]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Implement strdupnull() macro as static inline function.
authorTobias Brunner <tobias@strongswan.org>
Mon, 14 May 2012 16:04:09 +0000 (18:04 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 11 Jun 2012 15:33:30 +0000 (17:33 +0200)
This avoids compiler warnings if the argument is a const char*.

src/libstrongswan/utils.h

index 6334b8e010aa28b3f8394801703bc26787c18b20..aeaa4e74b7f4dd6838b04189dce1110a1501c986 100644 (file)
 /**
  * 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