[Xfce4-commits] [apps/mousepad] 01/01: Optimize previous commit passing UTF-8 to DBus

noreply at xfce.org noreply at xfce.org
Sat Jun 27 05:23:49 CEST 2015


This is an automated email from the git hooks/post-receive script.

mbrush pushed a commit to branch master
in repository apps/mousepad.

commit ee7636b8c832f2a8e19c6b3c9d0405f07147b16b
Author: Matthew Brush <matt at xfce.org>
Date:   Fri Jun 26 20:22:59 2015 -0700

    Optimize previous commit passing UTF-8 to DBus
---
 mousepad/mousepad-dbus.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/mousepad/mousepad-dbus.c b/mousepad/mousepad-dbus.c
index de76ba5..46ca823 100644
--- a/mousepad/mousepad-dbus.c
+++ b/mousepad/mousepad-dbus.c
@@ -312,24 +312,23 @@ mousepad_dbus_client_launch_files (gchar       **filenames,
   g_return_val_if_fail (g_path_is_absolute (working_directory), FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-  utf8_filenames = g_ptr_array_sized_new(length + 1);
-  g_ptr_array_set_free_func(utf8_filenames, g_free);
-
+  utf8_filenames = g_ptr_array_new_with_free_func(g_free);
   if (filenames != NULL)
     {
-      gchar **fn_iter;
+      guint i;
       /* get the length of the filesname string */
       length = g_strv_length (filenames);
+      g_ptr_array_set_size(utf8_filenames, length + 1);
       /* encode locale filenames to UTF-8 for DBus */
-      for (fn_iter = filenames; *fn_iter != NULL; fn_iter++)
+      for (i = 0; i < length; i++)
         {
-          gchar *utf8_fn = g_filename_to_utf8(*fn_iter, -1, NULL, NULL, error);
+          gchar *utf8_fn = g_filename_to_utf8(filenames[i], -1, NULL, NULL, error);
           if (utf8_fn == NULL)
             {
               g_ptr_array_free(utf8_filenames, TRUE);
               return FALSE;
             }
-          g_ptr_array_add(utf8_filenames, utf8_fn);
+          utf8_filenames->pdata[i] = utf8_fn;
         }
     }
   g_ptr_array_add(utf8_filenames, NULL);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list