Changeset 4291
- Timestamp:
- 06/10/06 14:23:44 (2 years ago)
- Files:
-
- wired/trunk/NEWS (modified) (1 diff)
- wired/trunk/wired/files.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wired/trunk/NEWS
r4222 r4291 5 5 - Fix problem with main thread hanging after registering with a tracker sometimes 6 6 - Fixed an issue where, for some types of crashes, wired.pid was not removed at exit 7 - Optimize indexed searches 7 8 8 9 1.3 wired/trunk/wired/files.c
r4286 r4291 657 657 static void wd_files_search_index(wi_string_t *query) { 658 658 wd_client_t *client = wd_client(); 659 wi_pool_t *pool = NULL; 659 660 wi_file_t *file; 660 wi_string_t *string, *name; 661 unsigned int pathlength, index; 661 wi_string_t *string; 662 wi_range_t range; 663 unsigned int i = 0, pathlength, index; 662 664 663 665 wi_rwlock_rdlock(wd_files_index_lock); … … 677 679 pathlength = 0; 678 680 679 while((string = wi_file_read_line(file))) { 681 range.location = 0; 682 683 while(true) { 684 if(!pool) 685 pool = wi_pool_init(wi_pool_alloc()); 686 687 string = wi_file_read_line(file); 688 689 if(!string) 690 break; 691 680 692 index = wi_string_index_of_char(string, WD_FIELD_SEPARATOR, 0); 681 693 682 694 if(index != WI_NOT_FOUND) { 683 name = wi_string_substring_to_index(string, index);684 685 if(wi_string_ contains_string(name, query, WI_STRING_CASE_INSENSITIVE)) {695 range.length = index; 696 697 if(wi_string_index_of_string_in_range(string, query, WI_STRING_CASE_INSENSITIVE, range) != WI_NOT_FOUND) { 686 698 wi_string_delete_characters_to_index(string, index + pathlength + 1); 687 699 … … 689 701 } 690 702 } 691 } 703 704 if(++i % 100 == 0) { 705 wi_release(pool); 706 pool = NULL; 707 } 708 } 709 710 wi_release(pool); 692 711 693 712 end:
