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 1/4] new gdb_queue.h in common/.


On 09/13/2012 11:54 PM, dje@google.com wrote:
  > +void									\
  > +queue_ ## TYPE ## _remove_elem (QUEUE (TYPE) *q,			\
  > +				QUEUE_ITER (TYPE) *iter)		\
  > +{									\

gdb_assert (q != NULL);
gdb_assert (iter != NULL && iter->p != NULL);

  > +  if (iter->p == q->head || iter->p == q->tail)			\
  > +    {									\
  > +      if (iter->p == q->head)						\
  > +	q->head = iter->p->next;					\
  > +      if (iter->p == q->tail)						\
  > +	q->tail = iter->prev;						\
  > +    }									\
  > +  else									\
  > +    iter->prev->next = iter->p->next;					\
  > +									\

Need to check if q->free_func != NULL and call it on p->data.

We don't have to delete p->data here, because we just remove element, and p->data may be used by user later, like function _remove, for example. User has to take care of deleting p->data in his 'operate' function.


> I'm happy with the above nits fixed.

Doug, thanks a lot for your patient review. Looks queue.h is in shape, and I'll post a V2 of this series.

--
Yao


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