Now that function is no longer used, it can be dropped.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
build-aux/syntax-check.mk | 10 +++++-----
docs/hacking.html.in | 8 ++++----
m4/virt-compile-warnings.m4 | 2 --
src/libvirt_private.syms | 1 -
src/util/virstring.c | 14 --------------
src/util/virstring.h | 14 --------------
6 files changed, 9 insertions(+), 40 deletions(-)
diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 033eaf70c4..11b0ac7150 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -443,14 +443,14 @@ sc_prohibit_strtol:
halt='use virStrToDouble, not strtod variants' \
$(_sc_search_regexp)
-# Use virAsprintf rather than as'printf since *strp is undefined on error.
-# But for plain %s, virAsprintf is overkill compared to strdup.
+# Use g_strdup_printf rather than as'printf since *strp is undefined on error.
+# But for plain %s, g_strdup_printf is overkill compared to g_strdup.
sc_prohibit_asprintf:
@prohibit='\<v?a[s]printf\>' \
- halt='use virAsprintf, not asprintf' \
+ halt='use g_strdup_printf, not asprintf' \
$(_sc_search_regexp)
- @prohibit='virAsprintf.*, *"%s",' \
- halt='use VIR_STRDUP instead of virAsprintf with "%s"' \
+ @prohibit='g_strdup_printf.*, *"%s",' \
+ halt='use g_strdup instead of g_strdup_printf with "%s"' \
$(_sc_search_regexp)
sc_prohibit_strdup:
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index 981b782d31..f442eeb32a 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -1321,12 +1321,12 @@ BAD:
Whenever you add a new printf-style function, i.e., one with a format
string argument and following "..." in its prototype, be sure to use
gcc's printf attribute directive in the prototype. For example, here's
- the one for virAsprintf, in util.h:
+ the one for virBufferAsprintf, in virbuffer.h:
</p>
<pre>
- int virAsprintf(char **strp, const char *fmt, ...)
- ATTRIBUTE_FORMAT(printf, 2, 3);
+ void virBufferAsprintf(virBufferPtr buf, const char *format, ...)
+ G_GNUC_PRINTF(2, 3);
</pre>
<p>
@@ -1337,7 +1337,7 @@ BAD:
<p>
When printing to a string, consider using virBuffer for
- incremental allocations, virAsprintf for a one-shot allocation,
+ incremental allocations, g_strdup_printf for a one-shot allocation,
and snprintf for fixed-width buffers. Do not use sprintf, even
if you can prove the buffer won't overflow, since gnulib does
not provide the same portability guarantees for sprintf as it
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 1318ca59b9..be5dc3de51 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -51,8 +51,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
dontwarn="$dontwarn -Wstrict-overflow"
# Not a problem since we don't use -funsafe-loop-optimizations
dontwarn="$dontwarn -Wunsafe-loop-optimizations"
- # Things like virAsprintf mean we can't use this
- dontwarn="$dontwarn -Wformat-nonliteral"
# Gnulib's stat-time.h violates this
dontwarn="$dontwarn -Waggregate-return"
# gcc 4.4.6 complains this is C++ only; gcc 4.7.0 implies this from -Wall
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 12cb3b5bf7..e8458e26c7 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3070,7 +3070,6 @@ virStorageFileBackendRegister;
# util/virstring.h
-virAsprintfInternal;
virSkipSpaces;
virSkipSpacesAndBackslash;
virSkipSpacesBackwards;
diff --git a/src/util/virstring.c b/src/util/virstring.c
index ac132ff924..f6495fdb72 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -746,20 +746,6 @@ virVasprintfInternal(char **strp,
return ret;
}
-void
-virAsprintfInternal(char **strp,
- const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- g_vasprintf(strp, fmt, ap);
- va_end(ap);
-
- if (!*strp)
- abort();
-}
-
/**
* virStrncpy:
*
diff --git a/src/util/virstring.h b/src/util/virstring.h
index 318b64a136..5de6dd3252 100644
--- a/src/util/virstring.h
+++ b/src/util/virstring.h
@@ -133,8 +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);
-void virAsprintfInternal(char **strp, const char *fmt, ...)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_PRINTF(2, 3);
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;
@@ -228,18 +226,6 @@ size_t virStringListLength(const char * const *strings);
*/
#define virVasprintfQuiet(strp, fmt, list) virVasprintf(strp, fmt, list)
-/**
- * virAsprintf:
- * @strp: variable to hold result (char **)
- * @fmt: printf format
- *
- * Like glibc's asprintf but aborts on OOM.
- *
- * Returns number of bytes printed on success, aborts on OOM
- */
-
-#define virAsprintf(strp, ...) virAsprintfInternal(strp, __VA_ARGS__)
-
int virStringSortCompare(const void *a, const void *b);
int virStringSortRevCompare(const void *a, const void *b);
int virStringToUpper(char **dst, const char *src);
--
2.21.0