VirtualBox

儲存庫 kBuild 的更動 1913


忽略:
時間撮記:
2008-10-22 下午09:24:04 (16 年 以前)
作者:
bird
訊息:

strcache2: hash1 -> hash; -hash2.

位置:
trunk/src/kmk
檔案:
修改 6 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/kmk/dir.c

    r1902 r1913  
    291291  ISTRING_HASH_2 (key->path_key, hash);
    292292# else  /* CONFIG_WITH_STRCACHE2 */
    293   hash = strcache2_get_hash1 (&file_strcache, key->path_key);
     293  hash = strcache2_get_hash (&file_strcache, key->path_key);
    294294# endif /* CONFIG_WITH_STRCACHE2 */
    295295  hash ^= ((unsigned int) key->dev << 4) ^ (unsigned int) ~key->ctime;
  • trunk/src/kmk/hash.c

    r1902 r1913  
    213213  /* the rest of the loop. */
    214214
    215   hash_2 = strcache2_get_hash1 (ht->ht_strcache, str1) | 1;
     215  hash_2 = strcache2_get_hash (ht->ht_strcache, str1) | 1;
    216216  hash_1 += hash_2;
    217217  for (;;)
  • trunk/src/kmk/incdep.c

    r1912 r1913  
    769769{
    770770  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);
    776774  return (const char *)entry->user;
    777775}
  • trunk/src/kmk/strcache2.c

    r1912 r1913  
    512512MY_INLINE int
    513513strcache2_is_equal (struct strcache2 *cache, struct strcache2_entry const *entry,
    514                     const char *str, unsigned int length, unsigned int hash1)
     514                    const char *str, unsigned int length, unsigned int hash)
    515515{
    516516  assert (!cache->case_insensitive);
    517517
    518518  /* the simple stuff first. */
    519   if (   entry->hash1 != hash1
     519  if (   entry->hash != hash
    520520      || entry->length != length)
    521521      return 0;
     
    532532MY_INLINE int
    533533strcache2_is_iequal (struct strcache2 *cache, struct strcache2_entry const *entry,
    534                      const char *str, unsigned int length, unsigned int hash1)
     534                     const char *str, unsigned int length, unsigned int hash)
    535535{
    536536  assert (cache->case_insensitive);
    537537
    538538  /* the simple stuff first. */
    539   if (   entry->hash1 != hash1
     539  if (   entry->hash != hash
    540540      || entry->length != length)
    541541      return 0;
     
    581581        {
    582582          struct strcache2_entry *next = entry->next;
    583           unsigned int dst = STRCACHE2_MOD_IT (cache, entry->hash1);
     583          unsigned int dst = STRCACHE2_MOD_IT (cache, entry->hash);
    584584          if ((entry->next = dst_tab[dst]) != 0)
    585585            cache->collision_count++;
     
    631631strcache2_enter_string (struct strcache2 *cache, unsigned int idx,
    632632                        const char *str, unsigned int length,
    633                         unsigned int hash1, unsigned hash2)
     633                        unsigned int hash)
    634634{
    635635  struct strcache2_entry *entry;
     
    662662  entry->user = NULL;
    663663  entry->length = length;
    664   entry->hash1 = hash1;
     664  entry->hash = hash;
    665665  str_copy = (char *) memcpy (entry + 1, str, length);
    666666  str_copy[length] = '\0';
     
    681681{
    682682  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);
    685684  unsigned int idx;
    686685
     
    691690  /* Lookup the entry in the hash table, hoping for an
    692691     early match.  If not found, enter the string at IDX. */
    693   idx = STRCACHE2_MOD_IT (cache, hash1);
     692  idx = STRCACHE2_MOD_IT (cache, hash);
    694693  entry = cache->hash_tab[idx];
    695694  if (!entry)
    696     return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    697   if (strcache2_is_equal (cache, entry, str, length, hash1))
     695    return strcache2_enter_string (cache, idx, str, length, hash);
     696  if (strcache2_is_equal (cache, entry, str, length, hash))
    698697    return (const char *)(entry + 1);
    699698  cache->collision_1st_count++;
     
    701700  entry = entry->next;
    702701  if (!entry)
    703     return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    704   if (strcache2_is_equal (cache, entry, str, length, hash1))
     702    return strcache2_enter_string (cache, idx, str, length, hash);
     703  if (strcache2_is_equal (cache, entry, str, length, hash))
    705704    return (const char *)(entry + 1);
    706705  cache->collision_2nd_count++;
    707706
    708   /* (We've established hash2, so we can do a straight loop now.)  */
     707  /* Loop the rest.  */
    709708  for (;;)
    710709    {
    711710      entry = entry->next;
    712711      if (!entry)
    713         return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    714       if (strcache2_is_equal (cache, entry, str, length, hash1))
     712        return strcache2_enter_string (cache, idx, str, length, hash);
     713      if (strcache2_is_equal (cache, entry, str, length, hash))
    715714        return (const char *)(entry + 1);
    716715      cache->collision_3rd_count++;
     
    722721   Use strcache2_hash_str to calculate the hash of a string. */
    723722const char *
    724 strcache2_add_hashed (struct strcache2 *cache, const char *str, unsigned int length,
    725                       unsigned int hash1, unsigned int hash2)
     723strcache2_add_hashed (struct strcache2 *cache, const char *str,
     724                      unsigned int length, unsigned int hash)
    726725{
    727726  struct strcache2_entry const *entry;
     
    732731  assert (!cache->case_insensitive);
    733732  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));
    740734#endif /* NDEBUG */
    741735
     
    744738  /* Lookup the entry in the hash table, hoping for an
    745739     early match.  If not found, enter the string at IDX. */
    746   idx = STRCACHE2_MOD_IT (cache, hash1);
     740  idx = STRCACHE2_MOD_IT (cache, hash);
    747741  entry = cache->hash_tab[idx];
    748742  if (!entry)
    749     return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    750   if (strcache2_is_equal (cache, entry, str, length, hash1))
     743    return strcache2_enter_string (cache, idx, str, length, hash);
     744  if (strcache2_is_equal (cache, entry, str, length, hash))
    751745    return (const char *)(entry + 1);
    752746  cache->collision_1st_count++;
     
    754748  entry = entry->next;
    755749  if (!entry)
    756     return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    757   if (strcache2_is_equal (cache, entry, str, length, hash1))
     750    return strcache2_enter_string (cache, idx, str, length, hash);
     751  if (strcache2_is_equal (cache, entry, str, length, hash))
    758752    return (const char *)(entry + 1);
    759753  cache->collision_2nd_count++;
    760754
    761   /* (We've established hash2, so we can do a straight loop now.)  */
     755  /* Loop the rest.  */
    762756  for (;;)
    763757    {
    764758      entry = entry->next;
    765759      if (!entry)
    766         return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    767       if (strcache2_is_equal (cache, entry, str, length, hash1))
     760        return strcache2_enter_string (cache, idx, str, length, hash);
     761      if (strcache2_is_equal (cache, entry, str, length, hash))
    768762        return (const char *)(entry + 1);
    769763      cache->collision_3rd_count++;
     
    777771{
    778772  struct strcache2_entry const *entry;
    779   unsigned int hash1 = strcache2_case_sensitive_hash_1 (str, length);
     773  unsigned int hash = strcache2_case_sensitive_hash_1 (str, length);
    780774  unsigned int idx;
    781775
     
    786780  /* Lookup the entry in the hash table, hoping for an
    787781     early match. */
    788   idx = STRCACHE2_MOD_IT (cache, hash1);
     782  idx = STRCACHE2_MOD_IT (cache, hash);
    789783  entry = cache->hash_tab[idx];
    790784  if (!entry)
    791785    return NULL;
    792   if (strcache2_is_equal (cache, entry, str, length, hash1))
     786  if (strcache2_is_equal (cache, entry, str, length, hash))
    793787    return (const char *)(entry + 1);
    794788  cache->collision_1st_count++;
     
    797791  if (!entry)
    798792    return NULL;
    799   if (strcache2_is_equal (cache, entry, str, length, hash1))
     793  if (strcache2_is_equal (cache, entry, str, length, hash))
    800794    return (const char *)(entry + 1);
    801795  cache->collision_2nd_count++;
    802796
    803   /* (We've established hash2, so we can do a straight loop now.) */
     797  /* Loop the rest. */
    804798  for (;;)
    805799    {
     
    807801      if (!entry)
    808802        return NULL;
    809       if (strcache2_is_equal (cache, entry, str, length, hash1))
     803      if (strcache2_is_equal (cache, entry, str, length, hash))
    810804        return (const char *)(entry + 1);
    811805      cache->collision_3rd_count++;
     
    821815{
    822816  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);
    825818  unsigned int idx;
    826819
     
    831824  /* Lookup the entry in the hash table, hoping for an
    832825     early match.  If not found, enter the string at IDX. */
    833   idx = STRCACHE2_MOD_IT (cache, hash1);
     826  idx = STRCACHE2_MOD_IT (cache, hash);
    834827  entry = cache->hash_tab[idx];
    835828  if (!entry)
    836     return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    837   if (strcache2_is_equal (cache, entry, str, length, hash1))
     829    return strcache2_enter_string (cache, idx, str, length, hash);
     830  if (strcache2_is_equal (cache, entry, str, length, hash))
    838831    return (const char *)(entry + 1);
    839832  cache->collision_1st_count++;
     
    841834  entry = entry->next;
    842835  if (!entry)
    843     return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    844   if (strcache2_is_equal (cache, entry, str, length, hash1))
     836    return strcache2_enter_string (cache, idx, str, length, hash);
     837  if (strcache2_is_equal (cache, entry, str, length, hash))
    845838    return (const char *)(entry + 1);
    846839  cache->collision_2nd_count++;
    847840
    848   /* (We've established hash2, so we can do a straight loop now.) */
     841  /* Loop the rest. */
    849842  for (;;)
    850843    {
    851844      entry = entry->next;
    852845      if (!entry)
    853         return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    854       if (strcache2_is_equal (cache, entry, str, length, hash1))
     846        return strcache2_enter_string (cache, idx, str, length, hash);
     847      if (strcache2_is_equal (cache, entry, str, length, hash))
    855848        return (const char *)(entry + 1);
    856849      cache->collision_3rd_count++;
     
    862855   Use strcache2_hash_istr to calculate the hash of a string. */
    863856const char *
    864 strcache2_iadd_hashed (struct strcache2 *cache, const char *str, unsigned int length,
    865                        unsigned int hash1, unsigned int hash2)
     857strcache2_iadd_hashed (struct strcache2 *cache, const char *str,
     858                       unsigned int length, unsigned int hash)
    866859{
    867860  struct strcache2_entry const *entry;
     
    872865  assert (!cache->case_insensitive);
    873866  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));
    880868#endif /* NDEBUG */
    881869
     
    884872  /* Lookup the entry in the hash table, hoping for an
    885873     early match.  If not found, enter the string at IDX. */
    886   idx = STRCACHE2_MOD_IT (cache, hash1);
     874  idx = STRCACHE2_MOD_IT (cache, hash);
    887875  entry = cache->hash_tab[idx];
    888876  if (!entry)
    889     return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    890   if (strcache2_is_equal (cache, entry, str, length, hash1))
     877    return strcache2_enter_string (cache, idx, str, length, hash);
     878  if (strcache2_is_equal (cache, entry, str, length, hash))
    891879    return (const char *)(entry + 1);
    892880  cache->collision_1st_count++;
     
    894882  entry = entry->next;
    895883  if (!entry)
    896     return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    897   if (strcache2_is_equal (cache, entry, str, length, hash1))
     884    return strcache2_enter_string (cache, idx, str, length, hash);
     885  if (strcache2_is_equal (cache, entry, str, length, hash))
    898886    return (const char *)(entry + 1);
    899887  cache->collision_2nd_count++;
    900888
    901   /* (We've established hash2, so we can do a straight loop now.) */
     889  /* Loop the rest. */
    902890  for (;;)
    903891    {
    904892      entry = entry->next;
    905893      if (!entry)
    906         return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
    907       if (strcache2_is_equal (cache, entry, str, length, hash1))
     894        return strcache2_enter_string (cache, idx, str, length, hash);
     895      if (strcache2_is_equal (cache, entry, str, length, hash))
    908896        return (const char *)(entry + 1);
    909897      cache->collision_3rd_count++;
     
    917905{
    918906  struct strcache2_entry const *entry;
    919   unsigned int hash1 = strcache2_case_insensitive_hash_1 (str, length);
     907  unsigned int hash = strcache2_case_insensitive_hash_1 (str, length);
    920908  unsigned int idx;
    921909
     
    926914  /* Lookup the entry in the hash table, hoping for an
    927915     early match. */
    928   idx = STRCACHE2_MOD_IT (cache, hash1);
     916  idx = STRCACHE2_MOD_IT (cache, hash);
    929917  entry = cache->hash_tab[idx];
    930918  if (!entry)
    931919    return NULL;
    932   if (strcache2_is_equal (cache, entry, str, length, hash1))
     920  if (strcache2_is_equal (cache, entry, str, length, hash))
    933921    return (const char *)(entry + 1);
    934922  cache->collision_1st_count++;
     
    937925  if (!entry)
    938926    return NULL;
    939   if (strcache2_is_equal (cache, entry, str, length, hash1))
     927  if (strcache2_is_equal (cache, entry, str, length, hash))
    940928    return (const char *)(entry + 1);
    941929  cache->collision_2nd_count++;
    942930
    943   /* (We've established hash2, so we can do a straight loop now.) */
     931  /* Loop the rest. */
    944932  for (;;)
    945933    {
     
    947935      if (!entry)
    948936        return NULL;
    949       if (strcache2_is_equal (cache, entry, str, length, hash1))
     937      if (strcache2_is_equal (cache, entry, str, length, hash))
    950938        return (const char *)(entry + 1);
    951939      cache->collision_3rd_count++;
     
    1004992    ? strcache2_case_insensitive_hash_1 (str, entry->length)
    1005993    : strcache2_case_sensitive_hash_1 (str, entry->length);
    1006   if (hash != entry->hash1)
     994  if (hash != entry->hash)
    1007995    {
    1008996      fprintf (stderr,
    1009997               "strcache2[%s]: corrupt entry %p, hash#1: %x, expected %x;\nstring: %s\n",
    1010                cache->name, (void *)entry, hash, entry->hash1, str);
     998               cache->name, (void *)entry, hash, entry->hash, str);
    1011999      return -1;
    10121000    }
  • trunk/src/kmk/strcache2.h

    r1912 r1913  
    4949    struct strcache2_entry *next;       /* Collision chain. */
    5050    void *user;
    51     unsigned int hash1;
     51    unsigned int hash;
    5252    unsigned int length;
    5353};
     
    102102const char *strcache2_add (struct strcache2 *cache, const char *str, unsigned int length);
    103103const 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);
     104const char *strcache2_add_hashed (struct strcache2 *cache, const char *str,
     105                                  unsigned int length, unsigned int hash);
     106const char *strcache2_iadd_hashed (struct strcache2 *cache, const char *str,
     107                                   unsigned int length, unsigned int hash);
    108108const char *strcache2_lookup (struct strcache2 *cache, const char *str, unsigned int length);
    109109const char *strcache2_ilookup (struct strcache2 *cache, const char *str, unsigned int length);
     
    142142/* Get the first hash value for the string. */
    143143MY_INLINE unsigned int
    144 strcache2_get_hash1 (struct strcache2 *cache, const char *str)
     144strcache2_get_hash (struct strcache2 *cache, const char *str)
    145145{
    146   return strcache2_get_entry (cache, str)->hash1;
     146  return strcache2_get_entry (cache, str)->hash;
    147147}
    148148
  • trunk/src/kmk/variable.c

    r1907 r1913  
    475475
    476476      /* the rest of the loop  */
    477       hash_2 = strcache2_get_hash1 (&variable_strcache, name) | 1;
     477      hash_2 = strcache2_get_hash (&variable_strcache, name) | 1;
    478478      for (;;)
    479479        {
     
    491491    }
    492492  else
    493     hash_2 = strcache2_get_hash1 (&variable_strcache, name) | 1;
     493    hash_2 = strcache2_get_hash (&variable_strcache, name) | 1;
    494494
    495495
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette