]> Untitled Git - emu8051.git/commitdiff
Code cleanup (tree view store init)
authorHugo Villeneuve <hugo@hugovil.com>
Fri, 18 Oct 2013 00:37:14 +0000 (20:37 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 6 Nov 2013 02:50:17 +0000 (21:50 -0500)
src/memwin.c
src/pgmwin.c
src/regwin.c

index 24d3071f1db71049f9ff3b778d05c4113325b3f2..53bb9820d4a91484ef1defa793ceb87aac4d6a85 100644 (file)
@@ -51,22 +51,20 @@ static GtkListStore *
 memwin_init_store(void)
 {
        GtkTreeIter iter;
-       int rows;
+       int row;
        int col;
        GtkListStore *store;
        GType col_types[N_COLUMNS];
 
-       for (col = 0; col < N_COLUMNS; col++) {
+       /* No need for static array, all our columns are of the same type. */
+       for (col = 0; col < N_COLUMNS; col++)
                col_types[col] = G_TYPE_STRING;
-       }
 
        store = gtk_list_store_newv(N_COLUMNS, col_types);
 
-       /* Initialize with rows of dummy data... */
-       for (rows = 0; rows < DATA_ROWS; rows++) {
-               /* Add new row. */
+       /* Add rows. */
+       for (row = 0; row < DATA_ROWS; row++)
                gtk_list_store_append(store, &iter);
-       }
 
        return store;
 }
index b139754a62e769b13d692b407bf0f756fb132891..04cff15ab41fee0b2c2f86468e4bf6a6d76dbf44 100644 (file)
@@ -64,7 +64,7 @@ static GtkListStore *
 pgmwin_init_store(void)
 {
        GtkTreeIter iter;
-       int rows;
+       int row;
        int col;
        GtkListStore *store;
        GType col_types[N_COLUMNS];
@@ -75,15 +75,15 @@ pgmwin_init_store(void)
 
        store = gtk_list_store_newv(N_COLUMNS, col_types);
 
-       /* Initialize with rows of dummy data... */
-       for (rows = 0; rows < DATA_ROWS; rows++) {
+       /* Add rows. */
+       for (row = 0; row < DATA_ROWS; row++) {
                gtk_list_store_append(store, &iter);
-               if (rows == 0) {
-                       /* Color first row in red (current instruction). */
+
+               /* Color first row in red (current instruction). */
+               if (row == 0)
                        gtk_list_store_set(store, &iter, COL_COLOR, "red", -1);
-               } else {
+               else
                        gtk_list_store_set(store, &iter, COL_COLOR, "black", -1);
-               }
        }
 
        return store;
index 4cba8160b63ea1740605de291f7de6f4c20cde3b..e3b79d715966facf2c1a76b422b4febe25185dc4 100644 (file)
@@ -282,22 +282,20 @@ static GtkListStore *
 regwin_init_store(void)
 {
        GtkTreeIter iter;
-       int rows;
+       int row;
        int col;
        GtkListStore *store;
        GType col_types[N_COLUMNS];
 
-       for (col = 0; col < N_COLUMNS; col++) {
+       /* No need for static array, all our columns are of the same type. */
+       for (col = 0; col < N_COLUMNS; col++)
                col_types[col] = G_TYPE_STRING;
-       }
 
        store = gtk_list_store_newv(N_COLUMNS, col_types);
 
-       /* Initialize with rows of dummy data... */
-       for (rows = 0; rows < DATA_ROWS; rows++) {
-               /* Add new row. */
+       /* Add rows. */
+       for (row = 0; row < DATA_ROWS; row++)
                gtk_list_store_append(store, &iter);
-       }
 
        return store;
 }