diff options
author | Martin Willi <martin@revosec.ch> | 2010-12-15 12:15:12 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2011-01-05 16:46:02 +0100 |
commit | 1038d9fee53f4c678f41959a8492ee8d1965a815 (patch) | |
tree | f83a9c7b058630834540c4d53b7fdb7184e06c69 /src/libstrongswan/utils.h | |
parent | b0892d094c4295c0d02e2a7c026304020d86a847 (diff) | |
download | strongswan-1038d9fee53f4c678f41959a8492ee8d1965a815.tar.bz2 strongswan-1038d9fee53f4c678f41959a8492ee8d1965a815.tar.xz |
Added a null-safe strdup variant
Diffstat (limited to 'src/libstrongswan/utils.h')
-rw-r--r-- | src/libstrongswan/utils.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h index 8ab732205..ed61895ee 100644 --- a/src/libstrongswan/utils.h +++ b/src/libstrongswan/utils.h @@ -72,6 +72,11 @@ #define strncaseeq(x,y,len) (strncasecmp(x, y, len) == 0) /** + * NULL-safe strdup variant + */ +#define strdupnull(x) ({ char *_x = x; _x ? strdup(_x) : NULL; }) + +/** * Macro compares two binary blobs for equality */ #define memeq(x,y,len) (memcmp(x, y, len) == 0) |