Changeset 1396 in kBuild
- Timestamp:
- Mar 16, 2008 6:19:12 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kbuild.c
r1330 r1396 843 843 const char *pszSrcPrefix = NULL; 844 844 size_t cchSrcPrefix = 0; 845 size_t cchSrc = 0; 845 846 const char *pszSrcEnd; 846 847 char *pszSrc; 847 848 char *pszResult; 848 849 char *psz; 850 char *pszDot; 849 851 size_t cch; 850 852 … … 911 913 912 914 /* 913 * Assemble the string on the stackand define the objbase variable915 * Assemble the string on the heap and define the objbase variable 914 916 * which we then return. 915 917 */ 918 cchSrc = pszSrcEnd - pszSrc; 916 919 cch = pPathTarget->value_length 917 920 + 1 /* slash */ … … 919 922 + 1 /* slash */ 920 923 + cchSrcPrefix 921 + pszSrcEnd - pszSrc924 + cchSrc 922 925 + 1; 923 926 psz = pszResult = xmalloc(cch); … … 932 935 psz += cchSrcPrefix; 933 936 } 934 memcpy(psz, pszSrc, pszSrcEnd - pszSrc); psz += pszSrcEnd - pszSrc; 937 pszDot = psz; 938 memcpy(psz, pszSrc, cchSrc); psz += cchSrc; 935 939 *psz = '\0'; 940 941 /* convert '..' path elements in the source to '_.'. */ 942 psz = pszDot; 943 while ((psz = memchr(psz, '.', cchSrc + 1 - (pszDot - psz))) != NULL) 944 { 945 if ( psz[1] == '.' 946 && ( psz == pszDot 947 || psz[-1] == '/' 948 #ifdef HAVE_DOS_PATHS 949 || psz[-1] == '\\' 950 || psz[-1] == ':' 951 #endif 952 ) 953 && ( !psz[2] 954 || psz[2] == '/' 955 #ifdef HAVE_DOS_PATHS 956 || psz[2] == '\\' 957 || psz[2] == ':' 958 #endif 959 ) 960 ) 961 { 962 *psz = '_'; 963 psz += 2; 964 } 965 else 966 psz++; 967 } 936 968 937 969 /*
Note:
See TracChangeset
for help on using the changeset viewer.