diff options
author | Eric Engestrom <[email protected]> | 2019-07-23 10:52:16 +0100 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2019-07-23 14:59:07 +0000 |
commit | 7797823afa1890e22774089f79634f631c4d0cb9 (patch) | |
tree | 85d57de00452114f00c3ad309d4a646fb88e3899 /src/util/u_string.h | |
parent | 22c7738520e2642a7f297d9b85f3dbfba37ca862 (diff) |
util: fix asprintf() fallback
Fixes: 9607d499dcdd09160b13 ("util: add asprintf() wrapper for MSVC")
Signed-off-by: Eric Engestrom <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/util/u_string.h')
-rw-r--r-- | src/util/u_string.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/util/u_string.h b/src/util/u_string.h index e7163927667..5fea8f17e73 100644 --- a/src/util/u_string.h +++ b/src/util/u_string.h @@ -99,16 +99,15 @@ util_vasprintf(char **ret, const char *format, va_list ap) } #define asprintf util_asprintf -static inline char * -util_asprintf(const char *fmt, ...) +static inline int +util_asprintf(char **str, const char *fmt, ...) { - char *ptr; + int ret; va_list args; va_start(args, fmt); - if (vasprintf(&ptr, fmt, args) == -1) - ptr = NULL; + ret = vasprintf(str, fmt, args); va_end(args); - return ptr; + return ret; } #define strcasecmp stricmp |