r16402 - gnucash/trunk/lib/libqof/qof - Move g_strdup inside of set_log_level to be a slightly better citizen and fix a serious bug. :/

Josh Sled jsled at cvs.gnucash.org
Wed Aug 8 00:19:23 EDT 2007


Author: jsled
Date: 2007-08-08 00:19:22 -0400 (Wed, 08 Aug 2007)
New Revision: 16402
Trac: http://svn.gnucash.org/trac/changeset/16402

Modified:
   gnucash/trunk/lib/libqof/qof/qoflog.c
Log:
Move g_strdup inside of set_log_level to be a slightly better citizen and fix a serious bug. :/


Modified: gnucash/trunk/lib/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qoflog.c	2007-08-07 10:35:35 UTC (rev 16401)
+++ gnucash/trunk/lib/libqof/qof/qoflog.c	2007-08-08 04:19:22 UTC (rev 16402)
@@ -196,7 +196,7 @@
 	{
 		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 @@
                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 @@
      _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)
           {



More information about the gnucash-changes mailing list