diff options
| author | Dana Jansens <danakj@orodu.net> | 2010-02-12 14:03:24 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2010-02-12 14:03:24 -0500 |
| commit | 890e13b919892887b773462bb866e849e0cb4d91 (patch) | |
| tree | 3abd5c781bb2cedddb061e34a8057fe146a49794 /obt/xevent.c | |
| parent | 4f93731cdbecbf43b82aa000c07ec8b40f97dd03 (diff) | |
use g_slice_new() instead of g_new() part 3
Diffstat (limited to 'obt/xevent.c')
| -rw-r--r-- | obt/xevent.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/obt/xevent.c b/obt/xevent.c index 1cc32a94..21beb930 100644 --- a/obt/xevent.c +++ b/obt/xevent.c @@ -43,6 +43,7 @@ struct _ObtXEventBinding static void xevent_handler(const XEvent *e, gpointer data); static guint window_hash(Window *w) { return *w; } static gboolean window_comp(Window *w1, Window *w2) { return *w1 == *w2; } +static void binding_free(gpointer b); ObtXEventHandler* xevent_new(void) { @@ -94,17 +95,22 @@ void xevent_set_handler(ObtXEventHandler *h, gint type, Window win, for (i = h->num_event_types; i < type + 1; ++i) h->bindings[i] = g_hash_table_new_full((GHashFunc)window_hash, (GEqualFunc)window_comp, - NULL, g_free); + NULL, binding_free); h->num_event_types = type + 1; } - b = g_new(ObtXEventBinding, 1); + b = g_slice_new(ObtXEventBinding); b->win = win; b->func = func; b->data = data; g_hash_table_replace(h->bindings[type], &b->win, b); } +static void binding_free(gpointer b) +{ + g_slice_free(ObtXEventBinding, b); +} + void xevent_remove_handler(ObtXEventHandler *h, gint type, Window win) { g_assert(type < h->num_event_types); |
