From: Hugo Villeneuve Date: Fri, 18 Oct 2013 00:37:14 +0000 (-0400) Subject: Code cleanup (tree view store init) X-Git-Tag: v2.0.0~124 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=b3a099e3ee32ce6b93358a9d7b637ad20fdb08c2;p=emu8051.git Code cleanup (tree view store init) --- diff --git a/src/memwin.c b/src/memwin.c index 24d3071..53bb982 100644 --- a/src/memwin.c +++ b/src/memwin.c @@ -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; } diff --git a/src/pgmwin.c b/src/pgmwin.c index b139754..04cff15 100644 --- a/src/pgmwin.c +++ b/src/pgmwin.c @@ -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; diff --git a/src/regwin.c b/src/regwin.c index 4cba816..e3b79d7 100644 --- a/src/regwin.c +++ b/src/regwin.c @@ -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; }