diff options
Diffstat (limited to 'arch/common')
-rw-r--r-- | arch/common/display.h | 10 | ||||
-rw-r--r-- | arch/common/languages.h | 4 | ||||
-rw-r--r-- | arch/common/printers.h | 12 | ||||
-rw-r--r-- | arch/common/users.h | 13 |
4 files changed, 18 insertions, 21 deletions
diff --git a/arch/common/display.h b/arch/common/display.h index b4fe643e..d7cf2ae6 100644 --- a/arch/common/display.h +++ b/arch/common/display.h @@ -82,10 +82,10 @@ get_x11_info(DisplayInfo *di) if (g_str_has_prefix(tmp[0], "number of extensions")) { int n; - di->extensions = ""; + di->extensions = g_strdup(""); for (n = atoi(tmp[1]); n; n--) { - di->extensions = g_strconcat(di->extensions, + di->extensions = h_strconcat(di->extensions, g_strstrip(*(++output_lines)), "=\n", NULL); @@ -108,14 +108,14 @@ get_x11_info(DisplayInfo *di) gint n_monitors = gdk_screen_get_n_monitors(screen); gint i; - di->monitors = ""; + di->monitors = NULL; for (i = 0; i < n_monitors; i++) { GdkRectangle rect; gdk_screen_get_monitor_geometry(screen, i, &rect); - di->monitors = g_strdup_printf("%sMonitor %d=%dx%d pixels\n", - di->monitors, i, rect.width, rect.height); + di->monitors = h_strdup_cprintf("Monitor %d=%dx%d pixels\n", + di->monitors, i, rect.width, rect.height); } } else { di->monitors = ""; diff --git a/arch/common/languages.h b/arch/common/languages.h index 786b829f..efc100fb 100644 --- a/arch/common/languages.h +++ b/arch/common/languages.h @@ -20,7 +20,7 @@ void scan_languages(OperatingSystem * os) { FILE *locale; - gchar buf[512], *retval = ""; + gchar buf[512], *retval = NULL; locale = popen("locale -va", "r"); if (!locale) @@ -64,7 +64,7 @@ scan_languages(OperatingSystem * os) } else { gchar *currlocale; - retval = g_strdup_printf("%s$%s$%s=%s\n", retval, name, name, title); + retval = h_strdup_cprintf("$%s$%s=%s\n", retval, name, name, title); #define FIELD(f) f ? f : "(Unknown)" currlocale = g_strdup_printf("[Locale Information]\n" diff --git a/arch/common/printers.h b/arch/common/printers.h index 3daf28e6..43ddda0a 100644 --- a/arch/common/printers.h +++ b/arch/common/printers.h @@ -70,12 +70,16 @@ __scan_printers(void) if (noprinters > 0) { printer_list = g_strdup_printf("[Printers (CUPS)]\n"); for (i = 0; i < noprinters; i++) { - printer_list = g_strconcat(printer_list, printers[i], - g_str_equal(default_printer, printers[i]) ? - "=<i>(Default)</i>\n" : "=\n", - NULL); + printer_list = h_strdup_cprintf("\n$PRN%d$%s=%s\n", + printer_list, + i, + printers[i], + g_str_equal(default_printer, printers[i]) ? + "<i>(Default)</i>" : ""); g_free(printers[i]); } + + g_free(printers); } else { printer_list = g_strdup("[Printers]\n" "No printers found=\n"); diff --git a/arch/common/users.h b/arch/common/users.h index 84cec9d9..fd8f7834 100644 --- a/arch/common/users.h +++ b/arch/common/users.h @@ -4,14 +4,7 @@ static gchar *sys_users = NULL, static gboolean remove_users(gpointer key, gpointer value, gpointer data) { - if (!strncmp((gchar *) key, "USER", 4)) { - /* - * g_free((gchar *) key); - * g_free((GtkTreeIter *) value); - */ - return TRUE; - } - return FALSE; + return g_str_has_prefix(key, "USER"); } static void @@ -52,9 +45,9 @@ scan_users_do(void) uid = atoi(tmp[2]); strend(tmp[4], ','); if (uid >= 1000 && uid <= 65530) { - human_users = g_strdup_printf("%s$%s$%s=%s\n", human_users, key, tmp[0], tmp[4]); + human_users = h_strdup_cprintf("$%s$%s=%s\n", human_users, key, tmp[0], tmp[4]); } else { - sys_users = g_strdup_printf("%s$%s$%s=%s\n", sys_users, key, tmp[0], tmp[4]); + sys_users = h_strdup_cprintf("$%s$%s=%s\n", sys_users, key, tmp[0], tmp[4]); } g_strfreev(tmp); |