提交 ec07893a 编写于 作者: J Ján Tomko

util: use g_vsnprintf

Instead of vsnprintf from gnulib, use g_vsnprintf from GLib.
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
上级 5ff6eb5d
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册