Move g_strdup inside of set_log_level to be a slightly better citizen and fix a serious bug. :/

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16402 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled 2007-08-08 04:19:22 +00:00
parent 36d1fe4aa7
commit 86f3842984

View File

@ -196,7 +196,7 @@ qof_log_set_level(QofLogModule log_module, QofLogLevel level)
{
log_table = g_hash_table_new(g_str_hash, g_str_equal);
}
g_hash_table_insert(log_table, (gpointer)log_module, GINT_TO_POINTER((gint)level));
g_hash_table_insert(log_table, g_strdup((gchar*)log_module), GINT_TO_POINTER((gint)level));
}
const char *
@ -274,7 +274,7 @@ qof_log_parse_log_config(const char *filename)
g_debug("setting log [%s] to level [%s=%d]", logger_name, level_str, level);
qof_log_set_level(logger_name, level);
g_free(logger_name);
g_free(logger_name);
g_free(level_str);
}
g_strfreev(levels);
@ -329,7 +329,7 @@ qof_log_check(QofLogModule log_domain, QofLogLevel log_level)
_QLC_DBG({ printf("trying [%s] (%d):", log_domain, g_hash_table_size(log_levels)); });
if (G_LIKELY(log_levels))
{
// e.g., "a.b.c" -> "a\0b.c" -> "a.b\0c", "a.b.c"
// e.g., "a.b.c\0" -> "a\0b.c\0" -> "a.b\0c\0", "a.b.c\0"
gpointer match_level;
while ((dot_pointer = g_strstr_len(dot_pointer, strlen(dot_pointer), ".")) != NULL)
{