mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
Drop virAsprintf()
Now that function is no longer used, it can be dropped. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
a028630620
commit
dd98a6edb9
@ -435,14 +435,14 @@ sc_prohibit_strtol:
|
|||||||
halt='use virStrToDouble, not strtod variants' \
|
halt='use virStrToDouble, not strtod variants' \
|
||||||
$(_sc_search_regexp)
|
$(_sc_search_regexp)
|
||||||
|
|
||||||
# Use virAsprintf rather than as'printf since *strp is undefined on error.
|
# Use g_strdup_printf rather than as'printf since *strp is undefined on error.
|
||||||
# But for plain %s, virAsprintf is overkill compared to strdup.
|
# But for plain %s, g_strdup_printf is overkill compared to g_strdup.
|
||||||
sc_prohibit_asprintf:
|
sc_prohibit_asprintf:
|
||||||
@prohibit='\<v?a[s]printf\>' \
|
@prohibit='\<v?a[s]printf\>' \
|
||||||
halt='use virAsprintf, not asprintf' \
|
halt='use g_strdup_printf, not asprintf' \
|
||||||
$(_sc_search_regexp)
|
$(_sc_search_regexp)
|
||||||
@prohibit='virAsprintf.*, *"%s",' \
|
@prohibit='g_strdup_printf.*, *"%s",' \
|
||||||
halt='use VIR_STRDUP instead of virAsprintf with "%s"' \
|
halt='use g_strdup instead of g_strdup_printf with "%s"' \
|
||||||
$(_sc_search_regexp)
|
$(_sc_search_regexp)
|
||||||
|
|
||||||
sc_prohibit_strdup:
|
sc_prohibit_strdup:
|
||||||
|
@ -51,8 +51,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
|
|||||||
dontwarn="$dontwarn -Wstrict-overflow"
|
dontwarn="$dontwarn -Wstrict-overflow"
|
||||||
# Not a problem since we don't use -funsafe-loop-optimizations
|
# Not a problem since we don't use -funsafe-loop-optimizations
|
||||||
dontwarn="$dontwarn -Wunsafe-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
|
# Gnulib's stat-time.h violates this
|
||||||
dontwarn="$dontwarn -Waggregate-return"
|
dontwarn="$dontwarn -Waggregate-return"
|
||||||
# gcc 4.4.6 complains this is C++ only; gcc 4.7.0 implies this from -Wall
|
# 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
|
# util/virstring.h
|
||||||
virAsprintfInternal;
|
|
||||||
virSkipSpaces;
|
virSkipSpaces;
|
||||||
virSkipSpacesAndBackslash;
|
virSkipSpacesAndBackslash;
|
||||||
virSkipSpacesBackwards;
|
virSkipSpacesBackwards;
|
||||||
|
@ -744,25 +744,6 @@ virVasprintfInternal(char **strp,
|
|||||||
return ret;
|
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:
|
* virStrncpy:
|
||||||
*
|
*
|
||||||
|
@ -133,9 +133,6 @@ int virStrdup(char **dest, const char *src)
|
|||||||
|
|
||||||
int virStrndup(char **dest, const char *src, ssize_t n)
|
int virStrndup(char **dest, const char *src, ssize_t n)
|
||||||
G_GNUC_WARN_UNUSED_RESULT ATTRIBUTE_NONNULL(1);
|
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)
|
int virVasprintfInternal(char **strp, const char *fmt, va_list list)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_PRINTF(2, 0)
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_PRINTF(2, 0)
|
||||||
G_GNUC_WARN_UNUSED_RESULT;
|
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)
|
#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 virStringSortCompare(const void *a, const void *b);
|
||||||
int virStringSortRevCompare(const void *a, const void *b);
|
int virStringSortRevCompare(const void *a, const void *b);
|
||||||
int virStringToUpper(char **dst, const char *src);
|
int virStringToUpper(char **dst, const char *src);
|
||||||
|
Loading…
Reference in New Issue
Block a user