diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-11-28 17:49:55 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-11-28 17:49:55 +0000 |
commit | 09006c25d399ff2080c0e8660d0d95ff3cd25455 (patch) | |
tree | 677d91cb6afc5877ceea01e859c630ae6a99d48e | |
parent | 7f52702a7fd4711e863af33beee1f370e4eccdbf (diff) | |
download | fetchmail-09006c25d399ff2080c0e8660d0d95ff3cd25455.tar.gz fetchmail-09006c25d399ff2080c0e8660d0d95ff3cd25455.tar.bz2 fetchmail-09006c25d399ff2080c0e8660d0d95ff3cd25455.zip |
Save id pairs in the right order.
svn path=/trunk/; revision=583
-rw-r--r-- | uid.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -133,16 +133,18 @@ void free_uid_list(struct idlist **idl) void save_id_pair(struct idlist **idl, const char *str1, const char *str2) /* save an ID pair on the given list */ { - struct idlist *new; + struct idlist **end; + + /* do it nonrecursively so the list is in the right order */ + for (end = idl; *end; end = &(*end)->next) + continue; - new = (struct idlist *)xmalloc(sizeof(struct idlist)); - new->id = xstrdup(str1); + *end = (struct idlist *)xmalloc(sizeof(struct idlist)); + (*end)->id = xstrdup(str1); if (str2) - new->val.id2 = xstrdup(str2); + (*end)->val.id2 = xstrdup(str2); else - new->val.id2 = (char *)NULL; - new->next = *idl; - *idl = new; + (*end)->val.id2 = (char *)NULL; } #ifdef __UNUSED__ |