Argument array of strings

Havoc Pennington hp at redhat.com
Sat Oct 21 10:00:26 PDT 2006


Havoc Pennington wrote:
> 
> This is _not_ on purpose just a screwup. I think we should put #ifndef 
> DBUS_DISABLE_DEPRECATED around this function and introduce 
> dbus_message_iter_get_n_elements() that does something useful.
> 

I'm adding the DBUS_DISABLE_DEPRECATED but I don't think we really need 
get_n_elements() at least not before 1.0.

dbus_message_iter_get_fixed_array already returns the number of 
elements, so it isn't needed there.

For string arrays, the implementation of get_n_elements() would have to 
iterate over the array and count the number of strings, while most 
people would probably assume it's faster than that. So, for now just 
letting people iterate-and-count themselves seems fine.

Also, dbus-glib at least contains a misuse of get_array_len(), everyone 
should probably check for this in their code.

Havoc


More information about the dbus mailing list