diff options
author | Søren Sandmann Pedersen <sandmann@daimi.au.dk> | 2009-04-19 17:34:41 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <sandmann@daimi.au.dk> | 2009-04-19 17:34:41 -0400 |
commit | fcbc83cf9e0a0b01ec135fe09c8688ee04dcceca (patch) | |
tree | 1f0e42d97adc62c7faeccb0328a7c21155142641 | |
parent | f94d9842d227f7a03e27bfa7bb6af2403633c2bc (diff) |
Use nul_array for err_files instead of GPtrArray
-rw-r--r-- | siv.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -377,7 +377,7 @@ static gboolean open_file (App *app, const char *startup_id, const char *filename, - GPtrArray *err_files) + char ***err_files) { SivWindow *window = NULL; GError *err = NULL; @@ -399,7 +399,7 @@ open_file (App *app, if (!window_load_file (window, filename, &err)) { if (err_files) - g_ptr_array_add (err_files, g_strdup (filename)); + *err_files = nul_array_append (*err_files, g_strdup (filename)); window_free (window); return FALSE; @@ -455,7 +455,7 @@ on_open (App *app, const char *startup_id, const char *filename) static App * app_new (int argc, char **argv) { - GPtrArray *err_files = g_ptr_array_new (); + char **err_files = nul_array_new (char *); char **filenames; App *app; int i; @@ -472,7 +472,7 @@ app_new (int argc, char **argv) if (filenames[0]) { for (i = 0; filenames[i] != NULL; ++i) - open_file (app, NULL, filenames[i], err_files); + open_file (app, NULL, filenames[i], &err_files); } else { @@ -481,10 +481,11 @@ app_new (int argc, char **argv) g_strfreev (filenames); - app_show_could_not_open (NULL, err_files->len, (char **)err_files->pdata); + app_show_could_not_open (NULL, nul_array_len (err_files), err_files); - g_ptr_array_foreach (err_files, (GFunc)g_free, NULL); - g_ptr_array_free (err_files, TRUE); + for (i = 0; err_files[i] != NULL; ++i) + g_free (err_files[i]); + nul_array_free (err_files); app_end_load (app); |