diff options
Diffstat (limited to 'libcaja-private/caja-directory-async.c')
| -rw-r--r-- | libcaja-private/caja-directory-async.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c index 85045cff..affa32e3 100644 --- a/libcaja-private/caja-directory-async.c +++ b/libcaja-private/caja-directory-async.c @@ -147,7 +147,7 @@ struct DeepCountState GFileEnumerator *enumerator; GFile *deep_count_location; GList *deep_count_subdirectories; - GArray *seen_deep_count_inodes; + GHashTable *seen_deep_count_inodes; char *fs_id; }; @@ -2821,21 +2821,13 @@ static inline gboolean seen_inode (DeepCountState *state, GFileInfo *info) { - guint64 inode, inode2; - guint i; + guint64 inode; inode = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_UNIX_INODE); if (inode != 0) { - for (i = 0; i < state->seen_deep_count_inodes->len; i++) - { - inode2 = g_array_index (state->seen_deep_count_inodes, guint64, i); - if (inode == inode2) - { - return TRUE; - } - } + return g_hash_table_lookup (state->seen_deep_count_inodes, &inode) != NULL; } return FALSE; @@ -2850,7 +2842,9 @@ mark_inode_as_seen (DeepCountState *state, inode = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_UNIX_INODE); if (inode != 0) { - g_array_append_val (state->seen_deep_count_inodes, inode); + guint64 *key = g_new (guint64, 1); + *key = inode; + g_hash_table_add (state->seen_deep_count_inodes, key); } } @@ -2925,7 +2919,7 @@ deep_count_state_free (DeepCountState *state) g_object_unref (state->deep_count_location); } g_list_free_full (state->deep_count_subdirectories, g_object_unref); - g_array_free (state->seen_deep_count_inodes, TRUE); + g_hash_table_unref (state->seen_deep_count_inodes); g_free (state->fs_id); g_free (state); } @@ -3189,7 +3183,7 @@ deep_count_start (CajaDirectory *directory, state = g_new0 (DeepCountState, 1); state->directory = directory; state->cancellable = g_cancellable_new (); - state->seen_deep_count_inodes = g_array_new (FALSE, TRUE, sizeof (guint64)); + state->seen_deep_count_inodes = g_hash_table_new_full (g_int64_hash, g_int64_equal, g_free, NULL); state->fs_id = NULL; directory->details->deep_count_in_progress = state; |
