I've just comitted a fairly major reworking of the way children work in the SPObject layer -- now SPObject itself handles children directly, rather than each subclass having its own child list implementation. A lot of duplicate code related to that has also been "hoisted" into the base class.
This is still a very rough cut, and there are some performance and correctness issues to work out (most noticable when creating a new document window, and when exiting the application, respectively).
I'll be working on polishing it more over the next week or so.
Some things to note:
Now, instead of accessing SP_WHATEVER(foo)->children, please use sp_object_first_child(SP_OBJECT(foo)). Also, instead of SP_OBJECT(bar)->next, please use SP_OBJECT_NEXT(bar).
More generally, when you need to access a field of SPObject, use the accessors declared in sp-object.h rather than accessing data members directly -- the data members are likely to start changing soon.
-mental