Release v2.6.0
[platform/core/uifw/at-spi2-atk.git] / dbind / dbind.c
index 2cdf5f7..e186e98 100644 (file)
@@ -40,41 +40,21 @@ send_and_allow_reentry (DBusConnection *bus, DBusMessage *message, DBusError *er
     return reply;
 }
 
-/**
- * dbind_method_call_reentrant:
- *
- * @cnx:       A D-Bus Connection used to make the method call.
- * @bus_name:  The D-Bus bus name of the program where the method call should
- *             be made.
- * @path:      The D-Bus object path that should handle the method.
- * @interface: The D-Bus interface used to scope the method name.
- * @method:    Method to be invoked.
- * @opt_error: D-Bus error.
- * @arg_types: Variable length arguments interleaving D-Bus argument types
- *             and pointers to argument data.
- *
- * Makes a D-Bus method call using the supplied location data, method name and
- * argument data.This function is re-entrant. It continuously reads from the D-Bus
- * bus and dispatches messages until a reply has been recieved.
- **/
 dbus_bool_t
-dbind_method_call_reentrant (DBusConnection *cnx,
-                             const char     *bus_name,
-                             const char     *path,
-                             const char     *interface,
-                             const char     *method,
-                             DBusError      *opt_error,
-                             const char     *arg_types,
-                             ...)
+dbind_method_call_reentrant_va (DBusConnection *cnx,
+                                const char     *bus_name,
+                                const char     *path,
+                                const char     *interface,
+                                const char     *method,
+                                DBusError      *opt_error,
+                                const char     *arg_types,
+                                va_list         args)
 {
     dbus_bool_t success = FALSE;
     DBusMessage *msg = NULL, *reply = NULL;
     DBusMessageIter iter;
     DBusError *err, real_err;
-    char *p;
-    va_list args;
-
-    va_start (args, arg_types);
+    const char *p;
 
     if (opt_error)
         err = opt_error;
@@ -88,7 +68,7 @@ dbind_method_call_reentrant (DBusConnection *cnx,
         goto out;
 
     p = arg_types;
-    dbus_message_iter_init (msg, &iter);
+    dbus_message_iter_init_append (msg, &iter);
     dbind_any_marshal_va (&iter, &p, args);
 
     reply = send_and_allow_reentry (cnx, msg, err);
@@ -112,8 +92,6 @@ dbind_method_call_reentrant (DBusConnection *cnx,
 
     success = TRUE;
 out:
-    va_end (args);
-
     if (msg)
         dbus_message_unref (msg);
 
@@ -126,38 +104,66 @@ out:
     return success;
 }
 
-/*---------------------------------------------------------------------------*/
-
 /**
- * dbind_emit_signal:
+ * dbind_method_call_reentrant:
  *
  * @cnx:       A D-Bus Connection used to make the method call.
- * @path:      The D-Bus object path that this signal is emitted from.
+ * @bus_name:  The D-Bus bus name of the program where the method call should
+ *             be made.
+ * @path:      The D-Bus object path that should handle the method.
  * @interface: The D-Bus interface used to scope the method name.
- * @signal:    Name of signal to emit.
+ * @method:    Method to be invoked.
  * @opt_error: D-Bus error.
  * @arg_types: Variable length arguments interleaving D-Bus argument types
  *             and pointers to argument data.
  *
- * Emits a D-Bus signal  using the supplied signal name and argument data.
+ * Makes a D-Bus method call using the supplied location data, method name and
+ * argument data.This function is re-entrant. It continuously reads from the D-Bus
+ * bus and dispatches messages until a reply has been recieved.
  **/
 dbus_bool_t
-dbind_emit_signal (DBusConnection *cnx,
-                   const char     *path,
-                   const char     *interface,
-                   const char     *signal,
-                   DBusError      *opt_error,
-                   const char     *arg_types,
-                   ...)
+dbind_method_call_reentrant (DBusConnection *cnx,
+                             const char     *bus_name,
+                             const char     *path,
+                             const char     *interface,
+                             const char     *method,
+                             DBusError      *opt_error,
+                             const char     *arg_types,
+                             ...)
 {
     dbus_bool_t success = FALSE;
-    DBusMessage *msg = NULL;
-    DBusMessageIter iter;
-    DBusError *err, real_err;
-    char *p;
     va_list args;
 
     va_start (args, arg_types);
+    success = dbind_method_call_reentrant_va (cnx,
+                                              bus_name,
+                                              path,
+                                              interface,
+                                              method,
+                                              opt_error,
+                                              arg_types,
+                                              args);
+    va_end (args);
+
+    return success;
+}
+
+/*---------------------------------------------------------------------------*/
+
+dbus_bool_t
+dbind_emit_signal_va (DBusConnection *cnx,
+                      const char     *path,
+                      const char     *interface,
+                      const char     *signal,
+                      DBusError      *opt_error,
+                      const char     *arg_types,
+                      va_list         args)
+{
+    dbus_bool_t success = FALSE;
+    DBusMessage *msg = NULL;
+    DBusMessageIter iter;
+    DBusError *err, real_err;
+    const char *p;
 
     if (opt_error)
         err = opt_error;
@@ -170,7 +176,8 @@ dbind_emit_signal (DBusConnection *cnx,
     if (!msg)
         goto out;
 
-    dbus_message_iter_init (msg, &iter);
+    p = arg_types;
+    dbus_message_iter_init_append (msg, &iter);
     dbind_any_marshal_va (&iter, &p, args);
 
     if (!dbus_connection_send (cnx, msg, NULL))
@@ -178,7 +185,6 @@ dbind_emit_signal (DBusConnection *cnx,
 
     success = TRUE;
 out:
-    va_end (args);
 
     if (msg)
         dbus_message_unref (msg);
@@ -189,4 +195,36 @@ out:
     return success;
 }
 
+/**
+ * dbind_emit_signal:
+ *
+ * @cnx:       A D-Bus Connection used to make the method call.
+ * @path:      The D-Bus object path that this signal is emitted from.
+ * @interface: The D-Bus interface used to scope the method name.
+ * @signal:    Name of signal to emit.
+ * @opt_error: D-Bus error.
+ * @arg_types: Variable length arguments interleaving D-Bus argument types
+ *             and pointers to argument data.
+ *
+ * Emits a D-Bus signal  using the supplied signal name and argument data.
+ **/
+dbus_bool_t
+dbind_emit_signal (DBusConnection *cnx,
+                   const char     *path,
+                   const char     *interface,
+                   const char     *signal,
+                   DBusError      *opt_error,
+                   const char     *arg_types,
+                   ...)
+{
+    dbus_bool_t success = FALSE;
+    va_list args;
+
+    va_start (args, arg_types);
+    success = dbind_emit_signal_va (cnx, path, interface, signal, opt_error, arg_types, args);
+    va_end (args);
+
+    return success;
+}
+
 /*END------------------------------------------------------------------------*/