diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2005-03-06 15:27:56 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2005-03-06 15:27:56 +0000 |
commit | 20a1be81c938a2f89b95e5e4436124bd3fa6aa43 (patch) | |
tree | 15b4b250955668b501c6d4714214935e23b4f306 | |
parent | 1115f947254834df1f542c41cecb6c5e735126b8 (diff) | |
download | fetchmail-20a1be81c938a2f89b95e5e4436124bd3fa6aa43.tar.gz fetchmail-20a1be81c938a2f89b95e5e4436124bd3fa6aa43.tar.bz2 fetchmail-20a1be81c938a2f89b95e5e4436124bd3fa6aa43.zip |
Make free_str_list iterative, to reduce stack usage. Suggested by Manfred Weihs.
svn path=/trunk/; revision=4022
-rw-r--r-- | uid.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -298,13 +298,15 @@ struct idlist *save_str(struct idlist **idl, const char *str, flag st) void free_str_list(struct idlist **idl) /* free the given UID list */ { - if (*idl == (struct idlist *)NULL) - return; + struct idlist *i = *idl; - free_str_list(&(*idl)->next); - free ((*idl)->id); - free(*idl); - *idl = (struct idlist *)NULL; + while(i) { + struct idlist *t = i->next; + free(i->id); + free(i); + i = t; + } + *idl = 0; } void save_str_pair(struct idlist **idl, const char *str1, const char *str2) |