[systemd-devel] [WIP][PATCH 2/3] machinectl: port to sd-bus

Lennart Poettering lennart at poettering.net
Mon Oct 28 11:53:22 PDT 2013


On Sun, 20.10.13 23:59, Tom Gundersen (teg at jklm.no) wrote:

> Is there a better way to parse the messages in show_one()?

We have no API calls that can do property GetAll() for you. The reason
is simply that I couldn't see what we could do any easier than just
doing sd_bus_call_method() for it...

> +                if (streq(contents, "s")) {
> +                        const char **s;
> +                        size_t n;
> +                        bool space = false;
> +
> +                        sd_bus_message_read_array(property,
> SD_BUS_TYPE_STRING, (const void**) &s, &n);

read_array only works for "trivial" types, i.e. those which do not
involve pointers and which have a fixed size. Strings are not of this kind...

Looks good otherwise!

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list