projects
/
my-code
/
api.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed list api
[my-code/api.git]
/
list
/
list.c
diff --git
a/list/list.c
b/list/list.c
index
664dd00
..
a64997f
100644
(file)
--- a/
list/list.c
+++ b/
list/list.c
@@
-28,6
+28,8
@@
int list_shutdown(t_list *list) {
int list_next(t_list *list) {
int list_next(t_list *list) {
+ if(list->current->next==NULL) return L_NO_NEXT_ELEMENT;
+
list->current=list->current->next;
return L_SUCCESS;
list->current=list->current->next;
return L_SUCCESS;
@@
-151,10
+153,8
@@
int list_count(t_list *list) {
list_reset(list);
list_reset(list);
- while(list->current!=NULL) {
- list_next(list);
- ++count;
- }
+ if(list->current!=NULL) count++;
+ if(count) while(list_next(list)!=L_NO_NEXT_ELEMENT) count++;
return count;
}
return count;
}