Added a null-safe strdup variant

This commit is contained in:
Martin Willi
2011-01-05 16:46:02 +01:00
parent b0892d094c
commit 1038d9fee5
7 changed files with 13 additions and 8 deletions
+5
View File
@@ -71,6 +71,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
*/