[gedit] Correctly reserve space in a GPtrArray for the binary pattern specs



commit ad498a8c3bdc68ca080f489549912562d354a802
Author: Garrett Regier <garrettregier gmail com>
Date:   Sun Jun 16 06:24:44 2013 -0700

    Correctly reserve space in a GPtrArray for the binary pattern specs

 plugins/filebrowser/gedit-file-browser-store.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-browser-store.c b/plugins/filebrowser/gedit-file-browser-store.c
index 0b6fc8b..8e79133 100644
--- a/plugins/filebrowser/gedit-file-browser-store.c
+++ b/plugins/filebrowser/gedit-file-browser-store.c
@@ -3416,10 +3416,11 @@ gedit_file_browser_store_set_binary_patterns (GeditFileBrowserStore  *model,
        else
        {
                gint i;
+               gssize n_patterns;
 
-               model->priv->binary_pattern_specs = g_ptr_array_new ();
-               g_ptr_array_set_size (model->priv->binary_pattern_specs,
-                                     g_strv_length ((gchar **) binary_patterns));
+               n_patterns = g_strv_length ((gchar **) binary_patterns);
+
+               model->priv->binary_pattern_specs = g_ptr_array_sized_new (n_patterns);
                g_ptr_array_set_free_func (model->priv->binary_pattern_specs,
                                           (GDestroyNotify) g_pattern_spec_free);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]