Changeset 03886fc


Ignore:
Timestamp:
2013-02-21T18:37:06Z (11 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
f3fce53
Parents:
a5c6ebd
Message:

Keep settings lists sorted. It's already sorted somewhat, but in unclearly
divided fragments. The lists are getting long enough in places that having
sections would help. That's more work, just sorting is a good start.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • set.c

    ra5c6ebd r03886fc  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2005 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2013 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    2323  Suite 330, Boston, MA  02111-1307  USA
    2424*/
     25
    2526#define BITLBEE_CORE
    2627#include "bitlbee.h"
     
    3940                if( ( s = *head ) )
    4041                {
    41                         while( s->next ) s = s->next;
    42                         s->next = g_new0( set_t, 1 );
    43                         s = s->next;
     42                        /* Sorted insertion. Special-case insertion at the start. */
     43                        if( strcmp( key, s->key ) < 0 )
     44                        {
     45                                s = g_new0( set_t, 1 );
     46                                s->next = *head;
     47                                *head = s;
     48                        }
     49                        else
     50                        {
     51                                while( s->next && strcmp( key, s->next->key ) > 0 )
     52                                        s = s->next;
     53                                set_t *last_next = s->next;
     54                                s->next = g_new0( set_t, 1 );
     55                                s = s->next;
     56                                s->next = last_next;
     57                        }
    4458                }
    4559                else
Note: See TracChangeset for help on using the changeset viewer.