* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
+
+#include <config.h>
#include "dbus-errors.h"
#include "dbus-internals.h"
#include "dbus-string.h"
} DBusRealError;
+_DBUS_STATIC_ASSERT (sizeof (DBusRealError) == sizeof (DBusError));
+
/**
* Returns a longer message describing an error name.
* If the error name is unknown, returns the name
{
DBusRealError *real;
- _dbus_return_if_fail (error != NULL);
+ _DBUS_STATIC_ASSERT (sizeof (DBusError) == sizeof (DBusRealError));
- _dbus_assert (sizeof (DBusError) == sizeof (DBusRealError));
+ _dbus_return_if_fail (error != NULL);
real = (DBusRealError *)error;
* must ensure the name and message are global data that won't be
* freed. You probably want dbus_set_error() instead, in most cases.
*
- * @param error the error.or #NULL
+ * @param error the error or #NULL
* @param name the error name (not copied!!!)
* @param message the error message (not copied!!!)
*/
const char *format,
...)
{
- DBusRealError *real;
- DBusString str;
va_list args;
if (error == NULL)
/* 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);
}
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;