~ubuntu-branches/ubuntu/maverick/glib2.0/maverick

« back to all changes in this revision

Viewing changes to glib/gslist.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-09-27 15:25:56 UTC
  • mfrom: (3.4.26 experimental)
  • Revision ID: james.westby@ubuntu.com-20100927152556-s263f7x9yqcxh59e
Tags: 2.25.16-1ubuntu1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
22
22
 * file for a list of people on the GLib Team.  See the ChangeLog
23
23
 * files for a list of changes.  These files are distributed with
24
 
 * GLib at ftp://ftp.gtk.org/pub/gtk/. 
 
24
 * GLib at ftp://ftp.gtk.org/pub/gtk/.
25
25
 */
26
26
 
27
 
/* 
 
27
/*
28
28
 * MT safe
29
29
 */
30
30
 
31
31
#include "config.h"
32
32
 
33
 
#include "glib.h"
 
33
#include "gslist.h"
 
34
#include "gtestutils.h"
34
35
 
35
36
/**
36
37
 * SECTION: linked_lists_single
168
169
/**
169
170
 * g_slist_free_1:
170
171
 * @list: a #GSList element
171
 
 * 
 
172
 *
172
173
 * Frees one #GSList element.
173
174
 * It is usually used after g_slist_remove_link().
174
175
 */
193
194
 * Adds a new element on to the end of the list.
194
195
 *
195
196
 * <note><para>
196
 
 * The return value is the new start of the list, which may 
 
197
 * The return value is the new start of the list, which may
197
198
 * have changed, so make sure you store the new value.
198
199
 * </para></note>
199
200
 *
200
201
 * <note><para>
201
 
 * Note that g_slist_append() has to traverse the entire list 
202
 
 * to find the end, which is inefficient when adding multiple 
203
 
 * elements. A common idiom to avoid the inefficiency is to prepend 
 
202
 * Note that g_slist_append() has to traverse the entire list
 
203
 * to find the end, which is inefficient when adding multiple
 
204
 * elements. A common idiom to avoid the inefficiency is to prepend
204
205
 * the elements and reverse the list when all elements have been added.
205
206
 * </para></note>
206
207
 *
221
222
 */
222
223
GSList*
223
224
g_slist_append (GSList   *list,
224
 
                gpointer  data)
 
225
                gpointer  data)
225
226
{
226
227
  GSList *new_list;
227
228
  GSList *last;
250
251
 * Adds a new element on to the start of the list.
251
252
 *
252
253
 * <note><para>
253
 
 * The return value is the new start of the list, which 
 
254
 * The return value is the new start of the list, which
254
255
 * may have changed, so make sure you store the new value.
255
256
 * </para></note>
256
257
 *
265
266
 */
266
267
GSList*
267
268
g_slist_prepend (GSList   *list,
268
 
                 gpointer  data)
 
269
                 gpointer  data)
269
270
{
270
271
  GSList *new_list;
271
272
 
280
281
 * g_slist_insert:
281
282
 * @list: a #GSList
282
283
 * @data: the data for the new element
283
 
 * @position: the position to insert the element. 
284
 
 *     If this is negative, or is larger than the number 
 
284
 * @position: the position to insert the element.
 
285
 *     If this is negative, or is larger than the number
285
286
 *     of elements in the list, the new element is added on
286
287
 *     to the end of the list.
287
288
 *
291
292
 */
292
293
GSList*
293
294
g_slist_insert (GSList   *list,
294
 
                gpointer  data,
295
 
                gint      position)
 
295
                gpointer  data,
 
296
                gint      position)
296
297
{
297
298
  GSList *prev_list;
298
299
  GSList *tmp_list;
341
342
 * @sibling: node to insert @data before
342
343
 * @data: data to put in the newly-inserted node
343
344
 *
344
 
 * Inserts a node before @sibling containing @data. 
345
 
 * 
 
345
 * Inserts a node before @sibling containing @data.
 
346
 *
346
347
 * Returns: the new head of the list.
347
348
 */
348
349
GSList*
349
350
g_slist_insert_before (GSList  *slist,
350
 
                       GSList  *sibling,
351
 
                       gpointer data)
 
351
                       GSList  *sibling,
 
352
                       gpointer data)
352
353
{
353
354
  if (!slist)
354
355
    {
363
364
      GSList *node, *last = NULL;
364
365
 
365
366
      for (node = slist; node; last = node, node = last->next)
366
 
        if (node == sibling)
367
 
          break;
 
367
        if (node == sibling)
 
368
          break;
368
369
      if (!last)
369
 
        {
370
 
          node = _g_slist_alloc ();
371
 
          node->data = data;
372
 
          node->next = slist;
 
370
        {
 
371
          node = _g_slist_alloc ();
 
372
          node->data = data;
 
373
          node->next = slist;
373
374
 
374
 
          return node;
375
 
        }
 
375
          return node;
 
376
        }
376
377
      else
377
 
        {
378
 
          node = _g_slist_alloc ();
379
 
          node->data = data;
380
 
          node->next = last->next;
381
 
          last->next = node;
 
378
        {
 
379
          node = _g_slist_alloc ();
 
380
          node->data = data;
 
381
          node->next = last->next;
 
382
          last->next = node;
382
383
 
383
 
          return slist;
384
 
        }
 
384
          return slist;
 
385
        }
385
386
    }
386
387
}
387
388
 
402
403
  if (list2)
403
404
    {
404
405
      if (list1)
405
 
        g_slist_last (list1)->next = list2;
 
406
        g_slist_last (list1)->next = list2;
406
407
      else
407
 
        list1 = list2;
 
408
        list1 = list2;
408
409
    }
409
410
 
410
411
  return list1;
423
424
 */
424
425
GSList*
425
426
g_slist_remove (GSList        *list,
426
 
                gconstpointer  data)
 
427
                gconstpointer  data)
427
428
{
428
429
  GSList *tmp, *prev = NULL;
429
430
 
431
432
  while (tmp)
432
433
    {
433
434
      if (tmp->data == data)
434
 
        {
435
 
          if (prev)
436
 
            prev->next = tmp->next;
437
 
          else
438
 
            list = tmp->next;
 
435
        {
 
436
          if (prev)
 
437
            prev->next = tmp->next;
 
438
          else
 
439
            list = tmp->next;
439
440
 
440
 
          g_slist_free_1 (tmp);
441
 
          break;
442
 
        }
 
441
          g_slist_free_1 (tmp);
 
442
          break;
 
443
        }
443
444
      prev = tmp;
444
445
      tmp = prev->next;
445
446
    }
452
453
 * @list: a #GSList
453
454
 * @data: data to remove
454
455
 *
455
 
 * Removes all list nodes with data equal to @data. 
456
 
 * Returns the new head of the list. Contrast with 
457
 
 * g_slist_remove() which removes only the first node 
 
456
 * Removes all list nodes with data equal to @data.
 
457
 * Returns the new head of the list. Contrast with
 
458
 * g_slist_remove() which removes only the first node
458
459
 * matching the given data.
459
460
 *
460
461
 * Returns: new head of @list
461
462
 */
462
463
GSList*
463
464
g_slist_remove_all (GSList        *list,
464
 
                    gconstpointer  data)
 
465
                    gconstpointer  data)
465
466
{
466
467
  GSList *tmp, *prev = NULL;
467
468
 
469
470
  while (tmp)
470
471
    {
471
472
      if (tmp->data == data)
472
 
        {
473
 
          GSList *next = tmp->next;
474
 
 
475
 
          if (prev)
476
 
            prev->next = next;
477
 
          else
478
 
            list = next;
479
 
          
480
 
          g_slist_free_1 (tmp);
481
 
          tmp = next;
482
 
        }
 
473
        {
 
474
          GSList *next = tmp->next;
 
475
 
 
476
          if (prev)
 
477
            prev->next = next;
 
478
          else
 
479
            list = next;
 
480
 
 
481
          g_slist_free_1 (tmp);
 
482
          tmp = next;
 
483
        }
483
484
      else
484
 
        {
485
 
          prev = tmp;
486
 
          tmp = prev->next;
487
 
        }
 
485
        {
 
486
          prev = tmp;
 
487
          tmp = prev->next;
 
488
        }
488
489
    }
489
490
 
490
491
  return list;
492
493
 
493
494
static inline GSList*
494
495
_g_slist_remove_link (GSList *list,
495
 
                      GSList *link)
 
496
                      GSList *link)
496
497
{
497
498
  GSList *tmp;
498
499
  GSList *prev;
503
504
  while (tmp)
504
505
    {
505
506
      if (tmp == link)
506
 
        {
507
 
          if (prev)
508
 
            prev->next = tmp->next;
509
 
          if (list == tmp)
510
 
            list = list->next;
 
507
        {
 
508
          if (prev)
 
509
            prev->next = tmp->next;
 
510
          if (list == tmp)
 
511
            list = list->next;
511
512
 
512
 
          tmp->next = NULL;
513
 
          break;
514
 
        }
 
513
          tmp->next = NULL;
 
514
          break;
 
515
        }
515
516
 
516
517
      prev = tmp;
517
518
      tmp = tmp->next;
525
526
 * @list: a #GSList
526
527
 * @link_: an element in the #GSList
527
528
 *
528
 
 * Removes an element from a #GSList, without 
529
 
 * freeing the element. The removed element's next 
 
529
 * Removes an element from a #GSList, without
 
530
 * freeing the element. The removed element's next
530
531
 * link is set to %NULL, so that it becomes a
531
532
 * self-contained list with one element.
532
533
 *
533
534
 * Returns: the new start of the #GSList, without the element
534
535
 */
535
 
GSList* 
 
536
GSList*
536
537
g_slist_remove_link (GSList *list,
537
 
                     GSList *link_)
 
538
                     GSList *link_)
538
539
{
539
540
  return _g_slist_remove_link (list, link_);
540
541
}
544
545
 * @list: a #GSList
545
546
 * @link_: node to delete
546
547
 *
547
 
 * Removes the node link_ from the list and frees it. 
548
 
 * Compare this to g_slist_remove_link() which removes the node 
 
548
 * Removes the node link_ from the list and frees it.
 
549
 * Compare this to g_slist_remove_link() which removes the node
549
550
 * without freeing it.
550
551
 *
551
552
 * Returns: the new head of @list
552
553
 */
553
554
GSList*
554
555
g_slist_delete_link (GSList *list,
555
 
                     GSList *link_)
 
556
                     GSList *link_)
556
557
{
557
558
  list = _g_slist_remove_link (list, link_);
558
559
  _g_slist_free1 (link_);
563
564
/**
564
565
 * g_slist_copy:
565
566
 * @list: a #GSList
566
 
 * 
 
567
 *
567
568
 * Copies a #GSList.
568
 
 * 
 
569
 *
569
570
 * <note><para>
570
 
 * Note that this is a "shallow" copy. If the list elements 
571
 
 * consist of pointers to data, the pointers are copied but 
 
571
 * Note that this is a "shallow" copy. If the list elements
 
572
 * consist of pointers to data, the pointers are copied but
572
573
 * the actual data isn't.
573
574
 * </para></note>
574
575
 *
588
589
      last = new_list;
589
590
      list = list->next;
590
591
      while (list)
591
 
        {
592
 
          last->next = _g_slist_alloc ();
593
 
          last = last->next;
594
 
          last->data = list->data;
595
 
          list = list->next;
596
 
        }
 
592
        {
 
593
          last->next = _g_slist_alloc ();
 
594
          last = last->next;
 
595
          last->data = list->data;
 
596
          list = list->next;
 
597
        }
597
598
      last->next = NULL;
598
599
    }
599
600
 
612
613
g_slist_reverse (GSList *list)
613
614
{
614
615
  GSList *prev = NULL;
615
 
  
 
616
 
616
617
  while (list)
617
618
    {
618
619
      GSList *next = list->next;
619
620
 
620
621
      list->next = prev;
621
 
      
 
622
 
622
623
      prev = list;
623
624
      list = next;
624
625
    }
625
 
  
 
626
 
626
627
  return prev;
627
628
}
628
629
 
633
634
 *
634
635
 * Gets the element at the given position in a #GSList.
635
636
 *
636
 
 * Returns: the element, or %NULL if the position is off 
 
637
 * Returns: the element, or %NULL if the position is off
637
638
 *     the end of the #GSList
638
639
 */
639
640
GSList*
640
641
g_slist_nth (GSList *list,
641
 
             guint   n)
 
642
             guint   n)
642
643
{
643
644
  while (n-- > 0 && list)
644
645
    list = list->next;
653
654
 *
654
655
 * Gets the data of the element at the given position.
655
656
 *
656
 
 * Returns: the element's data, or %NULL if the position 
 
657
 * Returns: the element's data, or %NULL if the position
657
658
 *     is off the end of the #GSList
658
659
 */
659
660
gpointer
660
661
g_slist_nth_data (GSList   *list,
661
 
                  guint     n)
 
662
                  guint     n)
662
663
{
663
664
  while (n-- > 0 && list)
664
665
    list = list->next;
671
672
 * @list: a #GSList
672
673
 * @data: the element data to find
673
674
 *
674
 
 * Finds the element in a #GSList which 
 
675
 * Finds the element in a #GSList which
675
676
 * contains the given data.
676
677
 *
677
 
 * Returns: the found #GSList element, 
 
678
 * Returns: the found #GSList element,
678
679
 *     or %NULL if it is not found
679
680
 */
680
681
GSList*
681
682
g_slist_find (GSList        *list,
682
 
              gconstpointer  data)
 
683
              gconstpointer  data)
683
684
{
684
685
  while (list)
685
686
    {
686
687
      if (list->data == data)
687
 
        break;
 
688
        break;
688
689
      list = list->next;
689
690
    }
690
691
 
696
697
 * g_slist_find_custom:
697
698
 * @list: a #GSList
698
699
 * @data: user data passed to the function
699
 
 * @func: the function to call for each element. 
 
700
 * @func: the function to call for each element.
700
701
 *     It should return 0 when the desired element is found
701
702
 *
702
 
 * Finds an element in a #GSList, using a supplied function to 
703
 
 * find the desired element. It iterates over the list, calling 
704
 
 * the given function which should return 0 when the desired 
705
 
 * element is found. The function takes two #gconstpointer arguments, 
706
 
 * the #GSList element's data as the first argument and the 
 
703
 * Finds an element in a #GSList, using a supplied function to
 
704
 * find the desired element. It iterates over the list, calling
 
705
 * the given function which should return 0 when the desired
 
706
 * element is found. The function takes two #gconstpointer arguments,
 
707
 * the #GSList element's data as the first argument and the
707
708
 * given user data.
708
709
 *
709
710
 * Returns: the found #GSList element, or %NULL if it is not found
710
711
 */
711
712
GSList*
712
713
g_slist_find_custom (GSList        *list,
713
 
                     gconstpointer  data,
714
 
                     GCompareFunc   func)
 
714
                     gconstpointer  data,
 
715
                     GCompareFunc   func)
715
716
{
716
717
  g_return_val_if_fail (func != NULL, list);
717
718
 
718
719
  while (list)
719
720
    {
720
721
      if (! func (list->data, data))
721
 
        return list;
 
722
        return list;
722
723
      list = list->next;
723
724
    }
724
725
 
730
731
 * @list: a #GSList
731
732
 * @llink: an element in the #GSList
732
733
 *
733
 
 * Gets the position of the given element 
 
734
 * Gets the position of the given element
734
735
 * in the #GSList (starting from 0).
735
736
 *
736
 
 * Returns: the position of the element in the #GSList, 
 
737
 * Returns: the position of the element in the #GSList,
737
738
 *     or -1 if the element is not found
738
739
 */
739
740
gint
740
741
g_slist_position (GSList *list,
741
 
                  GSList *llink)
 
742
                  GSList *llink)
742
743
{
743
744
  gint i;
744
745
 
746
747
  while (list)
747
748
    {
748
749
      if (list == llink)
749
 
        return i;
 
750
        return i;
750
751
      i++;
751
752
      list = list->next;
752
753
    }
759
760
 * @list: a #GSList
760
761
 * @data: the data to find
761
762
 *
762
 
 * Gets the position of the element containing 
 
763
 * Gets the position of the element containing
763
764
 * the given data (starting from 0).
764
765
 *
765
 
 * Returns: the index of the element containing the data, 
 
766
 * Returns: the index of the element containing the data,
766
767
 *     or -1 if the data is not found
767
768
 */
768
769
gint
769
770
g_slist_index (GSList        *list,
770
 
               gconstpointer  data)
 
771
               gconstpointer  data)
771
772
{
772
773
  gint i;
773
774
 
775
776
  while (list)
776
777
    {
777
778
      if (list->data == data)
778
 
        return i;
 
779
        return i;
779
780
      i++;
780
781
      list = list->next;
781
782
    }
785
786
 
786
787
/**
787
788
 * g_slist_last:
788
 
 * @list: a #GSList 
 
789
 * @list: a #GSList
789
790
 *
790
791
 * Gets the last element in a #GSList.
791
 
 *  
 
792
 *
792
793
 * <note><para>
793
794
 * This function iterates over the whole list.
794
795
 * </para></note>
795
796
 *
796
 
 * Returns: the last element in the #GSList, 
 
797
 * Returns: the last element in the #GSList,
797
798
 *     or %NULL if the #GSList has no elements
798
799
 */
799
800
GSList*
802
803
  if (list)
803
804
    {
804
805
      while (list->next)
805
 
        list = list->next;
 
806
        list = list->next;
806
807
    }
807
808
 
808
809
  return list;
815
816
 * Gets the number of elements in a #GSList.
816
817
 *
817
818
 * <note><para>
818
 
 * This function iterates over the whole list to 
 
819
 * This function iterates over the whole list to
819
820
 * count its elements.
820
821
 * </para></note>
821
822
 *
846
847
 */
847
848
void
848
849
g_slist_foreach (GSList   *list,
849
 
                 GFunc     func,
850
 
                 gpointer  user_data)
 
850
                 GFunc     func,
 
851
                 gpointer  user_data)
851
852
{
852
853
  while (list)
853
854
    {
859
860
 
860
861
static GSList*
861
862
g_slist_insert_sorted_real (GSList   *list,
862
 
                            gpointer  data,
863
 
                            GFunc     func,
864
 
                            gpointer  user_data)
 
863
                            gpointer  data,
 
864
                            GFunc     func,
 
865
                            gpointer  user_data)
865
866
{
866
867
  GSList *tmp_list = list;
867
868
  GSList *prev_list = NULL;
868
869
  GSList *new_list;
869
870
  gint cmp;
870
 
 
 
871
 
871
872
  g_return_val_if_fail (func != NULL, list);
872
873
 
873
874
  if (!list)
877
878
      new_list->next = NULL;
878
879
      return new_list;
879
880
    }
880
 
 
 
881
 
881
882
  cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data);
882
 
 
 
883
 
883
884
  while ((tmp_list->next) && (cmp > 0))
884
885
    {
885
886
      prev_list = tmp_list;
897
898
      new_list->next = NULL;
898
899
      return list;
899
900
    }
900
 
  
 
901
 
901
902
  if (prev_list)
902
903
    {
903
904
      prev_list->next = new_list;
915
916
 * g_slist_insert_sorted:
916
917
 * @list: a #GSList
917
918
 * @data: the data for the new element
918
 
 * @func: the function to compare elements in the list. 
919
 
 *     It should return a number > 0 if the first parameter 
 
919
 * @func: the function to compare elements in the list.
 
920
 *     It should return a number > 0 if the first parameter
920
921
 *     comes after the second parameter in the sort order.
921
922
 *
922
 
 * Inserts a new element into the list, using the given 
 
923
 * Inserts a new element into the list, using the given
923
924
 * comparison function to determine its position.
924
925
 *
925
926
 * Returns: the new start of the #GSList
936
937
 * g_slist_insert_sorted_with_data:
937
938
 * @list: a #GSList
938
939
 * @data: the data for the new element
939
 
 * @func: the function to compare elements in the list. 
940
 
 *     It should return a number > 0 if the first parameter 
 
940
 * @func: the function to compare elements in the list.
 
941
 *     It should return a number > 0 if the first parameter
941
942
 *     comes after the second parameter in the sort order.
942
943
 * @user_data: data to pass to comparison function
943
944
 *
944
 
 * Inserts a new element into the list, using the given 
 
945
 * Inserts a new element into the list, using the given
945
946
 * comparison function to determine its position.
946
947
 *
947
948
 * Returns: the new start of the #GSList
950
951
 */
951
952
GSList*
952
953
g_slist_insert_sorted_with_data (GSList           *list,
953
 
                                 gpointer          data,
954
 
                                 GCompareDataFunc  func,
955
 
                                 gpointer          user_data)
 
954
                                 gpointer          data,
 
955
                                 GCompareDataFunc  func,
 
956
                                 gpointer          user_data)
956
957
{
957
958
  return g_slist_insert_sorted_real (list, data, (GFunc) func, user_data);
958
959
}
959
960
 
960
961
static GSList *
961
 
g_slist_sort_merge (GSList   *l1, 
962
 
                    GSList   *l2,
963
 
                    GFunc     compare_func,
964
 
                    gpointer  user_data)
 
962
g_slist_sort_merge (GSList   *l1,
 
963
                    GSList   *l2,
 
964
                    GFunc     compare_func,
 
965
                    gpointer  user_data)
965
966
{
966
967
  GSList list, *l;
967
968
  gint cmp;
974
975
 
975
976
      if (cmp <= 0)
976
977
        {
977
 
          l=l->next=l1;
978
 
          l1=l1->next;
979
 
        } 
980
 
      else 
981
 
        {
982
 
          l=l->next=l2;
983
 
          l2=l2->next;
 
978
          l=l->next=l1;
 
979
          l1=l1->next;
 
980
        }
 
981
      else
 
982
        {
 
983
          l=l->next=l2;
 
984
          l2=l2->next;
984
985
        }
985
986
    }
986
987
  l->next= l1 ? l1 : l2;
987
 
  
 
988
 
988
989
  return list.next;
989
990
}
990
991
 
991
992
static GSList *
992
993
g_slist_sort_real (GSList   *list,
993
 
                   GFunc     compare_func,
994
 
                   gpointer  user_data)
 
994
                   GFunc     compare_func,
 
995
                   gpointer  user_data)
995
996
{
996
997
  GSList *l1, *l2;
997
998
 
998
 
  if (!list) 
 
999
  if (!list)
999
1000
    return NULL;
1000
 
  if (!list->next) 
 
1001
  if (!list->next)
1001
1002
    return list;
1002
1003
 
1003
 
  l1 = list; 
 
1004
  l1 = list;
1004
1005
  l2 = list->next;
1005
1006
 
1006
1007
  while ((l2 = l2->next) != NULL)
1007
1008
    {
1008
 
      if ((l2 = l2->next) == NULL) 
1009
 
        break;
 
1009
      if ((l2 = l2->next) == NULL)
 
1010
        break;
1010
1011
      l1=l1->next;
1011
1012
    }
1012
 
  l2 = l1->next; 
 
1013
  l2 = l1->next;
1013
1014
  l1->next = NULL;
1014
1015
 
1015
1016
  return g_slist_sort_merge (g_slist_sort_real (list, compare_func, user_data),
1016
 
                             g_slist_sort_real (l2, compare_func, user_data),
1017
 
                             compare_func,
1018
 
                             user_data);
 
1017
                             g_slist_sort_real (l2, compare_func, user_data),
 
1018
                             compare_func,
 
1019
                             user_data);
1019
1020
}
1020
1021
 
1021
1022
/**
1022
1023
 * g_slist_sort:
1023
1024
 * @list: a #GSList
1024
1025
 * @compare_func: the comparison function used to sort the #GSList.
1025
 
 *     This function is passed the data from 2 elements of the #GSList 
1026
 
 *     and should return 0 if they are equal, a negative value if the 
1027
 
 *     first element comes before the second, or a positive value if 
 
1026
 *     This function is passed the data from 2 elements of the #GSList
 
1027
 *     and should return 0 if they are equal, a negative value if the
 
1028
 *     first element comes before the second, or a positive value if
1028
1029
 *     the first element comes after the second.
1029
1030
 *
1030
1031
 * Sorts a #GSList using the given comparison function.
1033
1034
 */
1034
1035
GSList *
1035
1036
g_slist_sort (GSList       *list,
1036
 
              GCompareFunc  compare_func)
 
1037
              GCompareFunc  compare_func)
1037
1038
{
1038
1039
  return g_slist_sort_real (list, (GFunc) compare_func, NULL);
1039
1040
}
1050
1051
 */
1051
1052
GSList *
1052
1053
g_slist_sort_with_data (GSList           *list,
1053
 
                        GCompareDataFunc  compare_func,
1054
 
                        gpointer          user_data)
 
1054
                        GCompareDataFunc  compare_func,
 
1055
                        gpointer          user_data)
1055
1056
{
1056
1057
  return g_slist_sort_real (list, (GFunc) compare_func, user_data);
1057
1058
}