From 33ed622106c61d257fd4a5750d4df511bcdd1b2b Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 22 Oct 2019 14:13:39 +0200 Subject: [PATCH] Drop virVasprintf() Now that function is no longer used, it can be dropped. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- docs/hacking.html.in | 5 ----- src/libvirt_private.syms | 1 - src/util/virstring.c | 24 ------------------------ src/util/virstring.h | 12 ------------ 4 files changed, 42 deletions(-) diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 92ffa2f25c..5d13e4f71d 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 b013e4d6ef..5787338e92 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 040b3ac26b..283cf8c8d8 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 6072af8f59..081a5ff1aa 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); -- GitLab