/[svn]/branches/newio/src/list.c
ViewVC logotype

Diff of /branches/newio/src/list.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2715 by michael, Fri Jul 19 20:39:58 2013 UTC revision 2716 by michael, Tue Dec 24 21:15:48 2013 UTC
# Line 245  dlink_move_node(dlink_node *m, dlink_lis Line 245  dlink_move_node(dlink_node *m, dlink_lis
245  dlink_node *  dlink_node *
246  dlinkFindDelete(dlink_list *list, void *data)  dlinkFindDelete(dlink_list *list, void *data)
247  {  {
248    dlink_node *m;    dlink_node *m = NULL;
249    
250    DLINK_FOREACH(m, list->head)    DLINK_FOREACH(m, list->head)
251    {    {
252      if (m->data == data)      if (m->data != data)
253          continue;
254    
255        if (m->next)
256          m->next->prev = m->prev;
257        else
258      {      {
259        if (m->next)        assert(list->tail == m);
260          m->next->prev = m->prev;        list->tail = m->prev;
261        else      }
       {  
         assert(list->tail == m);  
         list->tail = m->prev;  
       }  
       if (m->prev)  
         m->prev->next = m->next;  
       else  
       {  
         assert(list->head == m);  
         list->head = m->next;  
       }  
       /* Set this to NULL does matter */  
       m->next = m->prev = NULL;  
       list->length--;  
262    
263        return m;      if (m->prev)
264          m->prev->next = m->next;
265        else
266        {
267          assert(list->head == m);
268          list->head = m->next;
269      }      }
270    
271        /* Set this to NULL does matter */
272        m->next = m->prev = NULL;
273        list->length--;
274    
275        return m;
276    }    }
277    
278    return NULL;    return NULL;
279  }  }
   
   

Legend:
Removed from v.2715  
changed lines
  Added in v.2716

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28