Changeset 5357
- Timestamp:
- 03/12/08 05:29:55 (4 months ago)
- Files:
-
- wired/trunk/wired/files.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wired/trunk/wired/files.c
r5355 r5357 87 87 static wi_lock_t *wd_files_indexer_lock; 88 88 static wi_uinteger_t wd_files_index_level; 89 static wi_ set_t *wd_files_index_set;89 static wi_hash_t *wd_files_index_hash; 90 90 91 91 wi_uinteger_t wd_files_count, wd_files_unique_count; … … 826 826 wi_string_t *path, *realpath; 827 827 wi_time_interval_t interval; 828 wi_uinteger_t count, capacity;829 828 830 829 pool = wi_pool_init(wi_pool_alloc()); … … 834 833 835 834 interval = wi_time_interval(); 836 count = wd_files_unique_count + wd_directories_unique_count;837 838 if(count > 100)839 capacity = 100 + (count / 100.0f);840 else if(count > 0)841 capacity = count;842 else843 capacity = 100;844 835 845 836 wd_files_count = wd_files_unique_count = 0; 846 837 wd_directories_count = wd_directories_unique_count = 0; 847 838 wd_files_size = wd_files_unique_size = 0; 848 849 wd_files_index_level = 0; 850 wd_files_index_set = wi_autorelease(wi_set_init_with_capacity(wi_set_alloc(), capacity)); 839 wd_files_index_level = 0; 840 841 wd_files_index_hash = wi_autorelease(wi_hash_init_with_capacity_and_callbacks(wi_hash_alloc(), 0, 842 wi_hash_null_key_callbacks, wi_hash_default_value_callbacks)); 851 843 852 844 path = wi_string_with_format(WI_STR("%@~"), wd_settings.index); … … 910 902 WI_FTSENT *p; 911 903 wi_string_t *filepath, *virtualpath, *string; 904 wi_set_t *set; 912 905 wi_number_t *number; 913 906 wi_file_offset_t size; … … 1019 1012 1020 1013 /* track unique inodes */ 1014 set = wi_hash_data_for_key(wd_files_index_hash, (void *) sb.dev); 1015 1016 if(!set) { 1017 set = wi_set_init_with_capacity(wi_set_alloc(), 1000); 1018 wi_hash_set_data_for_key(wd_files_index_hash, set, (void *) sb.dev); 1019 wi_release(set); 1020 } 1021 1021 1022 number = wi_number_with_value(WI_NUMBER_INT64, &sb.ino); 1022 1023 1023 if(!wi_set_contains_data( wd_files_index_set, number)) {1024 if(!wi_set_contains_data(set, number)) { 1024 1025 if(S_ISDIR(sb.mode)) { 1025 1026 wd_directories_unique_count++; … … 1029 1030 } 1030 1031 1031 wi_set_add_data( wd_files_index_set, number);1032 wi_set_add_data(set, number); 1032 1033 } 1033 1034
