]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
using g_slice_new() instead of g_new() part 1
[chaz/openbox] / openbox / client.c
index 2f9cfb8f564c10127c5df34716885132a6bb8510..481d7d2bd24f047d953bdd7d16d22eeee6d6bfe8 100644 (file)
@@ -150,7 +150,7 @@ static void client_call_notifies(ObClient *self, GSList *list)
 
 void client_add_destroy_notify(ObClientCallback func, gpointer data)
 {
-    ClientCallback *d = g_new(ClientCallback, 1);
+    ClientCallback *d = g_slice_new(ClientCallback);
     d->func = func;
     d->data = data;
     client_destroy_notifies = g_slist_prepend(client_destroy_notifies, d);
@@ -163,7 +163,7 @@ void client_remove_destroy_notify(ObClientCallback func)
     for (it = client_destroy_notifies; it; it = g_slist_next(it)) {
         ClientCallback *d = it->data;
         if (d->func == func) {
-            g_free(d);
+            g_slice_free(ClientCallback, d);
             client_destroy_notifies =
                 g_slist_delete_link(client_destroy_notifies, it);
             break;
@@ -221,7 +221,7 @@ void client_manage(Window window, ObPrompt *prompt)
 
     /* create the ObClient struct, and populate it from the hints on the
        window */
-    self = g_new0(ObClient, 1);
+    self = g_slice_new0(ObClient);
     self->obwin.type = OB_WINDOW_CLASS_CLIENT;
     self->window = window;
     self->prompt = prompt;
@@ -347,7 +347,7 @@ void client_manage(Window window, ObPrompt *prompt)
             place.x = r->x;
             place.y = r->y;
             ob_debug("Moving buggy app from (0,0) to (%d,%d)", r->x, r->y);
-            g_free(r);
+            g_slice_free(Rect, r);
         }
 
         /* make sure the window is visible. */
@@ -420,7 +420,7 @@ void client_manage(Window window, ObPrompt *prompt)
         place.width -= self->frame->size.left + self->frame->size.right;
         place.height -= self->frame->size.top + self->frame->size.bottom;
 
-        g_free(a);
+        g_slice_free(Rect, a);
     }
 
     ob_debug("placing window 0x%x at %d, %d with size %d x %d. "
@@ -518,7 +518,7 @@ ObClient *client_fake_manage(Window window)
 
     /* do this minimal stuff to figure out the client's decorations */
 
-    self = g_new0(ObClient, 1);
+    self = g_slice_new0(ObClient);
     self->window = window;
 
     client_get_all(self, FALSE);
@@ -695,7 +695,7 @@ void client_unmanage(ObClient *self)
     g_free(self->role);
     g_free(self->client_machine);
     g_free(self->sm_client_id);
-    g_free(self);
+    g_slice_free(ObClient, self);
 }
 
 void client_fake_unmanage(ObClient *self)
@@ -1085,7 +1085,7 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h,
         if (rudeb && !self->strut.bottom && *y + fh > a->y + a->height)
             *y = a->y + MAX(0, a->height - fh);
 
-        g_free(a);
+        g_slice_free(Rect, a);
     }
 
     /* get where the client should be */
@@ -2877,7 +2877,7 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h,
         user = FALSE; /* ignore if the client can't be moved/resized when it
                          is maximizing */
 
-        g_free(a);
+        g_slice_free(Rect, a);
     }
 
     /* gets the client's position */
@@ -4253,7 +4253,7 @@ void client_find_edge_directional(ObClient *self, ObDirection dir,
         Rect *area = screen_area(self->desktop, i, NULL);
         detect_edge(*area, dir, my_head, my_size, my_edge_start,
                     my_edge_size, dest, near_edge);
-        g_free(area);
+        g_slice_free(Rect, area);
     }
 
     /* search for edges of clients */
@@ -4284,7 +4284,7 @@ void client_find_edge_directional(ObClient *self, ObDirection dir,
                     my_edge_size, dest, near_edge);
     }
 
-    g_free(a);
+    g_slice_free(Rect, a);
 }
 
 void client_find_move_directional(ObClient *self, ObDirection dir,
This page took 0.025507 seconds and 4 git commands to generate.