Commit c6e02483 authored by Simon McVittie's avatar Simon McVittie

_dbus_set_error_valist: add

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
parent 3861a426
......@@ -356,8 +356,6 @@ dbus_set_error (DBusError *error,
const char *format,
...)
{
DBusRealError *real;
DBusString str;
va_list args;
if (error == NULL)
......@@ -366,7 +364,26 @@ dbus_set_error (DBusError *error,
/* it's a bug to pile up errors */
_dbus_return_if_error_is_set (error);
_dbus_return_if_fail (name != NULL);
va_start (args, format);
_dbus_set_error_valist (error, name, format, args);
va_end (args);
}
void
_dbus_set_error_valist (DBusError *error,
const char *name,
const char *format,
va_list args)
{
DBusRealError *real;
DBusString str;
_dbus_assert (name != NULL);
if (error == NULL)
return;
_dbus_assert (error->name == NULL);
_dbus_assert (error->message == NULL);
......@@ -384,14 +401,11 @@ dbus_set_error (DBusError *error,
}
else
{
va_start (args, format);
if (!_dbus_string_append_printf_valist (&str, format, args))
{
_dbus_string_free (&str);
va_end (args);
goto nomem;
}
va_end (args);
}
real = (DBusRealError *)error;
......
......@@ -263,6 +263,10 @@ void _dbus_verbose_bytes_of_string (const DBusString *str,
extern const char *_dbus_no_memory_message;
#define _DBUS_SET_OOM(error) dbus_set_error_const ((error), DBUS_ERROR_NO_MEMORY, _dbus_no_memory_message)
void _dbus_set_error_valist (DBusError *error,
const char *name,
const char *format,
va_list args) _DBUS_GNUC_PRINTF (3, 0);
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
/* Memory debugging */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment