]> Dogcows Code - chaz/openbox/commitdiff
use g_slice_new() instead of g_new() part 2
authorDana Jansens <danakj@orodu.net>
Fri, 12 Feb 2010 18:55:26 +0000 (13:55 -0500)
committerDana Jansens <danakj@orodu.net>
Fri, 12 Feb 2010 18:55:26 +0000 (13:55 -0500)
openbox/actions.c
openbox/client_list_menu.c
openbox/event.c
openbox/focus_cycle_popup.c
openbox/group.c
openbox/place.c
openbox/popup.c
openbox/session.c

index 945233e63fae1f71ba5f826e539012dd298354cd..2324bc95ad846963521458fa8a610e44a7f17308 100644 (file)
@@ -102,7 +102,7 @@ ObActionsDefinition* do_register(const gchar *name,
             return NULL;
     }
 
-    def = g_new(ObActionsDefinition, 1);
+    def = g_slice_new(ObActionsDefinition);
     def->ref = 1;
     def->name = g_strdup(name);
     def->free = free;
@@ -164,7 +164,7 @@ static void actions_definition_unref(ObActionsDefinition *def)
 {
     if (def && --def->ref == 0) {
         g_free(def->name);
-        g_free(def);
+        g_slice_free(ObActionsDefinition, def);
     }
 }
 
@@ -184,7 +184,7 @@ static ObActionsAct* actions_build_act_from_string(const gchar *name)
 
     /* if we found the action */
     if (def) {
-        act = g_new(ObActionsAct, 1);
+        act = g_slice_new(ObActionsAct);
         act->ref = 1;
         act->def = def;
         actions_definition_ref(act->def);
@@ -268,7 +268,7 @@ void actions_act_unref(ObActionsAct *act)
             act->def->free(act->options);
         /* unref the definition */
         actions_definition_unref(act->def);
-        g_free(act);
+        g_slice_free(ObActionsAct, act);
     }
 }
 
index 2d62c3e9ff05707b6fcac292f4c3b187584b149b..263b3398514cb70c07686d457f494cb7e6ca418e 100644 (file)
@@ -116,7 +116,7 @@ static void desk_menu_destroy(ObMenu *menu, gpointer data)
 {
     DesktopData *d = data;
 
-    g_free(d);
+    g_slice_free(DesktopData, d);
 
     desktop_menus = g_slist_remove(desktop_menus, menu);
 }
@@ -136,7 +136,7 @@ static gboolean self_update(ObMenuFrame *frame, gpointer data)
     for (i = 0; i < screen_num_desktops; ++i) {
         ObMenu *submenu;
         gchar *name = g_strdup_printf("%s-%u", MENU_NAME, i);
-        DesktopData *ddata = g_new(DesktopData, 1);
+        DesktopData *ddata = g_slice_new(DesktopData);
 
         ddata->desktop = i;
         submenu = menu_new(name, screen_desktop_names[i], FALSE, ddata);
index 44a90f9bbd3267493af3339cc76d75d51c5a5efc..f466234bc2e25b235214ed8c63f14cc13c7472c3 100644 (file)
@@ -811,7 +811,7 @@ void event_enter_client(ObClient *client)
 
             obt_main_loop_timeout_remove(ob_main_loop, focus_delay_func);
 
-            data = g_new(ObFocusDelayData, 1);
+            data = g_slice_new(ObFocusDelayData);
             data->client = client;
             data->time = event_curtime;
             data->serial = event_curserial;
@@ -846,7 +846,7 @@ void event_leave_client(ObClient *client)
 
             obt_main_loop_timeout_remove(ob_main_loop, unfocus_delay_func);
 
-            data = g_new(ObFocusDelayData, 1);
+            data = g_slice_new(ObFocusDelayData);
             data->client = client;
             data->time = event_curtime;
             data->serial = event_curserial;
@@ -1997,7 +1997,7 @@ static gboolean event_handle_user_input(ObClient *client, XEvent *e)
 
 static void focus_delay_dest(gpointer data)
 {
-    g_free(data);
+    g_slice_free(ObFocusDelayData, data);
 }
 
 static gboolean focus_delay_cmp(gconstpointer d1, gconstpointer d2)
@@ -2059,7 +2059,7 @@ static void event_ignore_enter_range(gulong start, gulong end)
     g_assert(start != 0);
     g_assert(end != 0);
 
-    r = g_new(ObSerialRange, 1);
+    r = g_slice_new(ObSerialRange);
     r->start = start;
     r->end = end;
     ignore_serials = g_slist_prepend(ignore_serials, r);
@@ -2094,7 +2094,7 @@ static gboolean is_enter_focus_event_ignored(gulong serial)
         if ((glong)(serial - r->end) > 0) {
             /* past the end */
             ignore_serials = g_slist_delete_link(ignore_serials, it);
-            g_free(r);
+            g_slice_free(ObSerialRange, r);
         }
         else if ((glong)(serial - r->start) >= 0)
             return TRUE;
index 08016fe37195c8db9e96592592e2b29b910db036..00f5f7a14d215ce7202140284c1ab5bc30c47949 100644 (file)
@@ -246,7 +246,7 @@ static void popup_target_free(ObFocusCyclePopupTarget *t)
     g_free(t->text);
     XDestroyWindow(obt_display, t->iconwin);
     XDestroyWindow(obt_display, t->textwin);
-    g_free(t);
+    g_slice_free(ObFocusCyclePopupTarget, t);
 }
 
 static gboolean popup_setup(ObFocusCyclePopup *p, gboolean create_targets,
@@ -313,7 +313,7 @@ static gboolean popup_setup(ObFocusCyclePopup *p, gboolean create_targets,
                     g_free(text);
                 } else {
                     ObFocusCyclePopupTarget *t =
-                        g_new(ObFocusCyclePopupTarget, 1);
+                        g_slice_new(ObFocusCyclePopupTarget);
 
                     t->client = ft;
                     t->text = text;
index c0ba6ed71432075bbd3077a691102cb9e8d19ef4..0712bf48d2e64eaf4ef0283b1e4cd2a6849f3de8 100644 (file)
@@ -45,7 +45,7 @@ ObGroup *group_add(Window leader, ObClient *client)
 
     self = g_hash_table_lookup(group_map, &leader);
     if (self == NULL) {
-        self = g_new(ObGroup, 1);
+        self = g_slice_new(ObGroup);
         self->leader = leader;
         self->members = NULL;
         g_hash_table_insert(group_map, &self->leader, self);
@@ -61,6 +61,6 @@ void group_remove(ObGroup *self, ObClient *client)
     self->members = g_slist_remove(self->members, client);
     if (self->members == NULL) {
         g_hash_table_remove(group_map, &self->leader);
-        g_free(self);
+        g_slice_free(ObGroup, self);
     }
 }
index cf4d304814f4405c0a662dff65b8cf90df3e12f5..8292d6a24536f76ae6f87dd08b689f65540c70ca 100644 (file)
@@ -158,7 +158,7 @@ static gboolean place_random(ObClient *client, gint *x, gint *y)
 
 static GSList* area_add(GSList *list, Rect *a)
 {
-    Rect *r = g_new(Rect, 1);
+    Rect *r = g_slice_new(Rect);
     *r = *a;
     return g_slist_prepend(list, r);
 }
@@ -210,7 +210,7 @@ static GSList* area_remove(GSList *list, Rect *a)
             }
 
             /* 'r' is not being added to the result list, so free it */
-            g_free(r);
+            g_slice_free(Rect, r);
         }
     }
     g_slist_free(list);
@@ -332,7 +332,7 @@ static gboolean place_nooverlap(ObClient *c, gint *x, gint *y)
             }
 
             while (spaces) {
-                g_free(spaces->data);
+                g_slice_free(Rect, spaces->data);
                 spaces = g_slist_delete_link(spaces, spaces);
             }
         }
index 90ec32deb959d1183cb1d0aaa08c1542bc82ec12..c7a01154137158a218f08b345f60650680368f07 100644 (file)
@@ -31,7 +31,7 @@
 ObPopup *popup_new(void)
 {
     XSetWindowAttributes attrib;
-    ObPopup *self = g_new0(ObPopup, 1);
+    ObPopup *self = g_slice_new0(ObPopup);
 
     self->obwin.type = OB_WINDOW_CLASS_INTERNAL;
     self->gravity = NorthWestGravity;
@@ -72,7 +72,7 @@ void popup_free(ObPopup *self)
         RrAppearanceFree(self->a_text);
         window_remove(self->bg);
         stacking_remove(self);
-        g_free(self);
+        g_slice_free(ObPopup, self);
     }
 }
 
@@ -342,7 +342,7 @@ ObIconPopup *icon_popup_new(void)
 {
     ObIconPopup *self;
 
-    self = g_new0(ObIconPopup, 1);
+    self = g_slice_new0(ObIconPopup);
     self->popup = popup_new();
     self->a_icon = RrAppearanceCopy(ob_rr_theme->a_clear_tex);
     self->icon = XCreateWindow(obt_display, self->popup->bg,
@@ -364,7 +364,7 @@ void icon_popup_free(ObIconPopup *self)
         XDestroyWindow(obt_display, self->icon);
         RrAppearanceFree(self->a_icon);
         popup_free(self->popup);
-        g_free(self);
+        g_slice_free(ObIconPopup, self);
     }
 }
 
@@ -501,7 +501,7 @@ ObPagerPopup *pager_popup_new(void)
 {
     ObPagerPopup *self;
 
-    self = g_new(ObPagerPopup, 1);
+    self = g_slice_new(ObPagerPopup);
     self->popup = popup_new();
 
     self->desks = 0;
@@ -527,7 +527,7 @@ void pager_popup_free(ObPagerPopup *self)
         RrAppearanceFree(self->hilight);
         RrAppearanceFree(self->unhilight);
         popup_free(self->popup);
-        g_free(self);
+        g_slice_free(ObPagerPopup, self);
     }
 }
 
index ba51ed327e1bc6b7eccb0edac0ab3581c5c09811..d6c6f76704f3c73923ba00b354821627b92041d0 100644 (file)
@@ -376,7 +376,7 @@ static void session_setup_restart_command(void)
 
 static ObSMSaveData *sm_save_get_data(void)
 {
-    ObSMSaveData *savedata = g_new0(ObSMSaveData, 1);
+    ObSMSaveData *savedata = g_slice_new0(ObSMSaveData);
     /* save the active desktop and client.
        we don't bother to preemptively save the other desktop state like
        number and names of desktops, cuz those shouldn't be changing during
@@ -398,7 +398,7 @@ static void sm_save_yourself_2(SmcConn conn, SmPointer data)
     if (savedata == NULL)
         savedata = sm_save_get_data();
     success = session_save_to_file(savedata);
-    g_free(savedata);
+    g_slice_free(ObSMSaveData, savedata);
 
     /* tell the session manager how to restore this state */
     if (success) session_setup_restart_command();
@@ -443,7 +443,7 @@ static void sm_save_yourself(SmcConn conn, SmPointer data, gint save_type,
 
     if (!SmcRequestSaveYourselfPhase2(conn, sm_save_yourself_2, savedata)) {
         ob_debug_type(OB_DEBUG_SM, "Requst for phase 2 failed");
-        g_free(savedata);
+        g_slice_free(ObSMSaveData, savedata);
         SmcSaveYourselfDone(conn, FALSE);
     }
 }
@@ -630,7 +630,7 @@ static void session_state_free(ObSessionState *state)
         g_free(state->class);
         g_free(state->role);
 
-        g_free(state);
+        g_slice_free(ObSessionState, state);
     }
 }
 
@@ -731,7 +731,7 @@ static void session_load_file(const gchar *path)
     {
         ObSessionState *state;
 
-        state = g_new0(ObSessionState, 1);
+        state = g_slice_new0(ObSessionState);
 
         if (!obt_xml_attr_string(node, "id", &state->id))
             if (!obt_xml_attr_string(node, "command", &state->command))
This page took 0.037018 seconds and 4 git commands to generate.