confile_utils: cleanup strprint()

parent d21c028a
...@@ -9,24 +9,22 @@ ...@@ -9,24 +9,22 @@
#include "conf.h" #include "conf.h"
#include "confile_utils.h" #include "confile_utils.h"
#define strprint(str, inlen, ...) \ #define strprint(str, inlen, ...) \
do { \ do { \
if (str) \ if (str) \
len = snprintf(str, inlen, ##__VA_ARGS__); \ len = snprintf(str, inlen, ##__VA_ARGS__); \
else \ else \
len = snprintf((char *){""}, 0, ##__VA_ARGS__); \ len = snprintf((char *){""}, 0, ##__VA_ARGS__); \
if (len < 0) { \ if (len < 0) \
SYSERROR("failed to create string"); \ return log_error_errno(-EIO, EIO, "failed to create string"); \
return -1; \ fulllen += len; \
}; \ if (inlen > 0) { \
fulllen += len; \ if (str) \
if (inlen > 0) { \ str += len; \
if (str) \ inlen -= len; \
str += len; \ if (inlen < 0) \
inlen -= len; \ inlen = 0; \
if (inlen < 0) \ } \
inlen = 0; \
} \
} while (0); } while (0);
__hidden extern int parse_idmaps(const char *idmap, char *type, unsigned long *nsid, __hidden extern int parse_idmaps(const char *idmap, char *type, unsigned long *nsid,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment