aboutsummaryrefslogtreecommitdiffstats
path: root/uid.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2005-03-06 15:27:56 +0000
committerMatthias Andree <matthias.andree@gmx.de>2005-03-06 15:27:56 +0000
commit20a1be81c938a2f89b95e5e4436124bd3fa6aa43 (patch)
tree15b4b250955668b501c6d4714214935e23b4f306 /uid.c
parent1115f947254834df1f542c41cecb6c5e735126b8 (diff)
downloadfetchmail-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
Diffstat (limited to 'uid.c')
-rw-r--r--uid.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/uid.c b/uid.c
index 01a33137..fbb314e3 100644
--- a/uid.c
+++ b/uid.c
@@ -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)