From cf2edf1d5cb9611c53d08b1f04059b2265c0578c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 13 Jun 2022 11:17:17 +0200 Subject: [PATCH] sd-bus: export sd_bus_message_read_strv_extend() The same story as before: it's a useful helper, other uses of the library are likely to find it useful. --- src/libsystemd/libsystemd.sym | 1 + src/libsystemd/sd-bus/bus-message.c | 4 ++-- src/libsystemd/sd-bus/bus-message.h | 1 - src/shared/bus-map-properties.c | 4 ++-- src/systemd/sd-bus.h | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym index 87a2897eea9..cb27f17c56e 100644 --- a/src/libsystemd/libsystemd.sym +++ b/src/libsystemd/libsystemd.sym @@ -781,6 +781,7 @@ global: LIBSYSTEMD_252 { global: + sd_bus_message_read_strv_extend; sd_bus_error_setfv; sd_id128_string_equal; diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 674884a3c8e..d9c52d64c07 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -4256,7 +4256,7 @@ int bus_message_get_blob(sd_bus_message *m, void **buffer, size_t *sz) { return 0; } -int bus_message_read_strv_extend(sd_bus_message *m, char ***l) { +_public_ int sd_bus_message_read_strv_extend(sd_bus_message *m, char ***l) { char type; const char *contents, *s; int r; @@ -4299,7 +4299,7 @@ _public_ int sd_bus_message_read_strv(sd_bus_message *m, char ***l) { assert_return(m->sealed, -EPERM); assert_return(l, -EINVAL); - r = bus_message_read_strv_extend(m, &strv); + r = sd_bus_message_read_strv_extend(m, &strv); if (r <= 0) return r; diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h index b51fb896ed4..0439fbd45a8 100644 --- a/src/libsystemd/sd-bus/bus-message.h +++ b/src/libsystemd/sd-bus/bus-message.h @@ -159,7 +159,6 @@ static inline void* BUS_MESSAGE_FIELDS(sd_bus_message *m) { } int bus_message_get_blob(sd_bus_message *m, void **buffer, size_t *sz); -int bus_message_read_strv_extend(sd_bus_message *m, char ***l); int bus_message_from_malloc( sd_bus *bus, diff --git a/src/shared/bus-map-properties.c b/src/shared/bus-map-properties.c index 84608567aa6..e5e89339636 100644 --- a/src/shared/bus-map-properties.c +++ b/src/shared/bus-map-properties.c @@ -30,7 +30,7 @@ int bus_map_strv_sort(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus char ***p = userdata; int r; - r = bus_message_read_strv_extend(m, &l); + r = sd_bus_message_read_strv_extend(m, &l); if (r < 0) return r; @@ -75,7 +75,7 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigne _cleanup_strv_free_ char **l = NULL; char ***p = userdata; - r = bus_message_read_strv_extend(m, &l); + r = sd_bus_message_read_strv_extend(m, &l); if (r < 0) return r; diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index b3453471ab2..12168a22a2b 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -330,6 +330,7 @@ int sd_bus_message_readv(sd_bus_message *m, const char *types, va_list ap); 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); /* free the result! */ +int sd_bus_message_read_strv_extend(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);