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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-06-30 16:43:37 +02:00
parent 8366e3a41e
commit 1330f1ded1

View File

@@ -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)
{