summaryrefslogtreecommitdiff
path: root/openbox/actions
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2010-02-16 16:26:18 -0500
committerDana Jansens <danakj@orodu.net>2010-02-16 16:32:38 -0500
commitd179d6428ae585a3b8a13479bfe4586e41de2ff9 (patch)
tree322cb58fea023dc635432cef8f06307008c8f4c8 /openbox/actions
parentd45af3cb45f35ba639efac15675ed10b3515a7f0 (diff)
more using g_slice_new() instead of g_new()
Diffstat (limited to 'openbox/actions')
-rw-r--r--openbox/actions/addremovedesktop.c21
-rw-r--r--openbox/actions/cyclewindows.c4
-rw-r--r--openbox/actions/debug.c4
-rw-r--r--openbox/actions/desktop.c66
-rw-r--r--openbox/actions/directionalwindows.c4
-rw-r--r--openbox/actions/exit.c13
-rw-r--r--openbox/actions/focus.c10
-rw-r--r--openbox/actions/growtoedge.c28
-rw-r--r--openbox/actions/if.c4
-rw-r--r--openbox/actions/layer.c30
-rw-r--r--openbox/actions/maximize.c38
-rw-r--r--openbox/actions/moverelative.c10
-rw-r--r--openbox/actions/moveresizeto.c14
-rw-r--r--openbox/actions/movetoedge.c26
-rw-r--r--openbox/actions/resize.c10
-rw-r--r--openbox/actions/resizerelative.c10
-rw-r--r--openbox/actions/restart.c4
-rw-r--r--openbox/actions/showmenu.c4
18 files changed, 188 insertions, 112 deletions
diff --git a/openbox/actions/addremovedesktop.c b/openbox/actions/addremovedesktop.c
index e21e9e66..ff6767e2 100644
--- a/openbox/actions/addremovedesktop.c
+++ b/openbox/actions/addremovedesktop.c
@@ -10,6 +10,7 @@ typedef struct {
static gpointer setup_func(xmlNodePtr node);
static gpointer setup_add_func(xmlNodePtr node);
static gpointer setup_remove_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
/* 3.4-compatibility */
static gpointer setup_addcurrent_func(xmlNodePtr node);
@@ -19,17 +20,18 @@ static gpointer setup_removelast_func(xmlNodePtr node);
void action_addremovedesktop_startup(void)
{
- actions_register("AddDesktop", setup_add_func, g_free, run_func);
- actions_register("RemoveDesktop", setup_remove_func, g_free, run_func);
+ actions_register("AddDesktop", setup_add_func, free_func, run_func);
+ actions_register("RemoveDesktop", setup_remove_func, free_func, run_func);
/* 3.4-compatibility */
- actions_register("AddDesktopLast", setup_addlast_func, g_free, run_func);
+ actions_register("AddDesktopLast", setup_addlast_func,
+ free_func, run_func);
actions_register("RemoveDesktopLast", setup_removelast_func,
- g_free, run_func);
+ free_func, run_func);
actions_register("AddDesktopCurrent", setup_addcurrent_func,
- g_free, run_func);
+ free_func, run_func);
actions_register("RemoveDesktopCurrent", setup_removecurrent_func,
- g_free, run_func);
+ free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node)
@@ -37,7 +39,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
if ((n = obt_xml_find_node(node, "where"))) {
gchar *s = obt_xml_node_string(n);
@@ -65,6 +67,11 @@ static gpointer setup_remove_func(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
diff --git a/openbox/actions/cyclewindows.c b/openbox/actions/cyclewindows.c
index 52349091..a038f31a 100644
--- a/openbox/actions/cyclewindows.c
+++ b/openbox/actions/cyclewindows.c
@@ -65,7 +65,7 @@ static gpointer setup_func(xmlNodePtr node,
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
o->bar = TRUE;
o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_LIST;
@@ -144,7 +144,7 @@ static void free_func(gpointer options)
o->actions = g_slist_delete_link(o->actions, o->actions);
}
- g_free(o);
+ g_slice_free(Options, o);
}
static gboolean run_func(ObActionsData *data, gpointer options)
diff --git a/openbox/actions/debug.c b/openbox/actions/debug.c
index 9ba7b1b0..99446bc4 100644
--- a/openbox/actions/debug.c
+++ b/openbox/actions/debug.c
@@ -19,7 +19,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
if ((n = obt_xml_find_node(node, "string")))
o->str = obt_xml_node_string(n);
@@ -30,7 +30,7 @@ static void free_func(gpointer options)
{
Options *o = options;
g_free(o->str);
- g_free(o);
+ g_slice_free(Options, o);
}
/* Always return FALSE because its not interactive */
diff --git a/openbox/actions/desktop.c b/openbox/actions/desktop.c
index 6c30d56d..10b31acd 100644
--- a/openbox/actions/desktop.c
+++ b/openbox/actions/desktop.c
@@ -38,6 +38,7 @@ static gpointer setup_send_func(xmlNodePtr node,
ObActionsIInputFunc *input,
ObActionsICancelFunc *cancel,
ObActionsIPostFunc *post);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
static gboolean i_pre_func(guint state, gpointer options);
@@ -113,36 +114,38 @@ static gpointer setup_send_down_func(xmlNodePtr node,
ObActionsIInputFunc *input,
ObActionsICancelFunc *cancel,
ObActionsIPostFunc *post);
-
+
void action_desktop_startup(void)
{
- actions_register_i("GoToDesktop", setup_go_func, g_free, run_func);
- actions_register_i("SendToDesktop", setup_send_func, g_free, run_func);
+ actions_register_i("GoToDesktop", setup_go_func, free_func, run_func);
+ actions_register_i("SendToDesktop", setup_send_func, free_func, run_func);
/* 3.4-compatibility */
- actions_register("DesktopLast", setup_go_last_func, g_free, run_func);
+ actions_register("DesktopLast", setup_go_last_func, free_func, run_func);
actions_register("SendToDesktopLast", setup_send_last_func,
- g_free, run_func);
- actions_register("Desktop", setup_go_abs_func, g_free, run_func);
- actions_register("SendToDesktop", setup_send_abs_func, g_free, run_func);
- actions_register_i("DesktopNext", setup_go_next_func, g_free, run_func);
+ free_func, run_func);
+ actions_register("Desktop", setup_go_abs_func, free_func, run_func);
+ actions_register("SendToDesktop", setup_send_abs_func,
+ free_func, run_func);
+ actions_register_i("DesktopNext", setup_go_next_func, free_func, run_func);
actions_register_i("SendToDesktopNext", setup_send_next_func,
- g_free, run_func);
+ free_func, run_func);
actions_register_i("DesktopPrevious", setup_go_prev_func,
- g_free, run_func);
+ free_func, run_func);
actions_register_i("SendToDesktopPrevious", setup_send_prev_func,
- g_free, run_func);
- actions_register_i("DesktopLeft", setup_go_left_func, g_free, run_func);
+ free_func, run_func);
+ actions_register_i("DesktopLeft", setup_go_left_func, free_func, run_func);
actions_register_i("SendToDesktopLeft", setup_send_left_func,
- g_free, run_func);
- actions_register_i("DesktopRight", setup_go_right_func, g_free, run_func);
+ free_func, run_func);
+ actions_register_i("DesktopRight", setup_go_right_func,
+ free_func, run_func);
actions_register_i("SendToDesktopRight", setup_send_right_func,
- g_free, run_func);
- actions_register_i("DesktopUp", setup_go_up_func, g_free, run_func);
+ free_func, run_func);
+ actions_register_i("DesktopUp", setup_go_up_func, free_func, run_func);
actions_register_i("SendToDesktopUp", setup_send_up_func,
- g_free, run_func);
- actions_register_i("DesktopDown", setup_go_down_func, g_free, run_func);
+ free_func, run_func);
+ actions_register_i("DesktopDown", setup_go_down_func, free_func, run_func);
actions_register_i("SendToDesktopDown", setup_send_down_func,
- g_free, run_func);
+ free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node,
@@ -154,7 +157,7 @@ static gpointer setup_func(xmlNodePtr node,
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
/* don't go anywhere if there are no options given */
o->type = ABSOLUTE;
o->u.abs.desktop = screen_desktop;
@@ -254,6 +257,11 @@ static gpointer setup_send_func(xmlNodePtr node,
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
@@ -353,7 +361,7 @@ static void i_post_func(gpointer options)
static gpointer setup_follow(xmlNodePtr node)
{
xmlNodePtr n;
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->send = TRUE;
o->follow = TRUE;
if ((n = obt_xml_find_node(node, "follow")))
@@ -363,7 +371,7 @@ static gpointer setup_follow(xmlNodePtr node)
static gpointer setup_go_last_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->type = LAST;
return o;
}
@@ -378,7 +386,7 @@ static gpointer setup_send_last_func(xmlNodePtr node)
static gpointer setup_go_abs_func(xmlNodePtr node)
{
xmlNodePtr n;
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->type = ABSOLUTE;
if ((n = obt_xml_find_node(node, "desktop")))
o->u.abs.desktop = obt_xml_node_int(n) - 1;
@@ -429,7 +437,7 @@ static gpointer setup_go_next_func(xmlNodePtr node,
ObActionsICancelFunc *cancel,
ObActionsIPostFunc *post)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
setup_rel(o, node, TRUE, OB_DIRECTION_EAST, pre, input, post);
return o;
}
@@ -452,7 +460,7 @@ static gpointer setup_go_prev_func(xmlNodePtr node,
ObActionsICancelFunc *cancel,
ObActionsIPostFunc *post)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
setup_rel(o, node, TRUE, OB_DIRECTION_WEST, pre, input, post);
return o;
}
@@ -475,7 +483,7 @@ static gpointer setup_go_left_func(xmlNodePtr node,
ObActionsICancelFunc *cancel,
ObActionsIPostFunc *post)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
setup_rel(o, node, FALSE, OB_DIRECTION_WEST, pre, input, post);
return o;
}
@@ -498,7 +506,7 @@ static gpointer setup_go_right_func(xmlNodePtr node,
ObActionsICancelFunc *cancel,
ObActionsIPostFunc *post)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
setup_rel(o, node, FALSE, OB_DIRECTION_EAST, pre, input, post);
return o;
}
@@ -521,7 +529,7 @@ static gpointer setup_go_up_func(xmlNodePtr node,
ObActionsICancelFunc *cancel,
ObActionsIPostFunc *post)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
setup_rel(o, node, FALSE, OB_DIRECTION_NORTH, pre, input, post);
return o;
}
@@ -544,7 +552,7 @@ static gpointer setup_go_down_func(xmlNodePtr node,
ObActionsICancelFunc *cancel,
ObActionsIPostFunc *post)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
setup_rel(o, node, FALSE, OB_DIRECTION_SOUTH, pre, input, post);
return o;
}
diff --git a/openbox/actions/directionalwindows.c b/openbox/actions/directionalwindows.c
index 7ede3333..f8393d2d 100644
--- a/openbox/actions/directionalwindows.c
+++ b/openbox/actions/directionalwindows.c
@@ -135,7 +135,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
o->dialog = TRUE;
o->bar = TRUE;
@@ -225,7 +225,7 @@ static void free_func(gpointer options)
o->actions = g_slist_delete_link(o->actions, o->actions);
}
- g_free(o);
+ g_slice_free(Options, o);
}
static gboolean run_func(ObActionsData *data, gpointer options)
diff --git a/openbox/actions/exit.c b/openbox/actions/exit.c
index f2b0cafb..2d9fc633 100644
--- a/openbox/actions/exit.c
+++ b/openbox/actions/exit.c
@@ -9,12 +9,13 @@ typedef struct {
} Options;
static gpointer setup_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
void action_exit_startup(void)
{
- actions_register("Exit", setup_func, NULL, run_func);
- actions_register("SessionLogout", setup_func, NULL, run_func);
+ actions_register("Exit", setup_func, free_func, run_func);
+ actions_register("SessionLogout", setup_func, free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node)
@@ -22,7 +23,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
o->prompt = TRUE;
if ((n = obt_xml_find_node(node, "prompt")))
@@ -31,6 +32,11 @@ static gpointer setup_func(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
static void do_exit(void)
{
if (session_connected())
@@ -51,6 +57,7 @@ static void prompt_cleanup(ObPrompt *p, gpointer data)
prompt_unref(p);
}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
diff --git a/openbox/actions/focus.c b/openbox/actions/focus.c
index 8bae49c7..6c8957c8 100644
--- a/openbox/actions/focus.c
+++ b/openbox/actions/focus.c
@@ -10,11 +10,12 @@ typedef struct {
} Options;
static gpointer setup_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
void action_focus_startup(void)
{
- actions_register("Focus", setup_func, g_free, run_func);
+ actions_register("Focus", setup_func, free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node)
@@ -22,7 +23,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
o->stop_int = TRUE;
if ((n = obt_xml_find_node(node, "here")))
@@ -32,6 +33,11 @@ static gpointer setup_func(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
diff --git a/openbox/actions/growtoedge.c b/openbox/actions/growtoedge.c
index 9589d3f6..d5a7bfdd 100644
--- a/openbox/actions/growtoedge.c
+++ b/openbox/actions/growtoedge.c
@@ -12,6 +12,7 @@ typedef struct {
static gpointer setup_func(xmlNodePtr node);
static gpointer setup_shrink_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
/* 3.4-compatibility */
static gpointer setup_north_func(xmlNodePtr node);
@@ -22,14 +23,14 @@ static gpointer setup_west_func(xmlNodePtr node);
void action_growtoedge_startup(void)
{
actions_register("GrowToEdge", setup_func,
- g_free, run_func);
+ free_func, run_func);
actions_register("ShrinkToEdge", setup_shrink_func,
- g_free, run_func);
+ free_func, run_func);
/* 3.4-compatibility */
- actions_register("GrowToEdgeNorth", setup_north_func, g_free, run_func);
- actions_register("GrowToEdgeSouth", setup_south_func, g_free, run_func);
- actions_register("GrowToEdgeEast", setup_east_func, g_free, run_func);
- actions_register("GrowToEdgeWest", setup_west_func, g_free, run_func);
+ actions_register("GrowToEdgeNorth", setup_north_func, free_func, run_func);
+ actions_register("GrowToEdgeSouth", setup_south_func, free_func, run_func);
+ actions_register("GrowToEdgeEast", setup_east_func, free_func, run_func);
+ actions_register("GrowToEdgeWest", setup_west_func, free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node)
@@ -37,7 +38,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
o->dir = OB_DIRECTION_NORTH;
o->shrink = FALSE;
@@ -96,6 +97,11 @@ static gboolean do_grow(ObActionsData *data, gint x, gint y, gint w, gint h)
return FALSE;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
@@ -163,7 +169,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
/* 3.4-compatibility */
static gpointer setup_north_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->shrink = FALSE;
o->dir = OB_DIRECTION_NORTH;
return o;
@@ -171,7 +177,7 @@ static gpointer setup_north_func(xmlNodePtr node)
static gpointer setup_south_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->shrink = FALSE;
o->dir = OB_DIRECTION_SOUTH;
return o;
@@ -179,7 +185,7 @@ static gpointer setup_south_func(xmlNodePtr node)
static gpointer setup_east_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->shrink = FALSE;
o->dir = OB_DIRECTION_EAST;
return o;
@@ -187,7 +193,7 @@ static gpointer setup_east_func(xmlNodePtr node)
static gpointer setup_west_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->shrink = FALSE;
o->dir = OB_DIRECTION_WEST;
return o;
diff --git a/openbox/actions/if.c b/openbox/actions/if.c
index dd86086b..5f4a356f 100644
--- a/openbox/actions/if.c
+++ b/openbox/actions/if.c
@@ -37,7 +37,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
if ((n = obt_xml_find_node(node, "shaded"))) {
if (obt_xml_node_bool(n))
@@ -113,7 +113,7 @@ static void free_func(gpointer options)
o->elseacts = g_slist_delete_link(o->elseacts, o->elseacts);
}
- g_free(o);
+ g_slice_free(Options, o);
}
/* Always return FALSE because its not interactive */
diff --git a/openbox/actions/layer.c b/openbox/actions/layer.c
index 2b4d325a..ed1eeedc 100644
--- a/openbox/actions/layer.c
+++ b/openbox/actions/layer.c
@@ -9,6 +9,7 @@ typedef struct {
static gpointer setup_func_top(xmlNodePtr node);
static gpointer setup_func_bottom(xmlNodePtr node);
static gpointer setup_func_send(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
/* 3.4-compatibility */
static gpointer setup_sendtop_func(xmlNodePtr node);
@@ -17,24 +18,24 @@ static gpointer setup_sendnormal_func(xmlNodePtr node);
void action_layer_startup(void)
{
- actions_register("ToggleAlwaysOnTop", setup_func_top, g_free,
+ actions_register("ToggleAlwaysOnTop", setup_func_top, free_func,
run_func);
- actions_register("ToggleAlwaysOnBottom", setup_func_bottom, g_free,
+ actions_register("ToggleAlwaysOnBottom", setup_func_bottom, free_func,
run_func);
- actions_register("SendToLayer", setup_func_send, g_free,
+ actions_register("SendToLayer", setup_func_send, free_func,
run_func);
/* 3.4-compatibility */
- actions_register("SendToTopLayer", setup_sendtop_func, g_free,
+ actions_register("SendToTopLayer", setup_sendtop_func, free_func,
run_func);
- actions_register("SendToBottomLayer", setup_sendbottom_func, g_free,
+ actions_register("SendToBottomLayer", setup_sendbottom_func, free_func,
run_func);
- actions_register("SendToNormalLayer", setup_sendnormal_func, g_free,
+ actions_register("SendToNormalLayer", setup_sendnormal_func, free_func,
run_func);
}
static gpointer setup_func_top(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->layer = 1;
o->toggle = TRUE;
return o;
@@ -42,7 +43,7 @@ static gpointer setup_func_top(xmlNodePtr node)
static gpointer setup_func_bottom(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->layer = -1;
o->toggle = TRUE;
return o;
@@ -53,7 +54,7 @@ static gpointer setup_func_send(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
if ((n = obt_xml_find_node(node, "layer"))) {
gchar *s = obt_xml_node_string(n);
@@ -72,6 +73,11 @@ static gpointer setup_func_send(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
@@ -102,7 +108,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
/* 3.4-compatibility */
static gpointer setup_sendtop_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->layer = 1;
o->toggle = FALSE;
return o;
@@ -110,7 +116,7 @@ static gpointer setup_sendtop_func(xmlNodePtr node)
static gpointer setup_sendbottom_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->layer = -1;
o->toggle = FALSE;
return o;
@@ -118,7 +124,7 @@ static gpointer setup_sendbottom_func(xmlNodePtr node)
static gpointer setup_sendnormal_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->layer = 0;
o->toggle = FALSE;
return o;
diff --git a/openbox/actions/maximize.c b/openbox/actions/maximize.c
index 4c615078..db7c36bb 100644
--- a/openbox/actions/maximize.c
+++ b/openbox/actions/maximize.c
@@ -13,6 +13,7 @@ typedef struct {
} Options;
static gpointer setup_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func_on(ObActionsData *data, gpointer options);
static gboolean run_func_off(ObActionsData *data, gpointer options);
static gboolean run_func_toggle(ObActionsData *data, gpointer options);
@@ -23,27 +24,27 @@ static gpointer setup_vert_func(xmlNodePtr node);
void action_maximize_startup(void)
{
- actions_register("Maximize", setup_func, g_free, run_func_on);
- actions_register("Unmaximize", setup_func, g_free, run_func_off);
- actions_register("ToggleMaximize", setup_func, g_free, run_func_toggle);
+ actions_register("Maximize", setup_func, free_func, run_func_on);
+ actions_register("Unmaximize", setup_func, free_func, run_func_off);
+ actions_register("ToggleMaximize", setup_func, free_func, run_func_toggle);
/* 3.4-compatibility */
- actions_register("MaximizeFull", setup_both_func, g_free,
+ actions_register("MaximizeFull", setup_both_func, free_func,
run_func_on);
- actions_register("UnmaximizeFull", setup_both_func, g_free,
+ actions_register("UnmaximizeFull", setup_both_func, free_func,
run_func_off);
- actions_register("ToggleMaximizeFull", setup_both_func, g_free,
+ actions_register("ToggleMaximizeFull", setup_both_func, free_func,
run_func_toggle);
- actions_register("MaximizeHorz", setup_horz_func, g_free,
+ actions_register("MaximizeHorz", setup_horz_func, free_func,
run_func_on);
- actions_register("UnmaximizeHorz", setup_horz_func, g_free,
+ actions_register("UnmaximizeHorz", setup_horz_func, free_func,
run_func_off);
- actions_register("ToggleMaximizeHorz", setup_horz_func, g_free,
+ actions_register("ToggleMaximizeHorz", setup_horz_func, free_func,
run_func_toggle);
- actions_register("MaximizeVert", setup_vert_func, g_free,
+ actions_register("MaximizeVert", setup_vert_func, free_func,
run_func_on);
- actions_register("UnmaximizeVert", setup_vert_func, g_free,
+ actions_register("UnmaximizeVert", setup_vert_func, free_func,
run_func_off);
- actions_register("ToggleMaximizeVert", setup_vert_func, g_free,
+ actions_register("ToggleMaximizeVert", setup_vert_func, free_func,
run_func_toggle);
}
@@ -52,7 +53,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
o->dir = BOTH;
if ((n = obt_xml_find_node(node, "direction"))) {
@@ -69,6 +70,11 @@ static gpointer setup_func(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func_on(ObActionsData *data, gpointer options)
{
@@ -113,21 +119,21 @@ static gboolean run_func_toggle(ObActionsData *data, gpointer options)
/* 3.4-compatibility */
static gpointer setup_both_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->dir = BOTH;
return o;
}
static gpointer setup_horz_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->dir = HORZ;
return o;
}
static gpointer setup_vert_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->dir = VERT;
return o;
}
diff --git a/openbox/actions/moverelative.c b/openbox/actions/moverelative.c
index ff9f719b..189b4dd0 100644
--- a/openbox/actions/moverelative.c
+++ b/openbox/actions/moverelative.c
@@ -10,11 +10,12 @@ typedef struct {
} Options;
static gpointer setup_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
void action_moverelative_startup(void)
{
- actions_register("MoveRelative", setup_func, g_free, run_func);
+ actions_register("MoveRelative", setup_func, free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node)
@@ -22,7 +23,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
if ((n = obt_xml_find_node(node, "x")))
o->x = obt_xml_node_int(n);
@@ -32,6 +33,11 @@ static gpointer setup_func(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
diff --git a/openbox/actions/moveresizeto.c b/openbox/actions/moveresizeto.c
index 68b4c0b2..ce50e9b9 100644
--- a/openbox/actions/moveresizeto.c
+++ b/openbox/actions/moveresizeto.c
@@ -24,15 +24,16 @@ typedef struct {
} Options;
static gpointer setup_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
/* 3.4-compatibility */
static gpointer setup_center_func(xmlNodePtr node);
void action_moveresizeto_startup(void)
{
- actions_register("MoveResizeTo", setup_func, g_free, run_func);
+ actions_register("MoveResizeTo", setup_func, free_func, run_func);
/* 3.4-compatibility */
- actions_register("MoveToCenter", setup_center_func, g_free, run_func);
+ actions_register("MoveToCenter", setup_center_func, free_func, run_func);
}
static void parse_coord(xmlNodePtr n, gint *pos,
@@ -59,7 +60,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
o->x = G_MININT;
o->y = G_MININT;
o->w = G_MININT;
@@ -103,6 +104,11 @@ static gpointer setup_func(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
@@ -186,7 +192,7 @@ static gpointer setup_center_func(xmlNodePtr node)
{
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
o->x = G_MININT;
o->y = G_MININT;
o->w = G_MININT;
diff --git a/openbox/actions/movetoedge.c b/openbox/actions/movetoedge.c
index f81ded41..ef5b6920 100644
--- a/openbox/actions/movetoedge.c
+++ b/openbox/actions/movetoedge.c
@@ -10,6 +10,7 @@ typedef struct {
} Options;
static gpointer setup_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
/* 3.4-compatibility */
static gpointer setup_north_func(xmlNodePtr node);
@@ -19,12 +20,12 @@ static gpointer setup_west_func(xmlNodePtr node);
void action_movetoedge_startup(void)
{
- actions_register("MoveToEdge", setup_func, g_free, run_func);
+ actions_register("MoveToEdge", setup_func, free_func, run_func);
/* 3.4-compatibility */
- actions_register("MoveToEdgeNorth", setup_north_func, g_free, run_func);
- actions_register("MoveToEdgeSouth", setup_south_func, g_free, run_func);
- actions_register("MoveToEdgeEast", setup_east_func, g_free, run_func);
- actions_register("MoveToEdgeWest", setup_west_func, g_free, run_func);
+ actions_register("MoveToEdgeNorth", setup_north_func, free_func, run_func);
+ actions_register("MoveToEdgeSouth", setup_south_func, free_func, run_func);
+ actions_register("MoveToEdgeEast", setup_east_func, free_func, run_func);
+ actions_register("MoveToEdgeWest", setup_west_func, free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node)
@@ -32,7 +33,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
o->dir = OB_DIRECTION_NORTH;
if ((n = obt_xml_find_node(node, "direction"))) {
@@ -55,6 +56,11 @@ static gpointer setup_func(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
@@ -77,28 +83,28 @@ static gboolean run_func(ObActionsData *data, gpointer options)
/* 3.4-compatibility */
static gpointer setup_north_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->dir = OB_DIRECTION_NORTH;
return o;
}
static gpointer setup_south_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->dir = OB_DIRECTION_SOUTH;
return o;
}
static gpointer setup_east_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->dir = OB_DIRECTION_EAST;
return o;
}
static gpointer setup_west_func(xmlNodePtr node)
{
- Options *o = g_new0(Options, 1);
+ Options *o = g_slice_new0(Options);
o->dir = OB_DIRECTION_WEST;
return o;
}
diff --git a/openbox/actions/resize.c b/openbox/actions/resize.c
index fbcdf24a..f6858d2d 100644
--- a/openbox/actions/resize.c
+++ b/openbox/actions/resize.c
@@ -10,6 +10,7 @@ typedef struct {
} Options;
static gpointer setup_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
static guint32 pick_corner(gint x, gint y, gint cx, gint cy, gint cw, gint ch,
@@ -17,7 +18,7 @@ static guint32 pick_corner(gint x, gint y, gint cx, gint cy, gint cw, gint ch,
void action_resize_startup(void)
{
- actions_register("Resize", setup_func, g_free, run_func);
+ actions_register("Resize", setup_func, free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node)
@@ -25,7 +26,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
if ((n = obt_xml_find_node(node, "edge"))) {
gchar *s = obt_xml_node_string(n);
@@ -55,6 +56,11 @@ static gpointer setup_func(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
diff --git a/openbox/actions/resizerelative.c b/openbox/actions/resizerelative.c
index c5fc1ea1..1d42df23 100644
--- a/openbox/actions/resizerelative.c
+++ b/openbox/actions/resizerelative.c
@@ -12,11 +12,12 @@ typedef struct {
} Options;
static gpointer setup_func(xmlNodePtr node);
+static void free_func(gpointer options);
static gboolean run_func(ObActionsData *data, gpointer options);
void action_resizerelative_startup(void)
{
- actions_register("ResizeRelative", setup_func, g_free, run_func);
+ actions_register("ResizeRelative", setup_func, free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node)
@@ -24,7 +25,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
if ((n = obt_xml_find_node(node, "left")))
o->left = obt_xml_node_int(n);
@@ -40,6 +41,11 @@ static gpointer setup_func(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
diff --git a/openbox/actions/restart.c b/openbox/actions/restart.c
index 7d1689cb..dc9a218a 100644
--- a/openbox/actions/restart.c
+++ b/openbox/actions/restart.c
@@ -20,7 +20,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
if ((n = obt_xml_find_node(node, "command")) ||
(n = obt_xml_find_node(node, "execute")))
@@ -36,7 +36,7 @@ static void free_func(gpointer options)
{
Options *o = options;
g_free(o->cmd);
- g_free(o);
+ g_slice_free(Options, o);
}
/* Always return FALSE because its not interactive */
diff --git a/openbox/actions/showmenu.c b/openbox/actions/showmenu.c
index e60f1c69..485a31d5 100644
--- a/openbox/actions/showmenu.c
+++ b/openbox/actions/showmenu.c
@@ -20,7 +20,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
if ((n = obt_xml_find_node(node, "menu")))
o->name = obt_xml_node_string(n);
@@ -31,7 +31,7 @@ static void free_func(gpointer options)
{
Options *o = options;
g_free(o->name);
- g_free(o);
+ g_slice_free(Options, o);
}
/* Always return FALSE because its not interactive */