diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-05-14 18:04:09 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-06-11 17:33:30 +0200 |
commit | 753ca22f9c4f1e650fce3c0bed88e42fb28cc562 (patch) | |
tree | a71542b97e478d219f890f7c85ed5b6f57fa6edd /src | |
parent | 7cce0e96f2b276e75634fc5437c6936f8713c487 (diff) | |
download | strongswan-753ca22f9c4f1e650fce3c0bed88e42fb28cc562.tar.bz2 strongswan-753ca22f9c4f1e650fce3c0bed88e42fb28cc562.tar.xz |
Implement strdupnull() macro as static inline function.
This avoids compiler warnings if the argument is a const char*.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/utils.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 6334b8e01..aeaa4e74b 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 |