Add DBUS_ERROR_INITIALIZER macro
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 9 Oct 2007 16:34:09 +0000 (17:34 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 11 Oct 2007 09:35:25 +0000 (10:35 +0100)
dbus/dbus-errors.c
dbus/dbus-errors.h

index d0a80b0..30bf6a1 100644 (file)
  * @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
  */
index e01818c..ee17007 100644 (file)
@@ -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,