core/logging: return static string from nm_logging_level_to_string()

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-02-12 11:17:26 +01:00
parent ff6946a193
commit 85b972e9b8
3 changed files with 5 additions and 7 deletions

View file

@ -263,10 +263,10 @@ nm_logging_setup (const char *level,
return TRUE;
}
char *
const char *
nm_logging_level_to_string (void)
{
return g_strdup (level_names[log_level]);
return level_names[log_level];
}
const char *

View file

@ -114,7 +114,7 @@ void _nm_log (const char *loc,
const char *fmt,
...) __attribute__((__format__ (__printf__, 5, 6)));
char *nm_logging_level_to_string (void);
const char *nm_logging_level_to_string (void);
char *nm_logging_domains_to_string (void);
gboolean nm_logging_enabled (guint32 level, guint64 domain);

View file

@ -4089,12 +4089,10 @@ impl_manager_set_logging (NMManager *manager,
}
if (nm_logging_setup (level, domains, NULL, &error)) {
char *new_level = nm_logging_level_to_string ();
char *new_domains = nm_logging_domains_to_string ();
nm_log_info (LOGD_CORE, "logging: level '%s' domains '%s'",
new_level, new_domains);
g_free (new_level);
nm_logging_level_to_string (), new_domains);
g_free (new_domains);
}
@ -4111,7 +4109,7 @@ impl_manager_get_logging (NMManager *manager,
char **level,
char **domains)
{
*level = nm_logging_level_to_string ();
*level = g_strdup (nm_logging_level_to_string ());
*domains = nm_logging_domains_to_string ();
}