]> Dogcows Code - chaz/openbox/blobdiff - openbox/actions/addremovedesktop.c
more using g_slice_new() instead of g_new()
[chaz/openbox] / openbox / actions / addremovedesktop.c
index 1e7f0b57ac4b18a9e00d4e0f7d0aa40a0136b0c3..ff6767e29423a14eab5ec46ea102f8e6ee422cd0 100644 (file)
@@ -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,20 +20,18 @@ static gpointer setup_removelast_func(xmlNodePtr node);
 
 void action_addremovedesktop_startup(void)
 {
-    actions_register("AddDesktop", setup_add_func, g_free, run_func,
-                     NULL, NULL);
-    actions_register("RemoveDesktop", setup_remove_func, g_free, run_func,
-                     NULL, NULL);
+    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,
-                     NULL, NULL);
-    actions_register("RemoveDesktopLast", setup_removelast_func, g_free, run_func,
-                     NULL, NULL);
-    actions_register("AddDesktopCurrent", setup_addcurrent_func, g_free, run_func,
-                     NULL, NULL);
-    actions_register("RemoveDesktopCurrent", setup_removecurrent_func, g_free, run_func,
-                     NULL, NULL);
+    actions_register("AddDesktopLast", setup_addlast_func,
+                     free_func, run_func);
+    actions_register("RemoveDesktopLast", setup_removelast_func,
+                     free_func, run_func);
+    actions_register("AddDesktopCurrent", setup_addcurrent_func,
+                     free_func, run_func);
+    actions_register("RemoveDesktopCurrent", setup_removecurrent_func,
+                     free_func, run_func);
 }
 
 static gpointer setup_func(xmlNodePtr node)
@@ -40,10 +39,10 @@ static gpointer setup_func(xmlNodePtr node)
     xmlNodePtr n;
     Options *o;
 
-    o = g_new0(Options, 1);
+    o = g_slice_new0(Options);
 
-    if ((n = obt_parse_find_node(node, "where"))) {
-        gchar *s = obt_parse_node_string(n);
+    if ((n = obt_xml_find_node(node, "where"))) {
+        gchar *s = obt_xml_node_string(n);
         if (!g_ascii_strcasecmp(s, "last"))
             o->current = FALSE;
         else if (!g_ascii_strcasecmp(s, "current"))
@@ -68,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)
 {
This page took 0.021239 seconds and 4 git commands to generate.