Commit 85f539ba authored by Christian Kellner's avatar Christian Kellner
Browse files

SystemInfo: properly string (session) renderer

Introduce two new helper functions to make cleaning strings we
get back from helpers and such easier.
parent 5b4477cb
......@@ -408,6 +408,32 @@ gbb_system_info_class_init (GbbSystemInfoClass *klass)
props);
}
static char *
gbb_str_clean(char *input)
{
char *cleaned = g_strstrip(input);
if (*cleaned == '\0') {
g_free(cleaned);
cleaned = NULL;
}
return cleaned;
}
static char *
gbb_strdup_clean(const char *input)
{
char *cleaned;
if (input == NULL || *input == '\0') {
return NULL;
}
cleaned = g_strdup(input);
return gbb_str_clean(cleaned);
}
static char *
read_sysfs_string(const char *node)
{
......@@ -659,12 +685,7 @@ get_renderer_from_session (void)
}
renderer = g_variant_get_string(var, NULL);
if (renderer != NULL && renderer[0] != '\0') {
return NULL;
}
return g_strstrip(g_strdup(renderer));
return gbb_strdup_clean(renderer);
}
static char *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment