diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-08-05 18:32:42 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-08-18 22:23:31 +0200 |
commit | 8673cf13c08998b50818346b703ad91fe5facfdf (patch) | |
tree | 9bf2e2201a5c974ef473637fedca2512f74981db /src/shared | |
parent | 622a0f628cee51851ad00856f9efddedf0799edb (diff) |
bus-util: unify loop around bus_append_unit_property_assignment()
This is done exactly the same way a couple of times at various places, let's
unify this into one version.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bus-unit-util.c | 15 | ||||
-rw-r--r-- | src/shared/bus-unit-util.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index f9e12e0578..28bfa8b522 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -568,6 +568,21 @@ finish: return 0; } +int bus_append_unit_property_assignment_many(sd_bus_message *m, char **l) { + char **i; + int r; + + assert(m); + + STRV_FOREACH(i, l) { + r = bus_append_unit_property_assignment(m, *i); + if (r < 0) + return r; + } + + return 0; +} + typedef struct BusWaitForJobs { sd_bus *bus; Set *jobs; diff --git a/src/shared/bus-unit-util.h b/src/shared/bus-unit-util.h index c0c172f336..d102ea180e 100644 --- a/src/shared/bus-unit-util.h +++ b/src/shared/bus-unit-util.h @@ -41,6 +41,7 @@ typedef struct UnitInfo { int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u); int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignment); +int bus_append_unit_property_assignment_many(sd_bus_message *m, char **l); typedef struct BusWaitForJobs BusWaitForJobs; |