diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index c2eb48ae1..8ac166885 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -618,40 +618,6 @@ get_primary_disc_info (CcInfoPanel *self)
get_primary_disc_info_start (self);
}
-static char *
-remove_duplicate_whitespace (const char *old)
-{
- char *new;
- GRegex *re;
- GError *error;
-
- error = NULL;
- re = g_regex_new ("[ \t\n\r]+", G_REGEX_MULTILINE, 0, &error);
- if (re == NULL)
- {
- g_warning ("Error building regex: %s", error->message);
- g_error_free (error);
- return g_strdup (old);
- }
- new = g_regex_replace (re,
- old,
- -1,
- 0,
- " ",
- 0,
- &error);
- g_regex_unref (re);
- if (new == NULL)
- {
- g_warning ("Error replacing string: %s", error->message);
- g_error_free (error);
- return g_strdup (old);
- }
-
- return new;
-}
-
-
static char *
get_cpu_info (const glibtop_sysinfo *info)
{
@@ -694,22 +660,21 @@ get_cpu_info (const glibtop_sysinfo *info)
g_hash_table_iter_init (&iter, counts);
while (g_hash_table_iter_next (&iter, &key, &value))
{
- char *stripped;
+ char *cleanedup;
int count;
count = GPOINTER_TO_INT (value);
- stripped = remove_duplicate_whitespace ((const char *)key);
+ cleanedup = info_cleanup ((const char *) key);
if (count > 1)
- g_string_append_printf (cpu, "%s \303\227 %d ", stripped, count);
+ g_string_append_printf (cpu, "%s \303\227 %d ", cleanedup, count);
else
- g_string_append_printf (cpu, "%s ", stripped);
- g_free (stripped);
+ g_string_append_printf (cpu, "%s ", cleanedup);
+ g_free (cleanedup);
}
g_hash_table_destroy (counts);
- ret = info_cleanup (cpu->str);
- g_string_free (cpu, TRUE);
+ ret = g_string_free (cpu, FALSE);
return ret;
}
diff --git a/panels/info/info-cleanup-test.txt b/panels/info/info-cleanup-test.txt
index ea4291e6e..eb631a546 100644
--- a/panels/info/info-cleanup-test.txt
+++ b/panels/info/info-cleanup-test.txt
@@ -1,2 +1,3 @@
Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz Intel® Core™ i5-4590T CPU @ 2.00GHz
Intel(R) Ivybridge Mobile Intel® Ivybridge Mobile
+Intel(R) Ivybridge Mobile Intel® Ivybridge Mobile
diff --git a/panels/info/info-cleanup.c b/panels/info/info-cleanup.c
index 05c162e59..5bd49e87b 100644
--- a/panels/info/info-cleanup.c
+++ b/panels/info/info-cleanup.c
@@ -88,8 +88,47 @@ prettify_info (const char *info)
return pretty;
}
+static char *
+remove_duplicate_whitespace (const char *old)
+{
+ char *new;
+ GRegex *re;
+ GError *error;
+
+ error = NULL;
+ re = g_regex_new ("[ \t\n\r]+", G_REGEX_MULTILINE, 0, &error);
+ if (re == NULL)
+ {
+ g_warning ("Error building regex: %s", error->message);
+ g_error_free (error);
+ return g_strdup (old);
+ }
+ new = g_regex_replace (re,
+ old,
+ -1,
+ 0,
+ " ",
+ 0,
+ &error);
+ g_regex_unref (re);
+ if (new == NULL)
+ {
+ g_warning ("Error replacing string: %s", error->message);
+ g_error_free (error);
+ return g_strdup (old);
+ }
+
+ return new;
+}
+
char *
info_cleanup (const char *input)
{
- return prettify_info (input);
+ char *pretty, *ret;
+
+ pretty = prettify_info (input);
+ ret = remove_duplicate_whitespace (pretty);
+ g_free (pretty);
+
+ return ret;
}