confile_utils: cleanup strprint()

parent d21c028a
......@@ -9,24 +9,22 @@
#include "conf.h"
#include "confile_utils.h"
#define strprint(str, inlen, ...) \
do { \
if (str) \
len = snprintf(str, inlen, ##__VA_ARGS__); \
else \
len = snprintf((char *){""}, 0, ##__VA_ARGS__); \
if (len < 0) { \
SYSERROR("failed to create string"); \
return -1; \
}; \
fulllen += len; \
if (inlen > 0) { \
if (str) \
str += len; \
inlen -= len; \
if (inlen < 0) \
inlen = 0; \
} \
#define strprint(str, inlen, ...) \
do { \
if (str) \
len = snprintf(str, inlen, ##__VA_ARGS__); \
else \
len = snprintf((char *){""}, 0, ##__VA_ARGS__); \
if (len < 0) \
return log_error_errno(-EIO, EIO, "failed to create string"); \
fulllen += len; \
if (inlen > 0) { \
if (str) \
str += len; \
inlen -= len; \
if (inlen < 0) \
inlen = 0; \
} \
} while (0);
__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