RE: [PATCH:MI] Return a subset of a variable object's children

Marc Khouzam
2008-05-01T17:29:21Z

> > How about something like this (assuming quick_push does what I think it does)
> >
> > var->children = VEC_alloc(varobj_p, var->num_children);
> > for (i=0; i<var->num_children; i++)
> > VEC_quick_push (varobj_p, var->children, NULL);
> >
> > Same loop, but it avoids having to reallocate the vector.
>
> Yes, it's a bit more efficient.

In fact, I actually just read the vec.h header comment and that is pretty
much what is recommended. In fact, the size value passed to VEC_alloc
should probably be negative here, to have even more efficiency, since
we know the vector won't grow.

But that is no longer the case with Nick's patch, as the vector will keep
on growing.