From 835d55097688bbb0a8f236459db759108b7af7c7 Mon Sep 17 00:00:00 2001 From: Burt P Date: Fri, 8 Jun 2018 21:41:00 -0500 Subject: computer/languages.c: requested changes Signed-off-by: Burt P --- modules/computer/languages.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'modules/computer/languages.c') diff --git a/modules/computer/languages.c b/modules/computer/languages.c index d6d49828..3d141e02 100644 --- a/modules/computer/languages.c +++ b/modules/computer/languages.c @@ -35,14 +35,6 @@ typedef struct { *codeset; } locale_info; -locale_info *locale_info_new() { - locale_info *s = malloc(sizeof(locale_info)); - if (s) { - memset(s, 0, sizeof(locale_info) ); - } - return s; -} - void locale_info_free(locale_info *s) { if (s) { g_free(s->title); @@ -125,7 +117,6 @@ gchar *locale_info_section(locale_info *s) { void scan_languages(OperatingSystem * os) { - //gchar **tmp; gboolean spawned; gchar *out, *err, *p, *next_nl; @@ -136,7 +127,7 @@ scan_languages(OperatingSystem * os) spawned = g_spawn_command_line_sync("locale -va", &out, &err, NULL, NULL); if (spawned) { - ret = strdup(""); + ret = g_strdup(""); p = out; while(1) { /* `locale -va` doesn't end the last locale block @@ -147,7 +138,7 @@ scan_languages(OperatingSystem * os) last = (*next_nl == 0) ? 1 : 0; strend(p, '\n'); if (strncmp(p, "locale:", 7) == 0) { - curr = locale_info_new(); + curr = g_new0(locale_info, 1); sscanf(p, "locale: %s", curr->name); /* TODO: 'directory:' and 'archive:' */ } else if (strchr(p, '|')) { @@ -176,7 +167,7 @@ scan_languages(OperatingSystem * os) gchar *li_str = locale_info_section(curr); gchar *clean_title = hardinfo_clean_value(curr->title, 0); /* may contain & */ ret = h_strdup_cprintf("$%s$%s=%s\n", ret, curr->name, curr->name, clean_title); - moreinfo_add_with_prefix("COMP", strdup(curr->name), li_str); /* becomes owned by moreinfo */ + moreinfo_add_with_prefix("COMP", g_strdup(curr->name), li_str); /* becomes owned by moreinfo */ locale_info_free(curr); curr = NULL; g_free(clean_title); -- cgit v1.2.3