Mercurial > mplayer.hg
changeset 34594:c20ac9b80ea5
Don't destroy list pointers while saving list items.
Use temporary pointers instead.
author | ib |
---|---|
date | Fri, 10 Feb 2012 15:06:59 +0000 |
parents | 83f7a2f8af3b |
children | 97bf974e7623 |
files | gui/cfg.c |
diffstat | 1 files changed, 12 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/cfg.c Fri Feb 10 14:57:29 2012 +0000 +++ b/gui/cfg.c Fri Feb 10 15:06:59 2012 +0000 @@ -391,15 +391,15 @@ file = fopen(fname, "wt+"); if (file) { - plCurrent = plList; + plItem *item = plList; - while (plCurrent) { - if (plCurrent->path && plCurrent->name) { - fprintf(file, "%s\n", plCurrent->path); - fprintf(file, "%s\n", plCurrent->name); + while (item) { + if (item->path && item->name) { + fprintf(file, "%s\n", item->path); + fprintf(file, "%s\n", item->name); } - plCurrent = plCurrent->next; + item = item->next; } fclose(file); @@ -413,11 +413,13 @@ file = fopen(fname, "wt+"); if (file) { - while (urlList) { - if (urlList->url) - fprintf(file, "%s\n", urlList->url); + urlItem *item = urlList; - urlList = urlList->next; + while (item) { + if (item->url) + fprintf(file, "%s\n", item->url); + + item = item->next; } fclose(file);