Changeset 1895 for trunk/src/kmk/make.h
- Timestamp:
- Oct 21, 2008, 2:48:25 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/make.h
r1893 r1895 593 593 const char *strcache_add_len (const char *str, int len); 594 594 int strcache_setbufsize (int size); 595 # ifdef CONFIG_WITH_INCLUDEDEP596 const char *strcache_add_prehashed (const char *str, int len,597 unsigned long hash1, unsigned long hash2);598 void strcache_prehash_str (const char *str, unsigned int len, unsigned long *hash1p,599 unsigned long *hash2p);600 #endif601 #ifdef CONFIG_WITH_VALUE_LENGTH602 struct strcache_pref603 {604 unsigned long hash1;605 unsigned long hash2;606 unsigned int len;607 };608 609 int strcache_check_sanity (const char *str);610 unsigned long strcache_get_hash2_fallback (const char *str);611 612 MY_INLINE unsigned int strcache_get_len (const char *str)613 {614 struct strcache_pref const *prefix = (struct strcache_pref const *)str - 1;615 unsigned int len = prefix->len;616 MY_ASSERT_MSG (strcache_check_sanity (str) == 0, ("!\n"));617 return len;618 }619 620 /* FIXME: make a 2nd version of this which uses the unique string address, it621 is more efficient than the string hash we calculate on most systems. */622 MY_INLINE unsigned int strcache_get_hash1 (const char *str)623 {624 struct strcache_pref const *prefix = (struct strcache_pref const *)str - 1;625 unsigned long hash1 = prefix->hash1;626 MY_ASSERT_MSG (strcache_check_sanity (str) == 0, ("!\n"));627 return hash1;628 }629 630 MY_INLINE unsigned long strcache_get_hash2 (const char *str)631 {632 struct strcache_pref const *prefix = (struct strcache_pref const *)str - 1;633 unsigned long hash2 = prefix->hash2;634 MY_ASSERT_MSG (strcache_check_sanity (str) == 0, ("!\n"));635 if (!hash2)636 return strcache_get_hash2_fallback (str);637 return hash2;638 }639 640 # endif /* CONFIG_WITH_VALUE_LENGTH*/641 642 595 #else /* CONFIG_WITH_STRCACHE2 */ 643 596 … … 648 601 # define strcache_add(str) strcache2_add_file(&file_strcache, str, strlen (str)) 649 602 # define strcache_add_len(str, len) strcache2_add_file(&file_strcache, str, len) 650 # ifdef CONFIG_WITH_INCLUDEDEP 651 # define strcache_add_prehashed(str, len, hash1, hash2) \ 652 strcache2_add_hashed(&file_strcache, str, len, hash1, hash2) 653 # ifdef HAVE_CASE_INSENSITIVE_FS 654 # define strcache_prehash_str(str, length, hash1p, hash2p) \ 655 do { *(hash1p) = strcache2_hash_istr (str, length, (hash2p)); } while (0) 656 # else 657 # define strcache_prehash_str(str, length, hash1p, hash2p) \ 658 do { *(hash1p) = strcache2_hash_str (str, length, (hash2p)); } while (0) 659 # endif 660 # endif /* CONFIG_WITH_INCLUDEDEP */ 661 # ifdef CONFIG_WITH_VALUE_LENGTH 662 # define strcache_get_len(str) strcache2_get_len(&file_strcache, str) 663 # define strcache_get_hash1(str) strcache2_get_hash1(&file_strcache, str) 664 # define strcache_get_hash2(str) strcache2_get_hash2(&file_strcache, str) 665 # endif /* CONFIG_WITH_VALUE_LENGTH */ 603 # define strcache_get_len(str) strcache2_get_len(&file_strcache, str) 604 # define strcache_get_hash1(str) strcache2_get_hash1(&file_strcache, str) 605 # define strcache_get_hash2(str) strcache2_get_hash2(&file_strcache, str) 666 606 667 607 #endif /* CONFIG_WITH_STRCACHE2 */
Note:
See TracChangeset
for help on using the changeset viewer.