From: Simon McVittie Date: Tue, 9 Oct 2007 16:34:09 +0000 (+0100) Subject: Add DBUS_ERROR_INITIALIZER macro X-Git-Tag: dbus-1.1.3~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=262c02a9facebc8592fa60406d8971b1837725f5;p=thirdparty%2Fdbus.git Add DBUS_ERROR_INITIALIZER macro --- diff --git a/dbus/dbus-errors.c b/dbus/dbus-errors.c index d0a80b02a..30bf6a1fb 100644 --- a/dbus/dbus-errors.c +++ b/dbus/dbus-errors.c @@ -34,7 +34,29 @@ * @brief Error reporting internals * @{ */ - + +/** + * @def DBUS_ERROR_INITIALIZER + * + * Expands to a suitable initializer for a DBusError on the stack. + * Declaring a DBusError with: + * + * @code + * DBusError error = DBUS_ERROR_INITIALIZER; + * + * do_things_with (&error); + * @endcode + * + * is a more concise form of: + * + * @code + * DBusError error; + * + * dbus_error_init (&error); + * do_things_with (&error); + * @endcode + */ + /** * Internals of DBusError */ diff --git a/dbus/dbus-errors.h b/dbus/dbus-errors.h index e01818c46..ee1700713 100644 --- a/dbus/dbus-errors.h +++ b/dbus/dbus-errors.h @@ -58,6 +58,8 @@ struct DBusError void *padding1; /**< placeholder */ }; +#define DBUS_ERROR_INITIALIZER { NULL, NULL, 0, 0, 0, 0, 0, NULL } + void dbus_error_init (DBusError *error); void dbus_error_free (DBusError *error); void dbus_set_error (DBusError *error,