diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 92ffa2f25cad92de5cd4d43ea2db7dc014c29bcb..5d13e4f71dbd9b495385c445ab6ca752a1c2eb93 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -1043,11 +1043,6 @@ BAD:
VIR_STRDUP, VIR_STRNDUP
Prefer the GLib APIs g_strdup and g_strndup.
-
virAsprintf, virVasprintf
-
The GLib APIs g_strdup_printf / g_strdup_vprint should be used - instead. Don't use g_vasprintf unless having the string length - returned is unavoidable.
-
virStrerror
The GLib g_strerror() function should be used instead, which has a simpler calling convention as an added benefit.
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b013e4d6ef63f6c8f4b68820b74bf9e99ca7e5b8..5787338e92b3a5123b6a254d940f19f5acba50cc 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3120,7 +3120,6 @@ virStrToLong_ull; virStrToLong_ullp; virStrToLong_ulp; virTrimSpaces; -virVasprintfInternal; # util/virsysinfo.h diff --git a/src/util/virstring.c b/src/util/virstring.c index 040b3ac26b73076ed732c1c1c4db0f3eb896c0fa..283cf8c8d872b324a9d631094d5b7383e8ffa421 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -720,30 +720,6 @@ virDoubleToStr(char **strp, double number) } -int -virVasprintfInternal(char **strp, - const char *fmt, - va_list list) -{ - char *str = NULL; - int ret; - - ret = g_vasprintf(&str, fmt, list); - - /* GLib is supposed to abort() on OOM, but a mistake meant - * it did not. Delete this once our min glib is at 2.64.0 - * which includes the fix: - * https://gitlab.gnome.org/GNOME/glib/merge_requests/1145 - */ -#if !GLIB_CHECK_VERSION(2, 64, 0) - if (!str) - abort(); -#endif - *strp = str; - - return ret; -} - /** * virStrncpy: * diff --git a/src/util/virstring.h b/src/util/virstring.h index 6072af8f595d6d11e1c7e8881bc05c7293f3ea55..081a5ff1aa553ff1945418b70ff714a61626578b 100644 --- a/src/util/virstring.h +++ b/src/util/virstring.h @@ -133,9 +133,6 @@ int virStrdup(char **dest, const char *src) int virStrndup(char **dest, const char *src, ssize_t n) G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NONNULL(1); -int virVasprintfInternal(char **strp, const char *fmt, va_list list) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_PRINTF(2, 0) - G_GNUC_WARN_UNUSED_RESULT; /** * VIR_STRDUP: @@ -208,15 +205,6 @@ int virVasprintfInternal(char **strp, const char *fmt, va_list list) size_t virStringListLength(const char * const *strings); -/** - * virVasprintf - * - * Like glibc's vasprintf but aborts on OOM - * - * Returns number of bytes printed on success, aborts on OOM - */ -#define virVasprintf(strp, fmt, list) virVasprintfInternal(strp, fmt, list) - int virStringSortCompare(const void *a, const void *b); int virStringSortRevCompare(const void *a, const void *b); int virStringToUpper(char **dst, const char *src);