summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-errors.c24
-rw-r--r--dbus/dbus-errors.h2
-rw-r--r--dbus/dbus-sysdeps-unix.c6
-rw-r--r--dbus/dbus-sysdeps.h10
4 files changed, 38 insertions, 4 deletions
diff --git a/dbus/dbus-errors.c b/dbus/dbus-errors.c
index d0a80b02..9629c682 100644
--- a/dbus/dbus-errors.c
+++ b/dbus/dbus-errors.c
@@ -34,7 +34,29 @@
* @brief Error reporting internals
* @{
*/
-
+
+/**
+ * @def DBUS_ERROR_INIT
+ *
+ * Expands to a suitable initializer for a DBusError on the stack.
+ * Declaring a DBusError with:
+ *
+ * @code
+ * DBusError error = DBUS_ERROR_INIT;
+ *
+ * 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 e01818c4..0a480d8c 100644
--- a/dbus/dbus-errors.h
+++ b/dbus/dbus-errors.h
@@ -58,6 +58,8 @@ struct DBusError
void *padding1; /**< placeholder */
};
+#define DBUS_ERROR_INIT { NULL, NULL, TRUE, 0, 0, 0, 0, NULL }
+
void dbus_error_init (DBusError *error);
void dbus_error_free (DBusError *error);
void dbus_set_error (DBusError *error,
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index 0ab5e730..2ce7427b 100644
--- a/dbus/dbus-sysdeps-unix.c
+++ b/dbus/dbus-sysdeps-unix.c
@@ -1741,7 +1741,7 @@ _dbus_parse_uid (const DBusString *uid_str,
_DBUS_DEFINE_GLOBAL_LOCK (atomic);
-#ifdef DBUS_USE_ATOMIC_INT_486
+#if DBUS_USE_ATOMIC_INT_486_COND
/* Taken from CVS version 1.7 of glibc's sysdeps/i386/i486/atomicity.h */
/* Since the asm stuff here is gcc-specific we go ahead and use "inline" also */
static inline dbus_int32_t
@@ -1768,7 +1768,7 @@ atomic_exchange_and_add (DBusAtomic *atomic,
dbus_int32_t
_dbus_atomic_inc (DBusAtomic *atomic)
{
-#ifdef DBUS_USE_ATOMIC_INT_486
+#if DBUS_USE_ATOMIC_INT_486_COND
return atomic_exchange_and_add (atomic, 1);
#else
dbus_int32_t res;
@@ -1791,7 +1791,7 @@ _dbus_atomic_inc (DBusAtomic *atomic)
dbus_int32_t
_dbus_atomic_dec (DBusAtomic *atomic)
{
-#ifdef DBUS_USE_ATOMIC_INT_486
+#if DBUS_USE_ATOMIC_INT_486_COND
return atomic_exchange_and_add (atomic, -1);
#else
dbus_int32_t res;
diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h
index eadfb433..1a52e7fb 100644
--- a/dbus/dbus-sysdeps.h
+++ b/dbus/dbus-sysdeps.h
@@ -199,6 +199,16 @@ struct DBusAtomic
#endif
};
+/* The value we get from autofoo is in the form of a cpp expression;
+ * convert that to a conventional defined/undef switch. (We can't get
+ * the conventional defined/undef because of multiarch builds only running
+ * ./configure once, on Darwin.) */
+#if DBUS_HAVE_ATOMIC_INT_COND
+# define DBUS_HAVE_ATOMIC_INT 1
+#else
+# undef DBUS_HAVE_ATOMIC_INT
+#endif
+
dbus_int32_t _dbus_atomic_inc (DBusAtomic *atomic);
dbus_int32_t _dbus_atomic_dec (DBusAtomic *atomic);