This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> > 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]