[systemd-commits] src/libsystemd-bus src/systemd
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Nov 5 18:12:36 CET 2013
src/libsystemd-bus/bus-message.c | 20 +++++++++++++++++++-
src/systemd/sd-bus.h | 1 +
2 files changed, 20 insertions(+), 1 deletion(-)
New commits:
commit 4686d1b6ee73f1e0cea25f621561b668aa2d6651
Author: Marc-Antoine Perennou <Marc-Antoine at Perennou.com>
Date: Tue Nov 5 21:42:25 2013 +0900
bus: add sd_bus_message_read_strv()
It will be useful to have that in the public API.
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 7a4c65d..96d1778 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -4486,7 +4486,7 @@ int bus_message_read_strv_extend(sd_bus_message *m, char ***l) {
assert(l);
r = sd_bus_message_enter_container(m, 'a', "s");
- if (r < 0)
+ if (r <= 0)
return r;
for (;;) {
@@ -4510,6 +4510,24 @@ int bus_message_read_strv_extend(sd_bus_message *m, char ***l) {
return 0;
}
+int sd_bus_message_read_strv(sd_bus_message *m, char ***l) {
+ char **strv = NULL;
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->sealed, -EPERM);
+ assert_return(l, -EINVAL);
+
+ r = bus_message_read_strv_extend(m, &strv);
+ if (r <= 0) {
+ strv_free(strv);
+ return r;
+ }
+
+ *l = strv;
+ return 1;
+}
+
const char* bus_message_get_arg(sd_bus_message *m, unsigned i) {
int r;
const char *t = NULL;
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index e0a6041..c6f9409 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -197,6 +197,7 @@ int sd_bus_message_copy(sd_bus_message *m, sd_bus_message *source, int all);
int sd_bus_message_read(sd_bus_message *m, const char *types, ...);
int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p);
int sd_bus_message_read_array(sd_bus_message *m, char type, const void **ptr, size_t *size);
+int sd_bus_message_read_strv(sd_bus_message *m, char ***l);
int sd_bus_message_skip(sd_bus_message *m, const char *types);
int sd_bus_message_enter_container(sd_bus_message *m, char type, const char *contents);
int sd_bus_message_exit_container(sd_bus_message *m);
More information about the systemd-commits
mailing list