Rework code: simplify if

This commit is contained in:
Mario Hüttel 2019-03-22 22:24:48 +01:00
parent 38f18009fc
commit 188086de52

View File

@ -153,7 +153,8 @@ static void on_load_gds(gpointer button, gpointer user)
dialog_result = gtk_dialog_run(GTK_DIALOG(open_dialog)); dialog_result = gtk_dialog_run(GTK_DIALOG(open_dialog));
if (dialog_result == GTK_RESPONSE_ACCEPT) { if (dialog_result != GTK_RESPONSE_ACCEPT)
goto end_destroy;
/* Get File name */ /* Get File name */
filename = gtk_file_chooser_get_filename(file_chooser); filename = gtk_file_chooser_get_filename(file_chooser);
@ -191,7 +192,6 @@ static void on_load_gds(gpointer button, gpointer user)
/* Check this library. This might take a while */ /* Check this library. This might take a while */
(void)gds_tree_check_cell_references(gds_lib); (void)gds_tree_check_cell_references(gds_lib);
(void)gds_tree_check_reference_loops(gds_lib); (void)gds_tree_check_reference_loops(gds_lib);
/* Delete GStrings including string data. */ /* Delete GStrings including string data. */
/* Cell store copies String type data items */ /* Cell store copies String type data items */
g_string_free(mod_date, TRUE); g_string_free(mod_date, TRUE);
@ -200,7 +200,6 @@ static void on_load_gds(gpointer button, gpointer user)
for (cell = gds_lib->cells; cell != NULL; cell = cell->next) { for (cell = gds_lib->cells; cell != NULL; cell = cell->next) {
gds_c = (struct gds_cell *)cell->data; gds_c = (struct gds_cell *)cell->data;
gtk_tree_store_append(self->cell_tree_store, &celliter, &libiter); gtk_tree_store_append(self->cell_tree_store, &celliter, &libiter);
/* Convert dates to String */ /* Convert dates to String */
mod_date = generate_string_from_date(&gds_c->mod_time); mod_date = generate_string_from_date(&gds_c->mod_time);
acc_date = generate_string_from_date(&gds_c->access_time); acc_date = generate_string_from_date(&gds_c->access_time);
@ -226,12 +225,11 @@ static void on_load_gds(gpointer button, gpointer user)
/* Cell store copies String type data items */ /* Cell store copies String type data items */
g_string_free(mod_date, TRUE); g_string_free(mod_date, TRUE);
g_string_free(acc_date, TRUE); g_string_free(acc_date, TRUE);
} } /* for cells */
} } /* for libraries */
/* Create Layers in Layer Box */ /* Create Layers in Layer Box */
layer_selector_generate_layer_widgets(self->layer_selector, self->gds_libraries); layer_selector_generate_layer_widgets(self->layer_selector, self->gds_libraries);
}
end_destroy: end_destroy:
/* Destroy dialog and filter */ /* Destroy dialog and filter */