[Xfce4-commits] r30147 - terminal/trunk/terminal

Nick Schermer nick at xfce.org
Thu Jul 2 22:52:55 CEST 2009


Author: nick
Date: 2009-07-02 20:52:54 +0000 (Thu, 02 Jul 2009)
New Revision: 30147

Modified:
   terminal/trunk/terminal/terminal-options.c
Log:
Move common option to the start to reduce time.

--default-display and --default-working-directory are always set
during startup, so move them to the begining to reduce the ammount
of strcmp's during startup.


Modified: terminal/trunk/terminal/terminal-options.c
===================================================================
--- terminal/trunk/terminal/terminal-options.c	2009-07-02 20:50:08 UTC (rev 30146)
+++ terminal/trunk/terminal/terminal-options.c	2009-07-02 20:52:54 UTC (rev 30147)
@@ -181,8 +181,39 @@
       if (argv[n] == NULL || *argv[n] != '-')
         goto unknown_option;
 
-      if (terminal_option_cmp ("help", 'h', argc, argv, &n, NULL))
+      if (terminal_option_cmp ("default-display", 0, argc, argv, &n, &s))
         {
+          if (G_UNLIKELY (s == NULL))
+            {
+              g_set_error (error, G_SHELL_ERROR, G_SHELL_ERROR_FAILED,
+                           _("Option \"--default-display\" requires specifying "
+                             "the default X display as its parameter"));
+              goto failed;
+            }
+          else
+            {
+              g_free (default_display);
+              default_display = g_strdup (s);
+            }
+        }
+      else if (terminal_option_cmp ("default-working-directory", 0, argc, argv, &n, &s))
+        {
+          if (G_UNLIKELY (s == NULL))
+            {
+              g_set_error (error, G_SHELL_ERROR, G_SHELL_ERROR_FAILED,
+                           _("Option \"--default-working-directory\" requires "
+                             "specifying the default working directory as its "
+                             "parameter"));
+              goto failed;
+            }
+          else
+            {
+              g_free (default_directory);
+              default_directory = g_strdup (s);
+            }
+        }
+      else if (terminal_option_cmp ("help", 'h', argc, argv, &n, NULL))
+        {
           if (options_return != NULL)
             (*options_return)->show_help = TRUE;
         }
@@ -397,37 +428,6 @@
               *attrs_return = g_slist_append (*attrs_return, win_attr);
             }
         }
-      else if (terminal_option_cmp ("default-display", 0, argc, argv, &n, &s))
-        {
-          if (G_UNLIKELY (s == NULL))
-            {
-              g_set_error (error, G_SHELL_ERROR, G_SHELL_ERROR_FAILED,
-                           _("Option \"--default-display\" requires specifying "
-                             "the default X display as its parameter"));
-              goto failed;
-            }
-          else
-            {
-              g_free (default_display);
-              default_display = g_strdup (s);
-            }
-        }
-      else if (terminal_option_cmp ("default-working-directory", 0, argc, argv, &n, &s))
-        {
-          if (G_UNLIKELY (s == NULL))
-            {
-              g_set_error (error, G_SHELL_ERROR, G_SHELL_ERROR_FAILED,
-                           _("Option \"--default-working-directory\" requires "
-                             "specifying the default working directory as its "
-                             "parameter"));
-              goto failed;
-            }
-          else
-            {
-              g_free (default_directory);
-              default_directory = g_strdup (s);
-            }
-        }
       else
         {
 unknown_option:




More information about the Xfce4-commits mailing list