gnome-terminal r2809 - trunk/src



Author: chpe
Date: Thu May 29 19:56:17 2008
New Revision: 2809
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=2809&view=rev

Log:
Use GSlice. Bug #506962, patch by Claude Paroz.


Modified:
   trunk/src/terminal-screen.c
   trunk/src/terminal.c

Modified: trunk/src/terminal-screen.c
==============================================================================
--- trunk/src/terminal-screen.c	(original)
+++ trunk/src/terminal-screen.c	Thu May 29 19:56:17 2008
@@ -159,6 +159,12 @@
 G_DEFINE_TYPE (TerminalScreen, terminal_screen, VTE_TYPE_TERMINAL)
 
 static void
+free_tag_data (TagData *tagdata)
+{
+  g_slice_free (TagData, tagdata);
+}
+
+static void
 style_set_callback (GtkWidget *widget,
                     GtkStyle  *previous_style,
                     void      *data)
@@ -598,10 +604,10 @@
   g_strfreev (priv->override_command);
   g_free (priv->working_dir);
 
-  g_slist_foreach (priv->url_tags, (GFunc) g_free, NULL);
+  g_slist_foreach (priv->url_tags, (GFunc) free_tag_data, NULL);
   g_slist_free (priv->url_tags);
 
-  g_slist_foreach (priv->skey_tags, (GFunc) g_free, NULL);
+  g_slist_foreach (priv->skey_tags, (GFunc) free_tag_data, NULL);
   g_slist_free (priv->skey_tags);
 
   G_OBJECT_CLASS (terminal_screen_parent_class)->finalize (object);
@@ -2120,7 +2126,7 @@
   
   tag = vte_terminal_match_add (VTE_TERMINAL (screen), regexp);
 
-  tag_data = g_new0 (TagData, 1);
+  tag_data = g_slice_new (TagData);
   tag_data->tag = tag;
   tag_data->flavor = flavor;
 
@@ -2138,7 +2144,7 @@
   
   tag = vte_terminal_match_add ( VTE_TERMINAL (screen), regexp);
 
-  tag_data = g_new0 (TagData, 1);
+  tag_data = g_slice_new (TagData);
   tag_data->tag = tag;
   tag_data->flavor = flavor;
 
@@ -2155,7 +2161,7 @@
     vte_terminal_match_remove (VTE_TERMINAL (screen),
                                GPOINTER_TO_INT(((TagData*)tags->data)->tag));
 
-  g_slist_foreach (priv->skey_tags, (GFunc) g_free, NULL);
+  g_slist_foreach (priv->skey_tags, (GFunc) free_tag_data, NULL);
   g_slist_free (priv->skey_tags);
   priv->skey_tags = NULL;
 }

Modified: trunk/src/terminal.c
==============================================================================
--- trunk/src/terminal.c	(original)
+++ trunk/src/terminal.c	Thu May 29 19:56:17 2008
@@ -129,7 +129,7 @@
 {
   InitialTab *it;
 
-  it = g_new (InitialTab, 1);
+  it = g_slice_new (InitialTab);
 
   it->profile = g_strdup (profile);
   it->profile_is_id = is_id;
@@ -150,7 +150,7 @@
   g_strfreev (it->exec_argv);
   g_free (it->title);
   g_free (it->working_dir);
-  g_free (it);
+  g_slice_free (InitialTab, it);
 }
 
 static InitialWindow*
@@ -159,7 +159,7 @@
 {
   InitialWindow *iw;
   
-  iw = g_new (InitialWindow, 1);
+  iw = g_slice_new (InitialWindow);
   
   iw->tabs = g_list_prepend (NULL, initial_tab_new (profile, is_id));
   iw->force_menubar_state = FALSE;
@@ -178,7 +178,7 @@
   g_list_free (iw->tabs);
   g_free (iw->geometry);
   g_free (iw->role);
-  g_free (iw);
+  g_slice_free (InitialWindow, iw);
 }
 
 static void
@@ -1669,7 +1669,7 @@
 
       next = pending_new_terminal_events->next;
       g_strfreev (event->argv);
-      g_free (event);
+      g_slice_free (NewTerminalEvent, event);
       g_slist_free_1 (pending_new_terminal_events);
       pending_new_terminal_events = next;
     }
@@ -1706,7 +1706,7 @@
     tmp_argv[tmp_argc] = g_strdup (((const char**)args->_buffer)[tmp_argc]);
   tmp_argv[tmp_argc] = NULL;
 
-  event = g_new0 (NewTerminalEvent, 1);
+  event = g_slice_new0 (NewTerminalEvent);
   event->argc = tmp_argc;
   event->argv = tmp_argv;
 



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