From 1330f1ded139c1b377d6b29677da55cdef212c37 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 30 Jun 2025 16:43:37 +0200 Subject: [PATCH] util-strings: drop unused xasprintf() Unsed code and just making trouble on correctly including stdio.h, because it's using a GNU extension function -- vasprintf(). Signed-off-by: Enrico Weigelt, metux IT consult --- src/util-strings.h | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/util-strings.h b/src/util-strings.h index 66687e5..89d42c0 100644 --- a/src/util-strings.h +++ b/src/util-strings.h @@ -100,35 +100,6 @@ safe_strdup(const char *str) return s; } -/** - * Simple wrapper for asprintf that ensures the passed in-pointer is set - * to NULL upon error. - * The standard asprintf() call does not guarantee the passed in pointer - * will be NULL'ed upon failure, whereas this wrapper does. - * - * @param strp pointer to set to newly allocated string. - * This pointer should be passed to free() to release when done. - * @param fmt the format string to use for printing. - * @return The number of bytes printed (excluding the null byte terminator) - * upon success or -1 upon failure. In the case of failure the pointer is set - * to NULL. - */ -__attribute__ ((format (printf, 2, 3))) -static inline int -xasprintf(char **strp, const char *fmt, ...) -{ - int rc = 0; - va_list args; - - va_start(args, fmt); - rc = vasprintf(strp, fmt, args); - va_end(args); - if ((rc == -1) && strp) - *strp = NULL; - - return rc; -} - static inline bool safe_atoi_base(const char *str, int *val, int base) {