From: Dana Jansens Date: Mon, 8 Aug 2011 18:17:24 +0000 (-0400) Subject: Fix the check when adding a new variable to the config parser, and NULL pointers... X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=0795af10e2441acc936551074e5cb76755557a43;p=dana%2Fopenbox.git Fix the check when adding a new variable to the config parser, and NULL pointers in the ConfigParser. - was checking if it didn't exist instead of looking for a duplicate --- diff --git a/openbox/config_parser.c b/openbox/config_parser.c index 941216b3..887db07e 100644 --- a/openbox/config_parser.c +++ b/openbox/config_parser.c @@ -125,9 +125,9 @@ static ObConfigParserEntity* add(ObConfigParser *p, ObConfigParserEntity *e; g_return_val_if_fail(def != NULL, NULL); - g_return_val_if_fail(g_hash_table_lookup(p->entities, name) != NULL, NULL); + g_return_val_if_fail(g_hash_table_lookup(p->entities, name) == NULL, NULL); - e = g_slice_new(ObConfigParserEntity); + e = g_slice_new0(ObConfigParserEntity); e->name = g_strdup(name); e->cb = FALSE; e->u.v.value = def; @@ -251,9 +251,9 @@ void config_parser_callback(ObConfigParser *p, const gchar *name, { ObConfigParserEntity *e; - g_return_if_fail(g_hash_table_lookup(p->entities, name) != NULL); + g_return_if_fail(g_hash_table_lookup(p->entities, name) == NULL); - e = g_slice_new(ObConfigParserEntity); + e = g_slice_new0(ObConfigParserEntity); e->name = g_strdup(name); e->cb = TRUE; e->u.cb.func = cb;