Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore


Modified Files:
        ecore_list.c 


Log Message:
- make the ecore_list 0 based instead of 1 based

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/ecore_list.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ecore_list.c        2 Nov 2004 16:11:36 -0000       1.11
+++ ecore_list.c        23 Nov 2004 02:32:04 -0000      1.12
@@ -367,7 +367,7 @@
 
        if (list->first == NULL) {
                list->first = end;
-               list->index = 1;
+               list->index = 0;
        }
 
        list->nodes++;
@@ -592,7 +592,7 @@
        if (list->current == old)
                list->current = list->first;
        else
-               list->index--;
+               (list->index ? list->index-- : 0);
 
        if (list->last == old)
                list->last = list->first;
@@ -707,7 +707,10 @@
 
        _ecore_list_goto_first(list);
 
-       for (i = 1; i < index && _ecore_list_next(list); i++);
+       for (i = 0; i < index && _ecore_list_next(list); i++);
+
+       if (i >= list->nodes)
+               return FALSE;
 
        list->index = i;
 
@@ -741,7 +744,7 @@
        if (!list)
                return NULL;
 
-       index = 1;
+       index = 0;
 
        node = list->first;
        while (node && node->data) {
@@ -790,7 +793,7 @@
                return NULL;
 
        list->current = list->first;
-       list->index = 1;
+       list->index = 0;
 
        return list->current->data;
 }
@@ -819,7 +822,7 @@
                return NULL;
 
        list->current = list->last;
-       list->index = list->nodes;
+       list->index = (list->nodes - 1);
 
        return list->current->data;
 }




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to