From: Federico Date: Tue, 25 Apr 2017 07:32:24 +0000 (+0200) Subject: Export sd_bus_message_append_ap. It is renamed to sd_bus_message_appendv to follow... X-Git-Tag: chiark/234.4-1+devuan1.1+iwj1~155 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=734744fddd783fec7b19215b24c12e95c00c1e67;p=elogind.git Export sd_bus_message_append_ap. It is renamed to sd_bus_message_appendv to follow elogind naming conventions. (#5753) 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. --- diff --git a/man/sd_bus_message_append.xml b/man/sd_bus_message_append.xml index 48a022d11..26af67cd3 100644 --- a/man/sd_bus_message_append.xml +++ b/man/sd_bus_message_append.xml @@ -45,6 +45,7 @@ sd_bus_message_append + sd_bus_message_appendv Attach fields to a D-Bus message based on a type string @@ -60,6 +61,14 @@ const char *types … + + + int sd_bus_message_appendv + sd_bus_message *m + const char *types + va_list ap + + @@ -109,6 +118,14 @@ values for each entry matching the element type of the dictionary entries. + The sd_bus_message_appendv() is equivalent to + the function sd_bus_message_append(), + except that it is called with a va_list instead of + a variable number of arguments. This function does not call the + va_end() macro. Because it invokes the + va_arg() macro, the value of ap + is undefined after the call. + For further details on the D-Bus type system, please consult the D-Bus @@ -238,8 +255,8 @@ sd_bus_message_append(m, "ynqiuxtd", y, n, q, i, u, x, t, d); Return Value - On success, this call returns 0 or a positive - integer. On failure, this call returns a negative + On success, these functions return 0 or a positive + integer. On failure, these functions return a negative errno-style error code. diff --git a/src/libelogind/libelogind.sym b/src/libelogind/libelogind.sym index 167f08ef3..a203f08c3 100644 --- a/src/libelogind/libelogind.sym +++ b/src/libelogind/libelogind.sym @@ -529,3 +529,8 @@ global: sd_id128_get_machine_app_specific; /* sd_is_socket_sockaddr; */ } LIBSYSTEMD_232; + +LIBSYSTEMD_234 { +global: + sd_bus_message_appendv; +} LIBSYSTEMD_233; diff --git a/src/libelogind/sd-bus/bus-convenience.c b/src/libelogind/sd-bus/bus-convenience.c index 9fdfdf447..1eb726462 100644 --- a/src/libelogind/sd-bus/bus-convenience.c +++ b/src/libelogind/sd-bus/bus-convenience.c @@ -48,7 +48,7 @@ _public_ int sd_bus_emit_signal( 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; @@ -86,7 +86,7 @@ _public_ int sd_bus_call_method_async( 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; @@ -125,7 +125,7 @@ _public_ int sd_bus_call_method( 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; @@ -164,7 +164,7 @@ _public_ int sd_bus_reply_method_return( 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; @@ -498,7 +498,7 @@ _public_ int sd_bus_set_property( 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; diff --git a/src/libelogind/sd-bus/bus-message.c b/src/libelogind/sd-bus/bus-message.c index 1c5f885e1..cbe9c6259 100644 --- a/src/libelogind/sd-bus/bus-message.c +++ b/src/libelogind/sd-bus/bus-message.c @@ -2351,7 +2351,7 @@ static int type_stack_pop(TypeStack *stack, unsigned max, unsigned *i, const cha return 1; } -int bus_message_append_ap( +_public_ int sd_bus_message_appendv( 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; - 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); @@ -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); - r = bus_message_append_ap(m, types, ap); + r = sd_bus_message_appendv(m, types, ap); va_end(ap); return r; diff --git a/src/libelogind/sd-bus/bus-message.h b/src/libelogind/sd-bus/bus-message.h index d0fbc4db1..df501d316 100644 --- a/src/libelogind/sd-bus/bus-message.h +++ b/src/libelogind/sd-bus/bus-message.h @@ -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_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);