[patch] generate marshallers and metadata from dbus-glib-tool

Havoc Pennington hp at redhat.com
Tue Nov 9 22:22:35 PST 2004

On Tue, 2004-11-09 at 20:59 -0500, Colin Walters wrote:
> To be a bit more precise, the distinction is ownership of the memory,
> not dynamic/static allocation.  One approach would be to just always
> assume the marshallers own the string, but that would kind of suck if
> you were were exporting say a text widget with a GetBuffer method, that
> would normally return a const pointer to a potentially very large
> buffer.

I think we should have the consistent convention that out params have to
be freed by the caller. Just seems simpler as a start. I suppose GObject
introspection framework, whatever it is, will surely support 
"const char* foo_get_name()" type of stuff though.

>   On the other hand - DBusMessage already copies everything you
> stick in to it (something I think we should not do as an option for byte
> [] at least, but that's another issue).

Two options:

 - add _unswapped() variants to the getters, and then either 
   message_get_byte_order() or message_has_native_byte_order()

 - always return by const reference; if you call a getter 
   on a field/arg where byte order matters, and the message is in the 
   wrong byte order, swap the *entire* message in place and then 
   return the const ref. i.e. byteswap lazily.
   There are possible odd side effects of this, since reading would 
   involve writing.


More information about the dbus mailing list