提交 dd98a6ed 编写于 作者: M Michal Privoznik

Drop virAsprintf()

Now that function is no longer used, it can be dropped.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
上级 a0286306
......@@ -435,14 +435,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:
......
......@@ -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
......
......@@ -3069,7 +3069,6 @@ virStorageFileBackendRegister;
# util/virstring.h
virAsprintfInternal;
virSkipSpaces;
virSkipSpacesAndBackslash;
virSkipSpacesBackwards;
......
......@@ -744,25 +744,6 @@ virVasprintfInternal(char **strp,
return ret;
}
int
virAsprintfInternal(char **strp,
const char *fmt, ...)
{
va_list ap;
char *str = NULL;
int ret;
va_start(ap, fmt);
ret = g_vasprintf(&str, fmt, ap);
va_end(ap);
if (!*str)
abort();
*strp = str;
return ret;
}
/**
* virStrncpy:
*
......
......@@ -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 virAsprintfInternal(char **strp, const char *fmt, ...)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_PRINTF(2, 3)
G_GNUC_WARN_UNUSED_RESULT;
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;
......@@ -229,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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册