static void destfunc(struct Callback *c)
{
g_free(c->tag);
- g_free(c);
+ g_slice_free(struct Callback, c);
}
ObtXmlInst* obt_xml_instance_new(void)
{
- ObtXmlInst *i = g_new(ObtXmlInst, 1);
+ ObtXmlInst *i = g_slice_new(ObtXmlInst);
i->ref = 1;
i->xdg_paths = obt_paths_new();
i->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
if (i && --i->ref == 0) {
obt_paths_unref(i->xdg_paths);
g_hash_table_destroy(i->callbacks);
- g_free(i);
+ g_slice_free(ObtXmlInst, i);
}
}
return;
}
- c = g_new(struct Callback, 1);
+ c = g_slice_new(struct Callback);
c->tag = g_strdup(tag);
c->func = func;
c->data = data;
g_assert(i->doc); /* a doc is open? */
while (node) {
- struct Callback *c = g_hash_table_lookup(i->callbacks, node->name);
- if (c) c->func(node, c->data);
+ if (node->name) {
+ struct Callback *c = g_hash_table_lookup(i->callbacks, node->name);
+ if (c) c->func(node, c->data);
+ }
node = node->next;
}
}