Commit ffc422c4 authored by Robert Ancell's avatar Robert Ancell

daemon: Fix warnings about type-punning

parent 14bb1237
...@@ -259,8 +259,7 @@ entry_generator_cachedir (Daemon *daemon, ...@@ -259,8 +259,7 @@ entry_generator_cachedir (Daemon *daemon,
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
gboolean regular; gboolean regular;
GHashTableIter iter; GHashTableIter iter;
const gchar *name; gpointer key, value;
User *user;
GDir *dir; GDir *dir;
/* First iteration */ /* First iteration */
...@@ -315,7 +314,9 @@ entry_generator_cachedir (Daemon *daemon, ...@@ -315,7 +314,9 @@ entry_generator_cachedir (Daemon *daemon,
/* Update all the users from the files in the cache dir */ /* Update all the users from the files in the cache dir */
g_hash_table_iter_init (&iter, users); g_hash_table_iter_init (&iter, users);
while (g_hash_table_iter_next (&iter, (gpointer *)&name, (gpointer *)&user)) { while (g_hash_table_iter_next (&iter, &key, &value)) {
const gchar *name = key;
User *user = value;
g_autofree gchar *filename = NULL; g_autofree gchar *filename = NULL;
g_autoptr(GKeyFile) key_file = NULL; g_autoptr(GKeyFile) key_file = NULL;
...@@ -450,8 +451,7 @@ reload_users (Daemon *daemon) ...@@ -450,8 +451,7 @@ reload_users (Daemon *daemon)
GHashTable *local; GHashTable *local;
GHashTableIter iter; GHashTableIter iter;
gsize number_of_normal_users = 0; gsize number_of_normal_users = 0;
gpointer name; gpointer name, value;
User *user;
/* Track the users that we saw during our (re)load */ /* Track the users that we saw during our (re)load */
users = create_users_hash_table (); users = create_users_hash_table ();
...@@ -479,7 +479,8 @@ reload_users (Daemon *daemon) ...@@ -479,7 +479,8 @@ reload_users (Daemon *daemon)
/* Count the non-system users. Mark which users are local, which are not. */ /* Count the non-system users. Mark which users are local, which are not. */
g_hash_table_iter_init (&iter, users); g_hash_table_iter_init (&iter, users);
while (g_hash_table_iter_next (&iter, &name, (gpointer *)&user)) { while (g_hash_table_iter_next (&iter, &name, &value)) {
User *user = value;
if (!user_get_system_account (user)) if (!user_get_system_account (user))
number_of_normal_users++; number_of_normal_users++;
user_update_local_account_property (user, g_hash_table_lookup (local, name) != NULL); user_update_local_account_property (user, g_hash_table_lookup (local, name) != NULL);
...@@ -504,7 +505,8 @@ reload_users (Daemon *daemon) ...@@ -504,7 +505,8 @@ reload_users (Daemon *daemon)
/* Remove all the old users */ /* Remove all the old users */
g_hash_table_iter_init (&iter, old_users); g_hash_table_iter_init (&iter, old_users);
while (g_hash_table_iter_next (&iter, &name, (gpointer *)&user)) { while (g_hash_table_iter_next (&iter, &name, &value)) {
User *user = value;
User *refreshed_user; User *refreshed_user;
refreshed_user = g_hash_table_lookup (users, name); refreshed_user = g_hash_table_lookup (users, name);
...@@ -518,7 +520,8 @@ reload_users (Daemon *daemon) ...@@ -518,7 +520,8 @@ reload_users (Daemon *daemon)
/* Register all the new users */ /* Register all the new users */
g_hash_table_iter_init (&iter, users); g_hash_table_iter_init (&iter, users);
while (g_hash_table_iter_next (&iter, &name, (gpointer *)&user)) { while (g_hash_table_iter_next (&iter, &name, &value)) {
User *user = value;
User *stale_user; User *stale_user;
stale_user = g_hash_table_lookup (old_users, name); stale_user = g_hash_table_lookup (old_users, name);
...@@ -959,15 +962,16 @@ finish_list_cached_users (gpointer user_data) ...@@ -959,15 +962,16 @@ finish_list_cached_users (gpointer user_data)
ListUserData *data = user_data; ListUserData *data = user_data;
g_autoptr(GPtrArray) object_paths = NULL; g_autoptr(GPtrArray) object_paths = NULL;
GHashTableIter iter; GHashTableIter iter;
const gchar *name; gpointer key, value;
User *user;
uid_t uid; uid_t uid;
const gchar *shell; const gchar *shell;
object_paths = g_ptr_array_new (); object_paths = g_ptr_array_new ();
g_hash_table_iter_init (&iter, data->daemon->priv->users); g_hash_table_iter_init (&iter, data->daemon->priv->users);
while (g_hash_table_iter_next (&iter, (gpointer *)&name, (gpointer *)&user)) { while (g_hash_table_iter_next (&iter, &key, &value)) {
const gchar *name = key;
User *user = value;
uid = user_get_uid (user); uid = user_get_uid (user);
shell = user_get_shell (user); shell = user_get_shell (user);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment