dbus_message_get_array_len deprecated
Havoc Pennington
hp at pobox.com
Wed Jun 4 15:46:42 PDT 2008
Hi,
On Wed, Jun 4, 2008 at 6:00 PM, Gustavo <gugamilare at gmail.com> wrote:
> In the libdbus documentation it says (here) that the function
> dbus_message_get_array_len is deprecated in the sense it is "stupid". Well,
> is it really stupid? I am currently creating bindings for the language
> Common Lisp (as I already told in another e-mail) and this function allows
> me to create an array with the correct length before inserting its contents
> (an array in Lisp don't care about the type of its elements so it fits well
> in any case, even if the array element type isn't "fixed"). It saves me the
> trouble of creating a list to acumulate values (while counting them) and
> then creating the array with the contents of the list, or the trouble of
> initially counting the elements, start all over and only then create the
> array, inserting the values into it...
I had not thought of this use, but note you aren't creating an array
of the correct length really, more just approximately the correct
length ... I mean, I doubt the space to store a bunch of strings in
lisp happens to match the space it takes to store them in the dbus
wire protocol. It may be true that by accident due to the nature of
each format, the wire protocol length is always longer than the lisp
length, or something like that. But it would be purely an accident if
so.
Tough to say more without knowing about your lisp implementation. In
any case, the function won't go away unless libdbus ABI is ever
broken, which there are no known plans for, so you can probably figure
this function will be around for a few years at least.
I'm uncomfortable having just one function in the API that provides a
random detail about the wire protocol, when in general the API does
not expose the lower-level parts of the wire protocol.
Havoc
More information about the dbus
mailing list