aboutsummaryrefslogtreecommitdiff
path: root/modules/computer
diff options
context:
space:
mode:
Diffstat (limited to 'modules/computer')
-rw-r--r--modules/computer/filesystem.c17
-rw-r--r--modules/computer/languages.c2
-rw-r--r--modules/computer/modules.c11
-rw-r--r--modules/computer/users.c11
4 files changed, 11 insertions, 30 deletions
diff --git a/modules/computer/filesystem.c b/modules/computer/filesystem.c
index fcd8cf31..a7162777 100644
--- a/modules/computer/filesystem.c
+++ b/modules/computer/filesystem.c
@@ -27,12 +27,6 @@
gchar *fs_list = NULL;
-static gboolean
-remove_filesystem_entries(gpointer key, gpointer value, gpointer data)
-{
- return g_str_has_prefix(key, "FS");
-}
-
void
scan_filesystems(void)
{
@@ -43,7 +37,7 @@ scan_filesystems(void)
g_free(fs_list);
fs_list = g_strdup("");
- g_hash_table_foreach_remove(moreinfo, remove_filesystem_entries, NULL);
+ moreinfo_del_with_prefix("COMP:FS");
mtab = fopen("/etc/mtab", "r");
if (!mtab)
@@ -76,13 +70,8 @@ scan_filesystems(void)
*strused = size_human_readable(used);
gchar *strhash;
- if ((strhash = g_hash_table_lookup(moreinfo, tmp[0]))) {
- g_hash_table_remove(moreinfo, tmp[0]);
- g_free(strhash);
- }
strreplacechr(tmp[0], "#", '_');
-
strhash = g_strdup_printf("[%s]\n"
"Filesystem=%s\n"
"Mounted As=%s\n"
@@ -95,7 +84,9 @@ scan_filesystems(void)
strstr(tmp[3], "rw") ? "Read-Write" :
"Read-Only", tmp[1], strsize, strused,
stravail);
- g_hash_table_insert(moreinfo, g_strdup_printf("FS%d", ++count), strhash);
+ gchar *key = g_strdup_printf("FS%d", ++count);
+ moreinfo_add_with_prefix("COMP", key, strhash);
+ g_free(key);
fs_list = h_strdup_cprintf("$FS%d$%s=%.2f %% (%s of %s)|%s\n",
fs_list,
diff --git a/modules/computer/languages.c b/modules/computer/languages.c
index 2808da1b..5877c41c 100644
--- a/modules/computer/languages.c
+++ b/modules/computer/languages.c
@@ -89,7 +89,7 @@ scan_languages(OperatingSystem * os)
FIELD(date), FIELD(codeset));
#undef FIELD
- g_hash_table_insert(moreinfo, g_strdup(name), currlocale);
+ moreinfo_add_with_prefix("COMP", name, currlocale);
g_free(title);
g_free(source);
diff --git a/modules/computer/modules.c b/modules/computer/modules.c
index 743ba176..dc4c1815 100644
--- a/modules/computer/modules.c
+++ b/modules/computer/modules.c
@@ -28,12 +28,6 @@
continue; \
}
-static gboolean
-remove_module_devices(gpointer key, gpointer value, gpointer data)
-{
- return g_str_has_prefix(key, "MOD");
-}
-
GHashTable *_module_hash_table = NULL;
void
@@ -50,7 +44,7 @@ scan_modules_do(void)
g_free(module_list);
module_list = NULL;
- g_hash_table_foreach_remove(moreinfo, remove_module_devices, NULL);
+ moreinfo_del_with_prefix("COMP:MOD");
lsmod_path = find_program("lsmod");
lsmod = popen(lsmod_path, "r");
@@ -158,7 +152,8 @@ scan_modules_do(void)
g_free(deps);
}
- g_hash_table_insert(moreinfo, hashkey, strmodule);
+ moreinfo_add_with_prefix("COMP", hashkey, strmodule);
+ g_free(hashkey);
g_free(license);
g_free(description);
diff --git a/modules/computer/users.c b/modules/computer/users.c
index e303ac6e..e8f891ac 100644
--- a/modules/computer/users.c
+++ b/modules/computer/users.c
@@ -22,12 +22,6 @@
gchar *users = NULL;
-static gboolean
-remove_users(gpointer key, gpointer value, gpointer data)
-{
- return g_str_has_prefix(key, "USER");
-}
-
void
scan_users_do(void)
{
@@ -38,7 +32,7 @@ scan_users_do(void)
if (users) {
g_free(users);
- g_hash_table_foreach_remove(moreinfo, remove_users, NULL);
+ moreinfo_del_with_prefix("COMP:USER");
}
users = g_strdup("");
@@ -54,11 +48,12 @@ scan_users_do(void)
(gint) passwd_->pw_gid,
passwd_->pw_dir,
passwd_->pw_shell);
- g_hash_table_insert(moreinfo, key, val);
+ moreinfo_add_with_prefix("COMP", key, val);
strend(passwd_->pw_gecos, ',');
users = h_strdup_cprintf("$%s$%s=%s\n", users, key, passwd_->pw_name, passwd_->pw_gecos);
passwd_ = getpwent();
+ g_free(key);
}
endpwent();