return NULL;
}
- def = g_new(ObActionsDefinition, 1);
+ def = g_slice_new(ObActionsDefinition);
def->ref = 1;
def->name = g_strdup(name);
def->free = free;
{
if (def && --def->ref == 0) {
g_free(def->name);
- g_free(def);
+ g_slice_free(ObActionsDefinition, def);
}
}
/* 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);
act->def->free(act->options);
/* unref the definition */
actions_definition_unref(act->def);
- g_free(act);
+ g_slice_free(ObActionsAct, act);
}
}
{
DesktopData *d = data;
- g_free(d);
+ g_slice_free(DesktopData, d);
desktop_menus = g_slist_remove(desktop_menus, menu);
}
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);
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;
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;
static void focus_delay_dest(gpointer data)
{
- g_free(data);
+ g_slice_free(ObFocusDelayData, data);
}
static gboolean focus_delay_cmp(gconstpointer d1, gconstpointer d2)
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);
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;
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,
g_free(text);
} else {
ObFocusCyclePopupTarget *t =
- g_new(ObFocusCyclePopupTarget, 1);
+ g_slice_new(ObFocusCyclePopupTarget);
t->client = ft;
t->text = text;
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);
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);
}
}
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);
}
}
/* 'r' is not being added to the result list, so free it */
- g_free(r);
+ g_slice_free(Rect, r);
}
}
g_slist_free(list);
}
while (spaces) {
- g_free(spaces->data);
+ g_slice_free(Rect, spaces->data);
spaces = g_slist_delete_link(spaces, spaces);
}
}
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;
RrAppearanceFree(self->a_text);
window_remove(self->bg);
stacking_remove(self);
- g_free(self);
+ g_slice_free(ObPopup, self);
}
}
{
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,
XDestroyWindow(obt_display, self->icon);
RrAppearanceFree(self->a_icon);
popup_free(self->popup);
- g_free(self);
+ g_slice_free(ObIconPopup, self);
}
}
{
ObPagerPopup *self;
- self = g_new(ObPagerPopup, 1);
+ self = g_slice_new(ObPagerPopup);
self->popup = popup_new();
self->desks = 0;
RrAppearanceFree(self->hilight);
RrAppearanceFree(self->unhilight);
popup_free(self->popup);
- g_free(self);
+ g_slice_free(ObPagerPopup, self);
}
}
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
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();
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);
}
}
g_free(state->class);
g_free(state->role);
- g_free(state);
+ g_slice_free(ObSessionState, state);
}
}
{
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))