On Thu, 07.11.13 19:15, Lennart Poettering ([email protected]) wrote:

> On Thu, 07.11.13 13:49, Marc-Antoine Perennou ([email protected]) 
> wrote:
> 
> This one is unfortunately not that easy. The reason this checks for
> trivial and not basic types is that strings (which are basic, but not
> trivial) are pointers in C. Usually we just return pointers into the
> actual message. However, in this case the message is freed before
> returning from sd_bus_get_property_trivial(), hence we cannot do
> this. The alternative would be to allocate the thing from the heap and
> return that, but that means the caller must know that and free it
> afterwards. But those would be quite surprising semantics, especially
> given that sd_bus_read_basic() does not require this, and the non-string
> basic types require neither.
> 
> I can see though that it would be a good thing to read strings with an
> easy call. I am hence going to add a separate call for this now, which
> hopefully makes this a bit more understandable.

I now added sd_bus_get_property_string() and sd_bus_get_property_strv()
to make it easy to read strings and strv properties. For both of them
the result must be freed.

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to