X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=idlist.c;h=d886de6b0756227fbb6954839f8ed2bd7adeef0c;hb=91644ff0b2e6eb3b26c5544a4a769ca4aaf08a14;hp=8a7a7c79cb91fb4d97df55978cf5630668d42749;hpb=bc3cb35033c8b90f2a3a03a0616ae02378d80f58;p=~andy%2Ffetchmail diff --git a/idlist.c b/idlist.c index 8a7a7c79..d886de6b 100644 --- a/idlist.c +++ b/idlist.c @@ -156,11 +156,15 @@ void str_set_mark( struct idlist **idl, const char *str, const flag val) /** Count the number of elements in the idlist \a idl. * \return number of elements */ -int count_list( struct idlist **idl) +int count_list(struct idlist **idl) { - if( !*idl ) - return 0; - return 1 + count_list( &(*idl)->next ); + int i = 0; + struct idlist *it; + + for (it = *idl ; it ; it = it->next) + ++i; + + return i; } /** return the \a number'th id string on idlist \a idl */