mirror of https://gitee.com/openkylin/libvirt.git
util: use g_vsnprintf
Instead of vsnprintf from gnulib, use g_vsnprintf from GLib. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
5ff6eb5dc7
commit
ec07893a5f
|
@ -445,6 +445,12 @@ sc_prohibit_asprintf:
|
|||
halt='use g_strdup instead of g_strdup_printf with "%s"' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohobit_vsnprintf:
|
||||
@prohibit='\<vsnprintf\>' \
|
||||
in_vc_files='\.[chx]$$' \
|
||||
halt='use g_vsnprintf, not vsnprintf' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_strdup:
|
||||
@prohibit='\<strn?dup\> *\(' \
|
||||
halt='use VIR_STRDUP, not strdup' \
|
||||
|
|
|
@ -1288,7 +1288,7 @@ void virReportErrorHelper(int domcode,
|
|||
|
||||
if (fmt) {
|
||||
va_start(args, fmt);
|
||||
vsnprintf(errorMessage, sizeof(errorMessage)-1, fmt, args);
|
||||
g_vsnprintf(errorMessage, sizeof(errorMessage)-1, fmt, args);
|
||||
va_end(args);
|
||||
} else {
|
||||
errorMessage[0] = '\0';
|
||||
|
@ -1358,7 +1358,7 @@ void virReportSystemErrorFull(int domcode,
|
|||
int n;
|
||||
|
||||
va_start(args, fmt);
|
||||
n = vsnprintf(msgDetailBuf, sizeof(msgDetailBuf), fmt, args);
|
||||
n = g_vsnprintf(msgDetailBuf, sizeof(msgDetailBuf), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
size_t len = strlen(errnoDetail);
|
||||
|
|
|
@ -764,7 +764,7 @@ virTypedParamSetNameVPrintf(virTypedParameterPtr par,
|
|||
const char *fmt,
|
||||
va_list ap)
|
||||
{
|
||||
if (vsnprintf(par->field, VIR_TYPED_PARAM_FIELD_LENGTH, fmt, ap) > VIR_TYPED_PARAM_FIELD_LENGTH) {
|
||||
if (g_vsnprintf(par->field, VIR_TYPED_PARAM_FIELD_LENGTH, fmt, ap) > VIR_TYPED_PARAM_FIELD_LENGTH) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Field name too long"));
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue