]> Dogcows Code - chaz/openbox/blobdiff - openbox/actions/exit.c
more using g_slice_new() instead of g_new()
[chaz/openbox] / openbox / actions / exit.c
index f2b0cafbfafa0977ed9bb7c508c4114191218034..2d9fc63312dc9c73b196474db71fb0f79bd99f83 100644 (file)
@@ -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)
 {
This page took 0.022108 seconds and 4 git commands to generate.