recursive types work

Havoc Pennington hp@redhat.com
Mon Jan 24 19:10:02 PST 2005


On Mon, 2005-01-24 at 18:55 -0500, Joe Shaw wrote:
> Well, I am interested in the values.  The problem I am having is that I
> don't know whether the array I've just recursed into is empty or not.
> And it's the fact that when the array is empty it's invalid is why I am
> triggering failed assertions.  I think just adding a return value to
> dbus_message_iter_recurse() that's basically equivalent to
> dbus_message_iter_init() would work.

Can't you do dbus_message_iter_get_current_type(&array_iter) !=
DBUS_TYPE_INVALID?

That's what iter_init() does right and it should be the same thing for
inside an array.

Probably init() and recurse() should be consistent on whether they
return this automatically.
Oddly enough get_current_type() is one of the highest things in the
performance profile right now, so I'm wondering if we should drop the
return value from init(). Another reason to do that may be that it's a
bit confusing whether the return value is for OOM or "nothing to iterate
over"

I dunno, I haven't done a real performance analysis yet  - (k)cachegrind
is all busted on my system for some reason, and sysprof keeps disabling
my keyboard someway and that gets old.

Havoc





More information about the dbus mailing list