]> Pileus Git - ~andy/fetchmail/blobdiff - idlist.c
Rediff patch.
[~andy/fetchmail] / idlist.c
index 8a7a7c79cb91fb4d97df55978cf5630668d42749..a2dfe3a65984a9514b7936e34e45389414ef17be 100644 (file)
--- a/idlist.c
+++ b/idlist.c
@@ -82,21 +82,6 @@ void save_str_pair(struct idlist **idl, const char *str1, const char *str2)
     (*end)->next = (struct idlist *)NULL;
 }
 
-#ifdef __UNUSED__
-void free_str_pair_list(struct idlist **idl)
-/* free the given ID pair list */
-{
-    if (*idl == (struct idlist *)NULL)
-       return;
-
-    free_idpair_list(&(*idl)->next);
-    free ((*idl)->id);
-    free ((*idl)->val.id2);
-    free(*idl);
-    *idl = (struct idlist *)NULL;
-}
-#endif
-
 /** Check if ID \a str is in idlist \a idl. \return idlist entry if found,
  * NULL if not found. */
 struct idlist *str_in_list(struct idlist **idl, const char *str,
@@ -156,11 +141,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 */