chiark / gitweb /
Export sd_bus_message_append_ap. It is renamed to sd_bus_message_appendv to follow...
authorFederico <nierro92@gmail.com>
Tue, 25 Apr 2017 07:32:24 +0000 (09:32 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 25 Jul 2017 07:46:52 +0000 (09:46 +0200)
Moreover, man page for sd_bus_message_append is updated with reference to new exposed function.
Makefile-man is updated too, to reflect new alias.

man/sd_bus_message_append.xml
src/libelogind/libelogind.sym
src/libelogind/sd-bus/bus-convenience.c
src/libelogind/sd-bus/bus-message.c
src/libelogind/sd-bus/bus-message.h

index 48a022d1150afe0b28be026a8653dbf08a100074..26af67cd3890e17ef4513816fd56a309b8a42a11 100644 (file)
@@ -45,6 +45,7 @@
 
   <refnamediv>
     <refname>sd_bus_message_append</refname>
 
   <refnamediv>
     <refname>sd_bus_message_append</refname>
+    <refname>sd_bus_message_appendv</refname>
 
     <refpurpose>Attach fields to a D-Bus message based on a type
     string</refpurpose>
 
     <refpurpose>Attach fields to a D-Bus message based on a type
     string</refpurpose>
         <paramdef>const char *<parameter>types</parameter></paramdef>
         <paramdef>…</paramdef>
       </funcprototype>
         <paramdef>const char *<parameter>types</parameter></paramdef>
         <paramdef>…</paramdef>
       </funcprototype>
+
+      <funcprototype>
+          <funcdef>int sd_bus_message_appendv</funcdef>
+          <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
+          <paramdef>const char *<parameter>types</parameter></paramdef>
+          <paramdef>va_list <parameter>ap</parameter></paramdef>
+      </funcprototype>
+
     </funcsynopsis>
   </refsynopsisdiv>
 
     </funcsynopsis>
   </refsynopsisdiv>
 
     values for each entry matching the element type of
     the dictionary entries.</para>
 
     values for each entry matching the element type of
     the dictionary entries.</para>
 
+    <para>The <function>sd_bus_message_appendv()</function> is equivalent to
+    the function <function>sd_bus_message_append()</function>,
+    except that it is called with a <literal>va_list</literal> instead of
+    a variable number of arguments. This function does not call the
+    <function>va_end()</function> macro. Because it invokes the
+    <function>va_arg()</function> macro, the value of ap
+    is undefined after the call.</para>
+
     <para>For further details on the D-Bus type system, please consult
     the <ulink
     url="http://dbus.freedesktop.org/doc/dbus-specification.html#type-system">D-Bus
     <para>For further details on the D-Bus type system, please consult
     the <ulink
     url="http://dbus.freedesktop.org/doc/dbus-specification.html#type-system">D-Bus
@@ -238,8 +255,8 @@ sd_bus_message_append(m, "ynqiuxtd", y, n, q, i, u, x, t, d);</programlisting>
   <refsect1>
     <title>Return Value</title>
 
   <refsect1>
     <title>Return Value</title>
 
-    <para>On success, this call returns 0 or a positive
-    integer. On failure, this call returns a negative
+    <para>On success, these functions return 0 or a positive
+    integer. On failure, these functions return a negative
     errno-style error code.</para>
   </refsect1>
 
     errno-style error code.</para>
   </refsect1>
 
index 167f08ef3ccf004681887b89826c4609510a64bf..a203f08c31ba20e2c17e5b791bc7a186679d7754 100644 (file)
@@ -529,3 +529,8 @@ global:
         sd_id128_get_machine_app_specific;
         /* sd_is_socket_sockaddr; */
 } LIBSYSTEMD_232;
         sd_id128_get_machine_app_specific;
         /* sd_is_socket_sockaddr; */
 } LIBSYSTEMD_232;
+
+LIBSYSTEMD_234 {
+global:
+        sd_bus_message_appendv;
+} LIBSYSTEMD_233;
index 9fdfdf44795ae4cba4ea55348ea0b2a950be6877..1eb7264621ac2db84f22c55b116f817299a0c494 100644 (file)
@@ -48,7 +48,7 @@ _public_ int sd_bus_emit_signal(
                 va_list ap;
 
                 va_start(ap, types);
                 va_list ap;
 
                 va_start(ap, types);
-                r = bus_message_append_ap(m, types, ap);
+                r = sd_bus_message_appendv(m, types, ap);
                 va_end(ap);
                 if (r < 0)
                         return r;
                 va_end(ap);
                 if (r < 0)
                         return r;
@@ -86,7 +86,7 @@ _public_ int sd_bus_call_method_async(
                 va_list ap;
 
                 va_start(ap, types);
                 va_list ap;
 
                 va_start(ap, types);
-                r = bus_message_append_ap(m, types, ap);
+                r = sd_bus_message_appendv(m, types, ap);
                 va_end(ap);
                 if (r < 0)
                         return r;
                 va_end(ap);
                 if (r < 0)
                         return r;
@@ -125,7 +125,7 @@ _public_ int sd_bus_call_method(
                 va_list ap;
 
                 va_start(ap, types);
                 va_list ap;
 
                 va_start(ap, types);
-                r = bus_message_append_ap(m, types, ap);
+                r = sd_bus_message_appendv(m, types, ap);
                 va_end(ap);
                 if (r < 0)
                         goto fail;
                 va_end(ap);
                 if (r < 0)
                         goto fail;
@@ -164,7 +164,7 @@ _public_ int sd_bus_reply_method_return(
                 va_list ap;
 
                 va_start(ap, types);
                 va_list ap;
 
                 va_start(ap, types);
-                r = bus_message_append_ap(m, types, ap);
+                r = sd_bus_message_appendv(m, types, ap);
                 va_end(ap);
                 if (r < 0)
                         return r;
                 va_end(ap);
                 if (r < 0)
                         return r;
@@ -498,7 +498,7 @@ _public_ int sd_bus_set_property(
                 goto fail;
 
         va_start(ap, type);
                 goto fail;
 
         va_start(ap, type);
-        r = bus_message_append_ap(m, type, ap);
+        r = sd_bus_message_appendv(m, type, ap);
         va_end(ap);
         if (r < 0)
                 goto fail;
         va_end(ap);
         if (r < 0)
                 goto fail;
index 1c5f885e147692ddf18aff41d10718b68fcf17c9..cbe9c6259cc21236cdf0dc0cbe5b2c1b13bb2c8d 100644 (file)
@@ -2351,7 +2351,7 @@ static int type_stack_pop(TypeStack *stack, unsigned max, unsigned *i, const cha
         return 1;
 }
 
         return 1;
 }
 
-int bus_message_append_ap(
+_public_ int sd_bus_message_appendv(
                 sd_bus_message *m,
                 const char *types,
                 va_list ap) {
                 sd_bus_message *m,
                 const char *types,
                 va_list ap) {
@@ -2361,10 +2361,10 @@ int bus_message_append_ap(
         unsigned stack_ptr = 0;
         int r;
 
         unsigned stack_ptr = 0;
         int r;
 
-        assert(m);
-
-        if (!types)
-                return 0;
+        assert_return(m, -EINVAL);
+        assert_return(types, -EINVAL);
+        assert_return(!m->sealed, -EPERM);
+        assert_return(!m->poisoned, -ESTALE);
 
         n_array = (unsigned) -1;
         n_struct = strlen(types);
 
         n_array = (unsigned) -1;
         n_struct = strlen(types);
@@ -2565,7 +2565,7 @@ _public_ int sd_bus_message_append(sd_bus_message *m, const char *types, ...) {
         assert_return(!m->poisoned, -ESTALE);
 
         va_start(ap, types);
         assert_return(!m->poisoned, -ESTALE);
 
         va_start(ap, types);
-        r = bus_message_append_ap(m, types, ap);
+        r = sd_bus_message_appendv(m, types, ap);
         va_end(ap);
 
         return r;
         va_end(ap);
 
         return r;
index d0fbc4db196d7e7cb5149f83cae6e8c73368b68d..df501d3166b61f70877d036fd6d3999ef748bf85 100644 (file)
@@ -222,8 +222,6 @@ int bus_message_from_malloc(
 int bus_message_get_arg(sd_bus_message *m, unsigned i, const char **str);
 int bus_message_get_arg_strv(sd_bus_message *m, unsigned i, char ***strv);
 
 int bus_message_get_arg(sd_bus_message *m, unsigned i, const char **str);
 int bus_message_get_arg_strv(sd_bus_message *m, unsigned i, char ***strv);
 
-int bus_message_append_ap(sd_bus_message *m, const char *types, va_list ap);
-
 int bus_message_parse_fields(sd_bus_message *m);
 
 struct bus_body_part *message_append_part(sd_bus_message *m);
 int bus_message_parse_fields(sd_bus_message *m);
 
 struct bus_body_part *message_append_part(sd_bus_message *m);