gnome-terminal r3082 - trunk/src
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-terminal r3082 - trunk/src
- Date: Wed, 24 Sep 2008 20:11:20 +0000 (UTC)
Author: chpe
Date: Wed Sep 24 20:11:20 2008
New Revision: 3082
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=3082&view=rev
Log:
No need to deep-copy argv[], just make a NULL-terminated array with the
const pointers here.
Modified:
trunk/src/terminal.c
Modified: trunk/src/terminal.c
==============================================================================
--- trunk/src/terminal.c (original)
+++ trunk/src/terminal.c Wed Sep 24 20:11:20 2008
@@ -1161,7 +1161,6 @@
{
GOptionContext *context;
int i;
- int argc_copy;
char **argv_copy;
const char *startup_id;
const char *display_name;
@@ -1176,11 +1175,10 @@
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- /* Make a copy since we may need it later */
- argc_copy = argc;
- argv_copy = g_new (char *, argc_copy + 1);
- for (i = 0; i < argc_copy; ++i)
- argv_copy [i] = g_strdup (argv [i]);
+ /* Make a NULL-terminated copy since we may need it later */
+ argv_copy = g_new (char *, argc + 1);
+ for (i = 0; i < argc; ++i)
+ argv_copy [i] = argv [i];
argv_copy [i] = NULL;
parsing_results = option_parsing_results_new (NULL, NULL, NULL, &argc, argv);
@@ -1265,17 +1263,8 @@
/* Forward to the existing factory and exit */
if (request_name_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
{
- char **args;
- guint i;
int ret = EXIT_SUCCESS;
- /* Need to NULL terminate our argv */
- args = g_new (char *, argc_copy + 1);
- for (i = 0; i < argc_copy; i++) {
- args[i] = argv_copy[i];
- }
- args[argc_copy] = NULL;
-
proxy = dbus_g_proxy_new_for_name (connection,
TERMINAL_FACTORY_SERVICE_NAME,
TERMINAL_FACTORY_SERVICE_PATH,
@@ -1284,7 +1273,7 @@
g_get_current_dir (),
parsing_results->display_name,
parsing_results->startup_id,
- (const char **) args,
+ (const char **) argv_copy,
&error))
{
g_printerr ("Failed to forward request to factory: %s\n", error->message);
@@ -1292,8 +1281,7 @@
ret = EXIT_FAILURE;
}
- g_free (args);
- g_strfreev (argv_copy);
+ g_free (argv_copy);
option_parsing_results_free (parsing_results);
exit (ret);
@@ -1307,7 +1295,7 @@
/* Now we're registered as the factory. Proceed to open the terminal(s). */
factory_disabled:
- g_strfreev (argv_copy);
+ g_free (argv_copy);
gtk_window_set_default_icon_name (GNOME_TERMINAL_ICON_NAME);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]