Don't memory slices for single structs.
authorDaniel Carl <danielcarl@gmx.de>
Mon, 16 Apr 2018 21:00:59 +0000 (23:00 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Mon, 16 Apr 2018 21:00:59 +0000 (23:00 +0200)
src/handler.c
src/shortcut.c

index fd15d8e..c41e869 100644 (file)
@@ -33,7 +33,7 @@ static char *handler_lookup(Handler *h, const char *uri);
 
 Handler *handler_new(void)
 {
-    Handler *h = g_slice_new(Handler);
+    Handler *h = g_new(Handler, 1);
     h->table   = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 
     return h;
@@ -45,7 +45,7 @@ void handler_free(Handler *h)
         g_hash_table_destroy(h->table);
         h->table = NULL;
     }
-    g_slice_free(Handler, h);
+    g_free(h);
 }
 
 gboolean handler_add(Handler *h, const char *key, const char *cmd)
index 356c08d..76100e7 100644 (file)
@@ -37,7 +37,7 @@ static const char *shortcut_lookup(Shortcut *sc, const char *string, const char
 
 Shortcut *shortcut_new()
 {
-    Shortcut *sc = g_slice_new(Shortcut);
+    Shortcut *sc = g_new(Shortcut, 1);
     sc->table    = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
     sc->fallback = NULL;
 
@@ -49,7 +49,7 @@ void shortcut_free(Shortcut *sc)
     if (sc->table) {
         g_hash_table_destroy(sc->table);
     }
-    g_slice_free(Shortcut, sc);
+    g_free(sc);
 }
 
 gboolean shortcut_add(Shortcut *sc, const char *key, const char *uri)