儲存庫 kBuild 的更動 1913
- 時間撮記:
- 2008-10-22 下午09:24:04 (16 年 以前)
- 位置:
- trunk/src/kmk
- 檔案:
-
- 修改 6 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/kmk/dir.c
r1902 r1913 291 291 ISTRING_HASH_2 (key->path_key, hash); 292 292 # else /* CONFIG_WITH_STRCACHE2 */ 293 hash = strcache2_get_hash 1(&file_strcache, key->path_key);293 hash = strcache2_get_hash (&file_strcache, key->path_key); 294 294 # endif /* CONFIG_WITH_STRCACHE2 */ 295 295 hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) ~key->ctime; -
trunk/src/kmk/hash.c
r1902 r1913 213 213 /* the rest of the loop. */ 214 214 215 hash_2 = strcache2_get_hash 1(ht->ht_strcache, str1) | 1;215 hash_2 = strcache2_get_hash (ht->ht_strcache, str1) | 1; 216 216 hash_1 += hash_2; 217 217 for (;;) -
trunk/src/kmk/incdep.c
r1912 r1913 769 769 { 770 770 if (!entry->user) 771 entry->user = (void *)strcache2_add_hashed_file (&file_strcache, 772 (const char *)(entry + 1), 773 entry->length, 774 entry->hash1, 775 1); 771 entry->user = (void *) strcache2_add_hashed_file (&file_strcache, 772 (const char *)(entry + 1), 773 entry->length, entry->hash); 776 774 return (const char *)entry->user; 777 775 } -
trunk/src/kmk/strcache2.c
r1912 r1913 512 512 MY_INLINE int 513 513 strcache2_is_equal (struct strcache2 *cache, struct strcache2_entry const *entry, 514 const char *str, unsigned int length, unsigned int hash 1)514 const char *str, unsigned int length, unsigned int hash) 515 515 { 516 516 assert (!cache->case_insensitive); 517 517 518 518 /* the simple stuff first. */ 519 if ( entry->hash 1 != hash1519 if ( entry->hash != hash 520 520 || entry->length != length) 521 521 return 0; … … 532 532 MY_INLINE int 533 533 strcache2_is_iequal (struct strcache2 *cache, struct strcache2_entry const *entry, 534 const char *str, unsigned int length, unsigned int hash 1)534 const char *str, unsigned int length, unsigned int hash) 535 535 { 536 536 assert (cache->case_insensitive); 537 537 538 538 /* the simple stuff first. */ 539 if ( entry->hash 1 != hash1539 if ( entry->hash != hash 540 540 || entry->length != length) 541 541 return 0; … … 581 581 { 582 582 struct strcache2_entry *next = entry->next; 583 unsigned int dst = STRCACHE2_MOD_IT (cache, entry->hash 1);583 unsigned int dst = STRCACHE2_MOD_IT (cache, entry->hash); 584 584 if ((entry->next = dst_tab[dst]) != 0) 585 585 cache->collision_count++; … … 631 631 strcache2_enter_string (struct strcache2 *cache, unsigned int idx, 632 632 const char *str, unsigned int length, 633 unsigned int hash 1, unsigned hash2)633 unsigned int hash) 634 634 { 635 635 struct strcache2_entry *entry; … … 662 662 entry->user = NULL; 663 663 entry->length = length; 664 entry->hash 1 = hash1;664 entry->hash = hash; 665 665 str_copy = (char *) memcpy (entry + 1, str, length); 666 666 str_copy[length] = '\0'; … … 681 681 { 682 682 struct strcache2_entry const *entry; 683 unsigned int hash1 = strcache2_case_sensitive_hash_1 (str, length); 684 unsigned int hash2 = 0; 683 unsigned int hash = strcache2_case_sensitive_hash_1 (str, length); 685 684 unsigned int idx; 686 685 … … 691 690 /* Lookup the entry in the hash table, hoping for an 692 691 early match. If not found, enter the string at IDX. */ 693 idx = STRCACHE2_MOD_IT (cache, hash 1);692 idx = STRCACHE2_MOD_IT (cache, hash); 694 693 entry = cache->hash_tab[idx]; 695 694 if (!entry) 696 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);697 if (strcache2_is_equal (cache, entry, str, length, hash 1))695 return strcache2_enter_string (cache, idx, str, length, hash); 696 if (strcache2_is_equal (cache, entry, str, length, hash)) 698 697 return (const char *)(entry + 1); 699 698 cache->collision_1st_count++; … … 701 700 entry = entry->next; 702 701 if (!entry) 703 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);704 if (strcache2_is_equal (cache, entry, str, length, hash 1))702 return strcache2_enter_string (cache, idx, str, length, hash); 703 if (strcache2_is_equal (cache, entry, str, length, hash)) 705 704 return (const char *)(entry + 1); 706 705 cache->collision_2nd_count++; 707 706 708 /* (We've established hash2, so we can do a straight loop now.)*/707 /* Loop the rest. */ 709 708 for (;;) 710 709 { 711 710 entry = entry->next; 712 711 if (!entry) 713 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);714 if (strcache2_is_equal (cache, entry, str, length, hash 1))712 return strcache2_enter_string (cache, idx, str, length, hash); 713 if (strcache2_is_equal (cache, entry, str, length, hash)) 715 714 return (const char *)(entry + 1); 716 715 cache->collision_3rd_count++; … … 722 721 Use strcache2_hash_str to calculate the hash of a string. */ 723 722 const char * 724 strcache2_add_hashed (struct strcache2 *cache, const char *str, unsigned int length,725 unsigned int hash1, unsigned int hash2)723 strcache2_add_hashed (struct strcache2 *cache, const char *str, 724 unsigned int length, unsigned int hash) 726 725 { 727 726 struct strcache2_entry const *entry; … … 732 731 assert (!cache->case_insensitive); 733 732 correct_hash = strcache2_case_sensitive_hash_1 (str, length); 734 MY_ASSERT_MSG (hash1 == correct_hash, ("%#x != %#x\n", hash1, correct_hash)); 735 if (hash2) 736 { 737 correct_hash = strcache2_case_sensitive_hash_2 (str, length); 738 MY_ASSERT_MSG (hash2 == correct_hash, ("%#x != %#x\n", hash2, correct_hash)); 739 } 733 MY_ASSERT_MSG (hash == correct_hash, ("%#x != %#x\n", hash, correct_hash)); 740 734 #endif /* NDEBUG */ 741 735 … … 744 738 /* Lookup the entry in the hash table, hoping for an 745 739 early match. If not found, enter the string at IDX. */ 746 idx = STRCACHE2_MOD_IT (cache, hash 1);740 idx = STRCACHE2_MOD_IT (cache, hash); 747 741 entry = cache->hash_tab[idx]; 748 742 if (!entry) 749 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);750 if (strcache2_is_equal (cache, entry, str, length, hash 1))743 return strcache2_enter_string (cache, idx, str, length, hash); 744 if (strcache2_is_equal (cache, entry, str, length, hash)) 751 745 return (const char *)(entry + 1); 752 746 cache->collision_1st_count++; … … 754 748 entry = entry->next; 755 749 if (!entry) 756 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);757 if (strcache2_is_equal (cache, entry, str, length, hash 1))750 return strcache2_enter_string (cache, idx, str, length, hash); 751 if (strcache2_is_equal (cache, entry, str, length, hash)) 758 752 return (const char *)(entry + 1); 759 753 cache->collision_2nd_count++; 760 754 761 /* (We've established hash2, so we can do a straight loop now.)*/755 /* Loop the rest. */ 762 756 for (;;) 763 757 { 764 758 entry = entry->next; 765 759 if (!entry) 766 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);767 if (strcache2_is_equal (cache, entry, str, length, hash 1))760 return strcache2_enter_string (cache, idx, str, length, hash); 761 if (strcache2_is_equal (cache, entry, str, length, hash)) 768 762 return (const char *)(entry + 1); 769 763 cache->collision_3rd_count++; … … 777 771 { 778 772 struct strcache2_entry const *entry; 779 unsigned int hash 1= strcache2_case_sensitive_hash_1 (str, length);773 unsigned int hash = strcache2_case_sensitive_hash_1 (str, length); 780 774 unsigned int idx; 781 775 … … 786 780 /* Lookup the entry in the hash table, hoping for an 787 781 early match. */ 788 idx = STRCACHE2_MOD_IT (cache, hash 1);782 idx = STRCACHE2_MOD_IT (cache, hash); 789 783 entry = cache->hash_tab[idx]; 790 784 if (!entry) 791 785 return NULL; 792 if (strcache2_is_equal (cache, entry, str, length, hash 1))786 if (strcache2_is_equal (cache, entry, str, length, hash)) 793 787 return (const char *)(entry + 1); 794 788 cache->collision_1st_count++; … … 797 791 if (!entry) 798 792 return NULL; 799 if (strcache2_is_equal (cache, entry, str, length, hash 1))793 if (strcache2_is_equal (cache, entry, str, length, hash)) 800 794 return (const char *)(entry + 1); 801 795 cache->collision_2nd_count++; 802 796 803 /* (We've established hash2, so we can do a straight loop now.)*/797 /* Loop the rest. */ 804 798 for (;;) 805 799 { … … 807 801 if (!entry) 808 802 return NULL; 809 if (strcache2_is_equal (cache, entry, str, length, hash 1))803 if (strcache2_is_equal (cache, entry, str, length, hash)) 810 804 return (const char *)(entry + 1); 811 805 cache->collision_3rd_count++; … … 821 815 { 822 816 struct strcache2_entry const *entry; 823 unsigned int hash1 = strcache2_case_insensitive_hash_1 (str, length); 824 unsigned int hash2 = 0; 817 unsigned int hash = strcache2_case_insensitive_hash_1 (str, length); 825 818 unsigned int idx; 826 819 … … 831 824 /* Lookup the entry in the hash table, hoping for an 832 825 early match. If not found, enter the string at IDX. */ 833 idx = STRCACHE2_MOD_IT (cache, hash 1);826 idx = STRCACHE2_MOD_IT (cache, hash); 834 827 entry = cache->hash_tab[idx]; 835 828 if (!entry) 836 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);837 if (strcache2_is_equal (cache, entry, str, length, hash 1))829 return strcache2_enter_string (cache, idx, str, length, hash); 830 if (strcache2_is_equal (cache, entry, str, length, hash)) 838 831 return (const char *)(entry + 1); 839 832 cache->collision_1st_count++; … … 841 834 entry = entry->next; 842 835 if (!entry) 843 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);844 if (strcache2_is_equal (cache, entry, str, length, hash 1))836 return strcache2_enter_string (cache, idx, str, length, hash); 837 if (strcache2_is_equal (cache, entry, str, length, hash)) 845 838 return (const char *)(entry + 1); 846 839 cache->collision_2nd_count++; 847 840 848 /* (We've established hash2, so we can do a straight loop now.)*/841 /* Loop the rest. */ 849 842 for (;;) 850 843 { 851 844 entry = entry->next; 852 845 if (!entry) 853 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);854 if (strcache2_is_equal (cache, entry, str, length, hash 1))846 return strcache2_enter_string (cache, idx, str, length, hash); 847 if (strcache2_is_equal (cache, entry, str, length, hash)) 855 848 return (const char *)(entry + 1); 856 849 cache->collision_3rd_count++; … … 862 855 Use strcache2_hash_istr to calculate the hash of a string. */ 863 856 const char * 864 strcache2_iadd_hashed (struct strcache2 *cache, const char *str, unsigned int length,865 unsigned int hash1, unsigned int hash2)857 strcache2_iadd_hashed (struct strcache2 *cache, const char *str, 858 unsigned int length, unsigned int hash) 866 859 { 867 860 struct strcache2_entry const *entry; … … 872 865 assert (!cache->case_insensitive); 873 866 correct_hash = strcache2_case_insensitive_hash_1 (str, length); 874 MY_ASSERT_MSG (hash1 == correct_hash, ("%#x != %#x\n", hash1, correct_hash)); 875 if (hash2) 876 { 877 correct_hash = strcache2_case_insensitive_hash_2 (str, length); 878 MY_ASSERT_MSG (hash2 == correct_hash, ("%#x != %#x\n", hash2, correct_hash)); 879 } 867 MY_ASSERT_MSG (hash == correct_hash, ("%#x != %#x\n", hash, correct_hash)); 880 868 #endif /* NDEBUG */ 881 869 … … 884 872 /* Lookup the entry in the hash table, hoping for an 885 873 early match. If not found, enter the string at IDX. */ 886 idx = STRCACHE2_MOD_IT (cache, hash 1);874 idx = STRCACHE2_MOD_IT (cache, hash); 887 875 entry = cache->hash_tab[idx]; 888 876 if (!entry) 889 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);890 if (strcache2_is_equal (cache, entry, str, length, hash 1))877 return strcache2_enter_string (cache, idx, str, length, hash); 878 if (strcache2_is_equal (cache, entry, str, length, hash)) 891 879 return (const char *)(entry + 1); 892 880 cache->collision_1st_count++; … … 894 882 entry = entry->next; 895 883 if (!entry) 896 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);897 if (strcache2_is_equal (cache, entry, str, length, hash 1))884 return strcache2_enter_string (cache, idx, str, length, hash); 885 if (strcache2_is_equal (cache, entry, str, length, hash)) 898 886 return (const char *)(entry + 1); 899 887 cache->collision_2nd_count++; 900 888 901 /* (We've established hash2, so we can do a straight loop now.)*/889 /* Loop the rest. */ 902 890 for (;;) 903 891 { 904 892 entry = entry->next; 905 893 if (!entry) 906 return strcache2_enter_string (cache, idx, str, length, hash 1, hash2);907 if (strcache2_is_equal (cache, entry, str, length, hash 1))894 return strcache2_enter_string (cache, idx, str, length, hash); 895 if (strcache2_is_equal (cache, entry, str, length, hash)) 908 896 return (const char *)(entry + 1); 909 897 cache->collision_3rd_count++; … … 917 905 { 918 906 struct strcache2_entry const *entry; 919 unsigned int hash 1= strcache2_case_insensitive_hash_1 (str, length);907 unsigned int hash = strcache2_case_insensitive_hash_1 (str, length); 920 908 unsigned int idx; 921 909 … … 926 914 /* Lookup the entry in the hash table, hoping for an 927 915 early match. */ 928 idx = STRCACHE2_MOD_IT (cache, hash 1);916 idx = STRCACHE2_MOD_IT (cache, hash); 929 917 entry = cache->hash_tab[idx]; 930 918 if (!entry) 931 919 return NULL; 932 if (strcache2_is_equal (cache, entry, str, length, hash 1))920 if (strcache2_is_equal (cache, entry, str, length, hash)) 933 921 return (const char *)(entry + 1); 934 922 cache->collision_1st_count++; … … 937 925 if (!entry) 938 926 return NULL; 939 if (strcache2_is_equal (cache, entry, str, length, hash 1))927 if (strcache2_is_equal (cache, entry, str, length, hash)) 940 928 return (const char *)(entry + 1); 941 929 cache->collision_2nd_count++; 942 930 943 /* (We've established hash2, so we can do a straight loop now.)*/931 /* Loop the rest. */ 944 932 for (;;) 945 933 { … … 947 935 if (!entry) 948 936 return NULL; 949 if (strcache2_is_equal (cache, entry, str, length, hash 1))937 if (strcache2_is_equal (cache, entry, str, length, hash)) 950 938 return (const char *)(entry + 1); 951 939 cache->collision_3rd_count++; … … 1004 992 ? strcache2_case_insensitive_hash_1 (str, entry->length) 1005 993 : strcache2_case_sensitive_hash_1 (str, entry->length); 1006 if (hash != entry->hash 1)994 if (hash != entry->hash) 1007 995 { 1008 996 fprintf (stderr, 1009 997 "strcache2[%s]: corrupt entry %p, hash#1: %x, expected %x;\nstring: %s\n", 1010 cache->name, (void *)entry, hash, entry->hash 1, str);998 cache->name, (void *)entry, hash, entry->hash, str); 1011 999 return -1; 1012 1000 } -
trunk/src/kmk/strcache2.h
r1912 r1913 49 49 struct strcache2_entry *next; /* Collision chain. */ 50 50 void *user; 51 unsigned int hash 1;51 unsigned int hash; 52 52 unsigned int length; 53 53 }; … … 102 102 const char *strcache2_add (struct strcache2 *cache, const char *str, unsigned int length); 103 103 const char *strcache2_iadd (struct strcache2 *cache, const char *str, unsigned int length); 104 const char *strcache2_add_hashed (struct strcache2 *cache, const char *str, unsigned int length,105 unsigned int hash1, unsigned int hash2);106 const char *strcache2_iadd_hashed (struct strcache2 *cache, const char *str, unsigned int length,107 unsigned int hash1, unsigned int hash2);104 const char *strcache2_add_hashed (struct strcache2 *cache, const char *str, 105 unsigned int length, unsigned int hash); 106 const char *strcache2_iadd_hashed (struct strcache2 *cache, const char *str, 107 unsigned int length, unsigned int hash); 108 108 const char *strcache2_lookup (struct strcache2 *cache, const char *str, unsigned int length); 109 109 const char *strcache2_ilookup (struct strcache2 *cache, const char *str, unsigned int length); … … 142 142 /* Get the first hash value for the string. */ 143 143 MY_INLINE unsigned int 144 strcache2_get_hash 1(struct strcache2 *cache, const char *str)144 strcache2_get_hash (struct strcache2 *cache, const char *str) 145 145 { 146 return strcache2_get_entry (cache, str)->hash 1;146 return strcache2_get_entry (cache, str)->hash; 147 147 } 148 148 -
trunk/src/kmk/variable.c
r1907 r1913 475 475 476 476 /* the rest of the loop */ 477 hash_2 = strcache2_get_hash 1(&variable_strcache, name) | 1;477 hash_2 = strcache2_get_hash (&variable_strcache, name) | 1; 478 478 for (;;) 479 479 { … … 491 491 } 492 492 else 493 hash_2 = strcache2_get_hash 1(&variable_strcache, name) | 1;493 hash_2 = strcache2_get_hash (&variable_strcache, name) | 1; 494 494 495 495
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器