Implement strdupnull() macro as static inline function.
This avoids compiler warnings if the argument is a const char*.
This commit is contained in:
@@ -74,7 +74,10 @@
|
|||||||
/**
|
/**
|
||||||
* NULL-safe strdup variant
|
* 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
|
* Macro compares two binary blobs for equality
|
||||||
|
|||||||
Reference in New Issue
Block a user