aboutsummaryrefslogtreecommitdiff
path: root/modules/computer/users.c
diff options
context:
space:
mode:
authorLeandro Pereira <leandro@hardinfo.org>2012-01-26 22:14:43 -0200
committerLeandro Pereira <leandro@hardinfo.org>2012-01-26 22:14:43 -0200
commitd3b9aa19f04e6be78afb8497e7808a3d42042bf2 (patch)
tree340e9be8f863e1ad29e1da91cd87a66409d6f706 /modules/computer/users.c
parentd9e242117b7a73dd3057af25956027a361f7999f (diff)
Better manage moreinfo hashes
Have only one for the whole program and use per-module namespaces/prefixes so that each module can clear its own information easily.
Diffstat (limited to 'modules/computer/users.c')
-rw-r--r--modules/computer/users.c11
1 files changed, 3 insertions, 8 deletions
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();