[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src llist.c,1.8,1.9
From: |
Philip S Tellis <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src llist.c,1.8,1.9 |
Date: |
Wed, 29 Jan 2003 04:11:37 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv18403/src
Modified Files:
llist.c
Log Message:
fix for l_list_insert_sorted
Index: llist.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/llist.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- llist.c 28 Jan 2003 10:35:35 -0000 1.8
+++ llist.c 29 Jan 2003 09:11:34 -0000 1.9
@@ -188,21 +188,22 @@
LList *l_list_insert_sorted(LList * list, void *data, LListCompFunc comp)
{
- LList *l, *n = malloc(sizeof(LList));
+ LList *l, *n, *prev = NULL;
if (!list)
return l_list_append(list, data);
+ n = malloc(sizeof(LList));
n->data = data;
- for (l = list; l && comp(l->data, (const void *)data) <= 0; l = l->next)
- ;
+ for (l = list; l && comp(l->data, n->data) <= 0; l = l->next)
+ prev = l;
- if (l)
+ if (l) {
n->prev = l->prev;
- else
- n->prev = NULL;
- n->next = l;
- if (l)
l->prev = n;
+ } else
+ n->prev = prev;
+
+ n->next = l;
if(n->prev) {
n->prev->next = n;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src llist.c,1.8,1.9,
Philip S Tellis <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm configure.in,1.233,1.234 ChangeLog,1.237,1.238
- Next by Date:
[Ayttm-commits] CVS: ayttm configure.in,1.234,1.235 ChangeLog,1.238,1.239
- Previous by thread:
[Ayttm-commits] CVS: ayttm configure.in,1.233,1.234 ChangeLog,1.237,1.238
- Next by thread:
[Ayttm-commits] CVS: ayttm configure.in,1.234,1.235 ChangeLog,1.238,1.239
- Index(es):