ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/libltdl/slist.c
(Generate patch)

Comparing:
ircd-hybrid/libltdl/slist.c (file contents), Revision 1028 by michael, Sun Nov 8 13:03:38 2009 UTC vs.
ircd-hybrid/branches/8.2.x/libltdl/slist.c (file contents), Revision 4901 by michael, Sat Nov 22 18:31:53 2014 UTC

# Line 1 | Line 1
1   /* slist.c -- generalised singly linked lists
2  
3 <   Copyright (C) 2000, 2004, 2007, 2008 Free Software Foundation, Inc.
3 >   Copyright (C) 2000, 2004, 2007-2009, 2011-2014 Free Software
4 >   Foundation, Inc.
5     Written by Gary V. Vaughan, 2000
6  
7     NOTE: The canonical source of this file is maintained with the
# Line 31 | Line 32 | or obtained by writing to the Free Softw
32   #include <assert.h>
33  
34   #include "slist.h"
35 < #include <stddef.h>
35 > #include <stdlib.h>
36  
37   static SList *  slist_sort_merge    (SList *left, SList *right,
38                                       SListCompare *compare, void *userdata);
# Line 73 | Line 74 | slist_delete (SList *head, void (*delete
74             the stale item, you should probably return that from FIND if
75             it makes a successful match.  Don't forget to slist_unbox()
76             every item in a boxed list before operating on its contents.   */
77 < void *
77 > SList *
78   slist_remove (SList **phead, SListCallback *find, void *matchdata)
79   {
80    SList *stale = 0;
# Line 107 | Line 108 | slist_remove (SList **phead, SListCallba
108          }
109      }
110  
111 <  return result;
111 >  return (SList *) result;
112   }
113  
114   /* Call FIND repeatedly with each element of SLIST and MATCHDATA, until
# Line 229 | Line 230 | slist_reverse (SList *slist)
230        next              = slist->next;
231        slist->next       = result;
232        result            = slist;
233 <      slist             = next;
233 >      slist             = next;
234      }
235  
236    return result;
# Line 314 | Line 315 | slist_sort (SList *slist, SListCompare *
315    left = slist;
316    right = slist->next;
317  
318 +  if (!right)
319 +    return left;
320 +
321    /* Skip two items with RIGHT and one with SLIST, until RIGHT falls off
322       the end.  SLIST must be about half way along.  */
323    while (right && (right = right->next))
# Line 341 | Line 345 | slist_sort (SList *slist, SListCompare *
345     used for the boxes.  It us usually a very bad idea to mix boxed and
346     non-boxed items in a single list.  */
347  
348 < /* Return a `boxed' freshly mallocated 1 element list containing
348 > /* Return a 'boxed' freshly mallocated 1 element list containing
349     USERDATA.  */
350   SList *
351   slist_box (const void *userdata)
# Line 357 | Line 361 | slist_box (const void *userdata)
361    return item;
362   }
363  
364 < /* Return the contents of a `boxed' ITEM, recycling the box itself.  */
364 > /* Return the contents of a 'boxed' ITEM, recycling the box itself.  */
365   void *
366   slist_unbox (SList *item)
367   {

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)