[gedit/wip/gtkapp: 15/19] The copy of the arg array needs to be done in the local parsing
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/gtkapp: 15/19] The copy of the arg array needs to be done in the local parsing
- Date: Sat, 17 Nov 2012 11:45:03 +0000 (UTC)
commit 4876fde7c72ce02679f79afde2d17ca061100ad9
Author: Paolo Borelli <pborelli gnome org>
Date: Tue Jul 31 16:50:00 2012 +0200
The copy of the arg array needs to be done in the local parsing
gedit/gedit-app.c | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 3886212..53c25bc 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -576,10 +576,8 @@ gedit_app_command_line (GApplication *application,
{
GOptionContext *context;
GError *error = NULL;
- gchar **args;
- gchar **argv;
gint argc;
- gint i;
+ gchar **argv;
/* reset values */
g_free (encoding_charset);
@@ -599,16 +597,7 @@ gedit_app_command_line (GApplication *application,
remaining_args = NULL;
encoding = NULL;
- args = g_application_command_line_get_arguments (command_line, &argc);
-
- /* We have to make an extra copy of the array, since g_option_context_parse()
- * assumes that it can remove strings from the array without freeing them.
- */
- argv = g_new (gchar*, argc + 1);
- for (i = 0; i <= argc; i++)
- {
- argv[i] = args[i];
- }
+ argv = g_application_command_line_get_arguments (command_line, &argc);
/* Setup command line options */
context = g_option_context_new (_("- Edit text files"));
@@ -661,12 +650,20 @@ gedit_app_local_command_line (GApplication *application,
{
GOptionContext *context;
GError *error = NULL;
- gchar **argv;
gint argc;
+ gchar **argv;
+ gint i;
- argv = *arguments;
+ /* We have to make an extra copy of the array, since g_option_context_parse()
+ * assumes that it can remove strings from the array without freeing them.
+ */
argc = g_strv_length (*arguments);
- g_message ("local command line");
+ argv = g_new (gchar*, argc + 1);
+ for (i = 0; i <= argc; i++)
+ {
+ argv[i] = (*arguments)[i];
+ }
+
*exit_status = 0;
/* Setup command line options */
@@ -726,6 +723,7 @@ gedit_app_local_command_line (GApplication *application,
g_free (encoding_charset);
g_strfreev (remaining_args);
g_free (geometry);
+ g_free (argv);
help = FALSE;
version = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]