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; return TRUE;
} }
char * const char *
nm_logging_level_to_string (void) nm_logging_level_to_string (void)
{ {
return g_strdup (level_names[log_level]); return level_names[log_level];
} }
const char * const char *

View File

@@ -114,7 +114,7 @@ void _nm_log (const char *loc,
const char *fmt, const char *fmt,
...) __attribute__((__format__ (__printf__, 5, 6))); ...) __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); char *nm_logging_domains_to_string (void);
gboolean nm_logging_enabled (guint32 level, guint64 domain); 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)) { if (nm_logging_setup (level, domains, NULL, &error)) {
char *new_level = nm_logging_level_to_string ();
char *new_domains = nm_logging_domains_to_string (); char *new_domains = nm_logging_domains_to_string ();
nm_log_info (LOGD_CORE, "logging: level '%s' domains '%s'", nm_log_info (LOGD_CORE, "logging: level '%s' domains '%s'",
new_level, new_domains); nm_logging_level_to_string (), new_domains);
g_free (new_level);
g_free (new_domains); g_free (new_domains);
} }
@@ -4111,7 +4109,7 @@ impl_manager_get_logging (NMManager *manager,
char **level, char **level,
char **domains) char **domains)
{ {
*level = nm_logging_level_to_string (); *level = g_strdup (nm_logging_level_to_string ());
*domains = nm_logging_domains_to_string (); *domains = nm_logging_domains_to_string ();
} }