Changeset 9145 for trunk/tools
- Timestamp:
- Aug 27, 2002, 11:48:45 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/fastdep/fastdep.c
r9070 r9145 1 /* $Id: fastdep.c,v 1. 39 2002-08-21 01:51:56bird Exp $1 /* $Id: fastdep.c,v 1.40 2002-08-27 21:48:45 bird Exp $ 2 2 * 3 3 * Fast dependents. (Fast = Quick and Dirty!) … … 3781 3781 int iHistory; 3782 3782 int j; 3783 int k; 3784 int iCmp; 3783 3785 #endif 3784 3786 PDEPRULE pdep; … … 3825 3827 * Check if in history, if so we'll skip it. 3826 3828 */ 3829 #if 1 3827 3830 for (j = 0; j < iHistory; j++) 3828 3831 if (!strcmp(apszHistory[j], pdep->pszRule)) … … 3836 3839 if (iHistory < HISTORY) 3837 3840 apszHistory[iHistory++] = pdep->pszRule; 3841 3842 #else 3843 /* 3844 * Check if in history, if so we'll skip it. 3845 * (Binary search) 3846 * ASSUMES: Always something in the history! 3847 */ 3848 j = iHistory / 2; 3849 k = (iHistory + 1) / 2; 3850 do 3851 { 3852 iCmp = strcmp(pdep->pszRule, apszHistroy[j]); 3853 if (!iCmp) 3854 break; 3855 k = (k + 1) / 2; 3856 if (iCmp > 0) 3857 j += k; 3858 else 3859 j -= k; 3860 } while (!k); 3861 3862 if (!iCmp) 3863 continue; /* found */ 3864 3865 /* 3866 * Push into history - might concider make this binary sorted one day. 3867 */ 3868 if (iHistory < HISTORY) 3869 { 3870 if (iCmp > 0) /* Insert after. */ 3871 j++; 3872 for (k = iHistory; k < j; k--) 3873 apszHistory[k] = apszHistory[k - 1]; 3874 apszHistory[j] = pdep->pszRule; 3875 iHistory++; 3876 } 3877 3878 #endif 3879 3838 3880 #endif 3839 3881 /*
Note:
See TracChangeset
for help on using the changeset viewer.