diff options
Diffstat (limited to 'src/slist.c')
-rw-r--r-- | src/slist.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/slist.c b/src/slist.c index 8dd1963..24da141 100644 --- a/src/slist.c +++ b/src/slist.c @@ -115,3 +115,16 @@ void slist_clear(slist_t* lst) lst->first_ = NULL; } + +int slist_length(slist_t* lst) +{ + if(!lst || !lst->first_) + return 0; + + int len = 0; + slist_element_t* tmp; + for(tmp = lst->first_; tmp; tmp = tmp->next_) + len++; + + return len; +} |