[MPlayer-cvslog] r34709 - trunk/gui/cfg.c

ib subversion at mplayerhq.hu
Mon Feb 13 11:22:02 CET 2012


Author: ib
Date: Mon Feb 13 11:22:02 2012
New Revision: 34709

Log:
Replace for loop with index by while loop with pointer.

Modified:
   trunk/gui/cfg.c

Modified: trunk/gui/cfg.c
==============================================================================
--- trunk/gui/cfg.c	Mon Feb 13 10:09:02 2012	(r34708)
+++ trunk/gui/cfg.c	Mon Feb 13 11:22:02 2012	(r34709)
@@ -353,7 +353,6 @@ void cfg_write(void)
 {
     char *fname;
     FILE *file;
-    unsigned int i;
 
     // configuration
 
@@ -361,11 +360,13 @@ void cfg_write(void)
     file  = fopen(fname, "wt+");
 
     if (file) {
-        for (i = 0; gui_opts[i].name; i++) {
-            char *val = m_option_print(&gui_opts[i], gui_opts[i].p);
+        const m_option_t *opts = gui_opts;
+
+        while (opts->name) {
+            char *val = m_option_print(opts, opts->p);
 
             if (val == (char *)-1) {
-                gmp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_UnableToSaveOption, gui_opts[i].name);
+                gmp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_UnableToSaveOption, opts->name);
                 val = NULL;
             }
 
@@ -375,9 +376,11 @@ void cfg_write(void)
                 if (!strchr(val, ' '))
                     *delim = 0;
 
-                fprintf(file, "%s=%s%s%s\n", gui_opts[i].name, delim, val, delim);
+                fprintf(file, "%s=%s%s%s\n", opts->name, delim, val, delim);
                 free(val);
             }
+
+            opts++;
         }
 
         fclose(file);
@@ -433,6 +436,8 @@ void cfg_write(void)
     file  = fopen(fname, "wt+");
 
     if (file) {
+        unsigned int i;
+
         for (i = 0; i < FF_ARRAY_ELEMS(fsHistory); i++)
             if (fsHistory[i])
                 fprintf(file, "%s\n", fsHistory[i]);


More information about the MPlayer-cvslog mailing list