Changeset 1165 for trunk/src


Ignore:
Timestamp:
Sep 30, 2007, 9:36:23 AM (18 years ago)
Author:
bird
Message:

Optimized kDebIDB a bit for Windows; use nt_fullpath and map the IDB file into memory.

Location:
trunk/src
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/Makefile.kmk

    r1164 r1165  
    3232TEMPLATE_BIN-KMK_INCS.freebsd = glob
    3333TEMPLATE_BIN-KMK_INCS.solaris = glob
    34 TEMPLATE_BIN-KMK_LIBS = $(TEMPLATE_BIN_LIBS) $(TARGET_kmkmissing)
     34TEMPLATE_BIN-KMK_LIBS = $(TEMPLATE_BIN_LIBS) $(TARGET_kmkmissing) $(LIB_KUTIL)
    3535ifdef ELECTRIC_HEAP # for electric heap (see electric.c) - windows only.
    3636TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN_CFLAGS) /FI$(PATH_CURRENT)/electric.h -DELECTRIC_HEAP=1
  • trunk/src/kmk/kmkbuiltin/kDepIDB.c

    r1163 r1165  
    3838# include <stdint.h>
    3939#else
     40# define USE_WIN_MMAP
     41# include <io.h>
     42# include <Windows.h>
    4043 typedef unsigned char  uint8_t;
    4144 typedef unsigned short uint16_t;
     
    137140
    138141
     142#ifdef USE_WIN_MMAP
     143/** Handle to the current file mapping object. */
     144static HANDLE g_hMapObj = NULL;
     145#endif
     146
    139147
    140148/**
    141149 * Reads the file specified by the pInput file stream into memory.
    142150 * The size of the file is returned in *pcbFile if specified.
    143  * The returned pointer should be freed by free().
     151 * The returned pointer should be freed by FreeFileMemory().
    144152 */
    145153void *ReadFileIntoMemory(FILE *pInput, size_t *pcbFile)
     
    152160     * Figure out file size.
    153161     */
     162#if defined(_MSC_VER)
     163    cbFile = _filelength(fileno(pInput));
     164    if (cbFile < 0)
     165#else
    154166    if (    fseek(pInput, 0, SEEK_END) < 0
    155167        ||  (cbFile = ftell(pInput)) < 0
    156168        ||  fseek(pInput, 0, SEEK_SET))
     169#endif
    157170    {
    158171        fprintf(stderr, "%s: error: Failed to determin file size.\n", argv0);
     
    163176
    164177    /*
     178     * Try mmap first.
     179     */
     180#ifdef USE_WIN_MMAP
     181    {
     182        HANDLE hMapObj = CreateFileMapping((HANDLE)_get_osfhandle(fileno(pInput)),
     183                                           NULL, PAGE_READONLY, 0, cbFile, NULL);
     184        if (hMapObj != NULL)
     185        {
     186            pvFile = MapViewOfFile(hMapObj, FILE_MAP_READ, 0, 0, cbFile);
     187            if (pvFile)
     188            {
     189                g_hMapObj = hMapObj;
     190                return pvFile;
     191            }
     192            fprintf(stderr, "%s: warning: MapViewOfFile failed, %d.\n", argv0, GetLastError());
     193            CloseHandle(hMapObj);
     194        }
     195        else
     196            fprintf(stderr, "%s: warning: CreateFileMapping failed, %d.\n", argv0, GetLastError());
     197    }
     198
     199#endif
     200
     201    /*
    165202     * Allocate memory and read the file.
    166203     */
     
    168205    if (pvFile)
    169206    {
     207#if 1
     208        long cbRead = (long)read(fileno(pInput), pvFile, cbFile);
     209        if (cbRead == cbFile)
     210#else
    170211        if (fread(pvFile, cbFile, 1, pInput))
     212#endif
    171213        {
    172214            ((uint8_t *)pvFile)[cbFile] = '\0';
     
    181223}
    182224
     225
     226static void FreeFileMemory(void *pvFile)
     227{
     228#if defined(USE_WIN_MMAP)
     229    if (g_hMapObj)
     230    {
     231        UnmapViewOfFile(pvFile);
     232        CloseHandle(g_hMapObj);
     233        return;
     234    }
     235#endif
     236    free(pvFile);
     237}
    183238
    184239
     
    726781    }
    727782
    728     free(pbFile);
     783    FreeFileMemory(pbFile);
    729784    return rc;
    730785}
     
    925980    }
    926981
     982    depCleanup();
    927983    return i;
    928984}
  • trunk/src/kmk/w32/pathstuff.c

    r1127 r1165  
    8383
    8484#if 1 /* bird */
    85 /*
    86  * Corrects the case of a path.
    87  * Expects a fullpath!
    88  * Added by bird for the $(abspath ) function and w32ify
    89  */
    90 void
    91 w32_fixcase(char *pszPath)
    92 {
    93     static char     s_szLast[260];
    94     unsigned        cchLast;
    95 
    96 #ifndef NDEBUG
    97 # define my_assert(expr) \
    98     do { \
    99         if (!(expr)) { \
    100             printf("my_assert: %s, file %s, line %d\npszPath=%s\npsz=%s\n", \
    101                    #expr, __FILE__, __LINE__, pszPath, psz); \
    102             __debugbreak(); \
    103             exit(1); \
    104         } \
    105     } while (0)
    106 #else
    107 # define my_assert(expr) do {} while (0)
    108 #endif
    109 
    110     char *psz = pszPath;
    111     if (*psz == '/' || *psz == '\\')
    112     {
    113         if (psz[1] == '/' || psz[1] == '\\')
    114         {
    115             /* UNC */
    116             my_assert(psz[1] == '/' || psz[1] == '\\');
    117             my_assert(psz[2] != '/' && psz[2] != '\\');
    118 
    119             /* skip server name */
    120             psz += 2;
    121             while (*psz != '\\' && *psz != '/')
    122             {
    123                 if (!*psz)
    124                     return;
    125                 *psz++ = toupper(*psz);
    126             }
    127 
    128             /* skip the share name */
    129             psz++;
    130             my_assert(*psz != '/' && *psz != '\\');
    131             while (*psz != '\\' && *psz != '/')
    132             {
    133                 if (!*psz)
    134                     return;
    135                 *psz++ = toupper(*psz);
    136             }
    137             my_assert(*psz == '/' || *psz == '\\');
    138             psz++;
    139         }
    140         else
    141         {
    142             /* Unix spec */
    143             psz++;
    144         }
    145     }
    146     else
    147     {
    148         /* Drive letter */
    149         my_assert(psz[1] == ':');
    150         *psz = toupper(*psz);
    151         my_assert(psz[0] >= 'A' && psz[0] <= 'Z');
    152         my_assert(psz[2] == '/' || psz[2] == '\\');
    153         psz += 3;
    154     }
    155 
    156     /*
    157      * Try make use of the result from the previous call.
    158      * This is ignorant to slashes and similar, but may help even so.
    159      */
    160     if (    s_szLast[0] == pszPath[0]
    161         &&  (psz - pszPath == 1 || s_szLast[1] == pszPath[1])
    162         &&  (psz - pszPath <= 2 || s_szLast[2] == pszPath[2])
    163        )
    164     {
    165         char *pszLast = &s_szLast[psz - pszPath];
    166         char *pszCur = psz;
    167         for (;;)
    168         {
    169             const char ch1 = *pszCur;
    170             const char ch2 = *pszLast;
    171             if (    ch1 != ch2
    172                 &&  (ch1 != '\\' || ch2 != '/')
    173                 &&  (ch1 != '/'  || ch2 != '\\'))
    174             {
    175                 if (    tolower(ch1) != tolower(ch2)
    176                     &&  toupper(ch1) != toupper(ch2))
    177                     break;
    178                 /* optimistic, component mismatch will be corrected in the next loop. */
    179                 *pszCur = ch2;
    180             }
    181             if (ch1 == '/' || ch1 == '\\')
    182                 psz = pszCur + 1;
    183             else if (ch1 == '\0')
    184             {
    185                 psz = pszCur;
    186                 break;
    187             }
    188             pszCur++;
    189             pszLast++;
    190         }
    191     }
    192 
    193     /*
    194      * Pointing to the first char after the unc or drive specifier,
    195      * or in case of a cache hit, the first non-matching char (following a slash of course).
    196      */
    197     while (*psz)
    198     {
    199         WIN32_FIND_DATA FindFileData;
    200         HANDLE hDir;
    201         char chSaved0;
    202         char chSaved1;
    203         char *pszEnd;
    204         int iLongNameDiff;
    205 
    206 
    207         /* find the end of the component. */
    208         pszEnd = psz;
    209         while (*pszEnd && *pszEnd != '/' && *pszEnd != '\\')
    210             pszEnd++;
    211 
    212         /* replace the end with "?\0" */
    213         chSaved0 = pszEnd[0];
    214         chSaved1 = pszEnd[1];
    215         pszEnd[0] = '?';
    216         pszEnd[1] = '\0';
    217 
    218         /* find the right filename. */
    219         hDir = FindFirstFile(pszPath, &FindFileData);
    220         pszEnd[1] = chSaved1;
    221         if (!hDir)
    222         {
    223             cchLast = psz - pszPath;
    224             memcpy(s_szLast, pszPath, cchLast + 1);
    225             pszEnd[0] = chSaved0;
    226             return;
    227         }
    228         pszEnd[0] = '\0';
    229         while (   (iLongNameDiff = stricmp(FindFileData.cFileName, psz))
    230                && stricmp(FindFileData.cAlternateFileName, psz))
    231         {
    232             if (!FindNextFile(hDir, &FindFileData))
    233             {
    234                 cchLast = psz - pszPath;
    235                 memcpy(s_szLast, pszPath, cchLast + 1);
    236                 pszEnd[0] = chSaved0;
    237                 return;
    238             }
    239         }
    240         strcpy(psz, !iLongNameDiff ? FindFileData.cFileName : FindFileData.cAlternateFileName);
    241         pszEnd[0] = chSaved0;
    242         FindClose(hDir);
    243 
    244         /* advance to the next component */
    245         if (!chSaved0)
    246         {
    247             psz = pszEnd;
    248             break;
    249         }
    250         psz = pszEnd + 1;
    251         my_assert(*psz != '/' && *psz != '\\');
    252     }
    253 
    254     /* *psz == '\0', the end. */
    255     cchLast = psz - pszPath;
    256     memcpy(s_szLast, pszPath, cchLast + 1);
    257 #undef my_assert
    258 }
    259 
    260 #define MY_FileNameInformation 9
    261 
    262 typedef struct _MY_FILE_NAME_INFORMATION
    263 {
    264     ULONG FileNameLength;
    265     WCHAR FileName[1];
    266 } MY_FILE_NAME_INFORMATION, *PMY_FILE_NAME_INFORMATION;
    267 
    268 typedef struct _IO_STATUS_BLOCK
    269 {
    270     union
    271     {
    272         LONG Status;
    273         PVOID Pointer;
    274     };
    275     ULONG_PTR Information;
    276 } MY_IO_STATUS_BLOCK, *PMY_IO_STATUS_BLOCK;
    277 
    278 static BOOL g_fInitialized = FALSE;
    279 static LONG (NTAPI *g_pfnNtQueryInformationFile)(HANDLE FileHandle,
    280     PMY_IO_STATUS_BLOCK IoStatusBlock, PVOID FileInformation, 
    281     ULONG Length, ULONG FileInformationClass);
    282 
    283 
    284 int
    285 nt_get_filename_info(const char *pszPath, char *pszFull, size_t cchFull)
    286 {
    287     static char                 abBuf[8192];
    288     PMY_FILE_NAME_INFORMATION   pFileNameInfo = (PMY_FILE_NAME_INFORMATION)abBuf;
    289     MY_IO_STATUS_BLOCK          Ios;
    290     LONG                        rcNt;
    291     HANDLE                      hFile;
    292 
    293     /*
    294      * Check for NtQueryInformationFile the first time around.
    295      */
    296     if (!g_fInitialized)
    297     {
    298         g_fInitialized = TRUE;
    299         if (!getenv("KMK_DONT_USE_NT_QUERY_INFORMATION_FILE"))
    300             *(FARPROC *)&g_pfnNtQueryInformationFile =
    301                 GetProcAddress(LoadLibrary("ntdll.dll"), "NtQueryInformationFile");
    302     }
    303     if (!g_pfnNtQueryInformationFile)
    304         return -1;
    305 
    306     /*
    307      * Try open the path and query its file name information.
    308      */
    309     hFile = CreateFile(pszPath,
    310                        GENERIC_READ,
    311                        FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
    312                        NULL,
    313                        OPEN_EXISTING,
    314                        FILE_FLAG_BACKUP_SEMANTICS,
    315                        NULL);
    316     if (hFile)
    317     {
    318         memset(&Ios, 0, sizeof(Ios));
    319         rcNt = g_pfnNtQueryInformationFile(hFile, &Ios, abBuf, sizeof(abBuf), MY_FileNameInformation);
    320         CloseHandle(hFile);
    321         if (rcNt >= 0)
    322         {
    323             /*
    324              * The FileNameInformation we get is relative to where the volume is mounted,
    325              * so we have to extract the driveletter prefix ourselves.
    326              *
    327              * FIXME: This will probably not work for volumes mounted in NTFS sub-directories.
    328              */
    329             int cchOut;
    330             int fUnc = 0;
    331             char *psz = pszFull;
    332             if (pszPath[0] == '\\' || pszPath[0] == '/')
    333             {
    334                 /* unc or root of volume */
    335                 if (    (pszPath[1] == '\\' || pszPath[1] == '/')
    336                     &&  (pszPath[2] != '\\' || pszPath[2] == '/'))
    337                 {
    338                     /* unc - we get the server + name back */
    339                     *psz++ = '\\';
    340                     fUnc = 1;
    341                 }
    342                 else
    343                 {
    344                     /* root slash */
    345                     *psz++ = _getdrive() + 'A' - 1;
    346                     *psz++ = ':';
    347                 }
    348             }
    349             else if (pszPath[1] == ':' && isalpha(pszPath[0]))
    350             {
    351                 /* drive letter */
    352                 *psz++ = toupper(pszPath[0]);
    353                 *psz++ = ':';
    354             }
    355             else
    356             {
    357                 /* relative */
    358                 *psz++ = _getdrive() + 'A' - 1;
    359                 *psz++ = ':';
    360             }
    361 
    362             cchOut = WideCharToMultiByte(CP_ACP, 0,
    363                                          pFileNameInfo->FileName, pFileNameInfo->FileNameLength / sizeof(WCHAR),
    364                                          psz, cchFull - (psz - pszFull) - 2, NULL, NULL);
    365             if (cchOut > 0)
    366             {
    367                 const char *pszEnd;
    368 
    369                 /* upper case the server and share */
    370                 if (fUnc)
    371                 {
    372                     for (psz++; *psz != '/' && *psz != '\\'; psz++)
    373                         *psz = toupper(*psz);
    374                     for (psz++; *psz != '/' && *psz != '\\'; psz++)
    375                         *psz = toupper(*psz);
    376                 }
    377 
    378                 /* add trailing slash on directories if input has it. */
    379                 pszEnd = strchr(pszPath, '\0');
    380                 if (    (pszEnd[-1] == '/' || pszEnd[-1] == '\\')
    381                     &&  psz[cchOut - 1] != '\\'
    382                     &&  psz[cchOut - 1] != '//')
    383                     psz[cchOut++] = '\\';
    384 
    385                 /* make sure it's terminated */
    386                 psz[cchOut] = '\0';
    387                 return 0;
    388             }
    389             return -3;
    390         }
    391     }
    392     return -2;
    393 }
    394 
    395 void
    396 nt_fullpath(const char *pszPath, char *pszFull, size_t cchFull)
    397 {
    398 #if 0
    399     static int s_cHits = 0;
    400     static int s_cFallbacks = 0;
    401 #endif
    402 
    403     /*
    404      * The simple case, the file / dir / whatever exists and can be
    405      * queried without problems.
    406      */
    407     if (nt_get_filename_info(pszPath, pszFull, cchFull) == 0)
    408     {
    409 #if 0
    410         fprintf(stderr, "nt #%d - %s\n", ++s_cHits, pszFull);
    411 #endif
    412         return;
    413     }
    414     if (g_pfnNtQueryInformationFile)
    415     {
    416         /* do _fullpath and drop off path elements until we get a hit... - later */
    417     }
    418    
    419     /*
    420      * For now, simply fall back on the old method.
    421      */
    422     _fullpath(pszFull, pszPath, cchFull);
    423     w32_fixcase(pszFull);
    424 #if 0
    425     fprintf(stderr, "fb #%d - %s\n", ++s_cFallbacks, pszFull);
    426 #endif
    427 }
    428 
    429 #endif /* bird */
    430 
     85extern void nt_fullpath(const char *pszPath, char *pszFull, size_t cchFull);
     86#endif
    43187
    43288/*
     
    44197    if (resolve) {
    44298#if 1 /* bird */
    443 # if 1
    44499        nt_fullpath(filename, w32_path, sizeof(w32_path));
    445 # else
    446         _fullpath(w32_path, filename, sizeof(w32_path));
    447         w32_fixcase(w32_path);
    448 # endif
    449100#else   /* !bird */
    450101        _fullpath(w32_path, filename, sizeof (w32_path));
  • trunk/src/kmk/w32/subproc/sub_proc.c

    r540 r1165  
    737737
    738738        while (!stdin_eof || !stdout_eof || !stderr_eof || !child_dead) {
     739long tick;
    739740                wait_count = 0;
    740741                if (!stdin_eof) {
     
    751752                }
    752753
     754tick = GetTickCount();
    753755                wait_return = WaitForMultipleObjects(wait_count, wait_list,
    754756                         FALSE, /* don't wait for all: one ready will do */
    755757                         child_dead? 1000 :INFINITE); /* after the child dies, subthreads have
    756758                                one second to collect all remaining output */
     759printf("waitformultipleobjects: %d ms rc=%d\n", GetTickCount() - tick, wait_return);
    757760
    758761                if (wait_return == WAIT_FAILED) {
     
    10751078#ifdef KMK /* for the space before the final " in case we need it. */
    10761079        bytes_required++;
    1077 #endif 
     1080#endif
    10781081
    10791082        command_line = (char*) malloc(bytes_required);
     
    11251128                                         */
    11261129                                        backslash_count++;
    1127        
     1130
    11281131                                        while(backslash_count) {
    11291132                                                *(command_line_i++) = '\\';
  • trunk/src/lib/Makefile.kmk

    r1000 r1165  
    3232kDep_DEFS.win += NEED_ISBLANK=1 __WIN32__=1
    3333kDep_SOURCES = kDep.c
     34kDep_SOURCES.win = nt_fullpath.c
    3435kDep_NOINST = 1
    3536
     
    3839kUtil_DEFS.win = __WIN__
    3940kUtil_SOURCES = crc32.c md5.c
     41kUtil_SOURCES.win = nt_fullpath.c
    4042kUtil_NOINST = 1
    4143
  • trunk/src/lib/kDep.c

    r1088 r1165  
    4949 typedef unsigned short uint16_t;
    5050 typedef unsigned int   uint32_t;
     51 extern void nt_fullpath(const char *pszPath, char *pszFull, size_t cchFull); /* nt_fullpath.c */
    5152#endif
    5253
     
    8283
    8384
    84 #ifdef __WIN32__
    85 /**
    86  * Corrects the case of a path and changes any path components containing
    87  * spaces with the short name (which can be longer).
    88  *
    89  * Expects a _fullpath!
    90  *
    91  * @param   pszPath     Pointer to the path, both input and output.
    92  *                      The buffer must be at least MAX_PATH in length.
    93  */
    94 static void fixcase(char *pszPath)
    95 {
    96 #define my_assert(expr) \
    97     do { \
    98         if (!(expr)) { \
    99             printf("my_assert: %s, file %s, line %d\npszPath=%s\npsz=%s\n", \
    100                    #expr, __FILE__, __LINE__, pszPath, psz); \
    101             __debugbreak(); \
    102             exit(1); \
    103         } \
    104     } while (0)
    105 
    106     char *psz = pszPath;
    107     if (*psz == '/' || *psz == '\\')
    108     {
    109         if (psz[1] == '/' || psz[1] == '\\')
    110         {
    111             /* UNC */
    112             my_assert(psz[1] == '/' || psz[1] == '\\');
    113             my_assert(psz[2] != '/' && psz[2] != '\\');
    114 
    115             /* skip server name */
    116             psz += 2;
    117             while (*psz != '\\' && *psz != '/')
    118             {
    119                 if (!*psz)
    120                     return;
    121                 *psz++ = toupper(*psz);
    122             }
    123 
    124             /* skip the share name */
    125             psz++;
    126             my_assert(*psz != '/' && *psz != '\\');
    127             while (*psz != '\\' && *psz != '/')
    128             {
    129                 if (!*psz)
    130                     return;
    131                 *psz++ = toupper(*psz);
    132             }
    133             my_assert(*psz == '/' || *psz == '\\');
    134             psz++;
    135         }
    136         else
    137         {
    138             /* Unix spec */
    139             psz++;
    140         }
    141     }
    142     else
    143     {
    144         /* Drive letter */
    145         my_assert(psz[1] == ':');
    146         *psz = toupper(*psz);
    147         my_assert(psz[0] >= 'A' && psz[0] <= 'Z');
    148         my_assert(psz[2] == '/' || psz[2] == '\\');
    149         psz += 3;
    150     }
    151 
    152     /*
    153      * Pointing to the first char after the unc or drive specifier.
    154      */
    155     while (*psz)
    156     {
    157         WIN32_FIND_DATA FindFileData;
    158         HANDLE hDir;
    159         char chSaved0;
    160         char chSaved1;
    161         char *pszEnd;
    162         size_t cch;
    163         int iLongNameDiff;
    164 
    165 
    166         /* find the end of the component. */
    167         pszEnd = psz;
    168         while (*pszEnd && *pszEnd != '/' && *pszEnd != '\\')
    169             pszEnd++;
    170         cch = pszEnd - psz;
    171 
    172         /* replace the end with "?\0" */
    173         chSaved0 = pszEnd[0];
    174         chSaved1 = pszEnd[1];
    175         pszEnd[0] = '?';
    176         pszEnd[1] = '\0';
    177 
    178         /* find the right filename. */
    179         hDir = FindFirstFile(pszPath, &FindFileData);
    180         pszEnd[1] = chSaved1;
    181         if (!hDir)
    182         {
    183             pszEnd[0] = chSaved0;
    184             return;
    185         }
    186         pszEnd[0] = '\0';
    187         while (   (iLongNameDiff = _stricmp(FindFileData.cFileName, psz))
    188                && _stricmp(FindFileData.cAlternateFileName, psz))
    189         {
    190             if (!FindNextFile(hDir, &FindFileData))
    191             {
    192                 pszEnd[0] = chSaved0;
    193                 return;
    194             }
    195         }
    196         pszEnd[0] = chSaved0;
    197         if (iLongNameDiff || !FindFileData.cAlternateFileName[0] || !memchr(psz, ' ', cch))
    198             memcpy(psz, !iLongNameDiff ? FindFileData.cFileName : FindFileData.cAlternateFileName, cch);
    199         else
    200         {
    201             /* replace spacy name with the short name. */
    202             const size_t cchAlt = strlen(FindFileData.cAlternateFileName);
    203             const size_t cchDelta = cch - cchAlt;
    204             my_assert(cchAlt > 0);
    205             if (!cchDelta)
    206                 memcpy(psz, FindFileData.cAlternateFileName, cch);
    207             else
    208             {
    209                 size_t cbLeft = strlen(pszEnd) + 1;
    210                 if ((psz - pszPath) + cbLeft + cchAlt <= _MAX_PATH)
    211                 {
    212                     memmove(psz + cchAlt, pszEnd, cbLeft);
    213                     pszEnd -= cchDelta;
    214                     memcpy(psz, FindFileData.cAlternateFileName, cchAlt);
    215                 }
    216                 else
    217                     fprintf(stderr, "kDep: case & space fixed filename is growing too long (%d bytes)! '%s'\n",
    218                             (psz - pszPath) + cbLeft + cchAlt, pszPath);
    219             }
    220         }
    221         my_assert(pszEnd[0] == chSaved0);
    222 
    223         /* advance to the next component */
    224         if (!chSaved0)
    225             return;
    226         psz = pszEnd + 1;
    227         my_assert(*psz != '/' && *psz != '\\');
    228     }
    229 #undef my_assert
    230 }
    231 
    232 #elif defined(__OS2__)
     85#if defined(__OS2__)
    23386
    23487/**
     
    24396}
    24497
    245 #else
     98#elif !defined(__WIN32__) && !defined(__WIN64__)
    24699
    247100/**
     
    372225        if (fFixCase)
    373226        {
    374 #ifdef __WIN32__
    375             if (_fullpath(szFilename, pszFilename, sizeof(szFilename)))
    376                 ;
    377             else
    378 #endif
    379                 strcpy(szFilename, pszFilename);
     227#if defined(__WIN32__) || defined(__WIN64__)
     228            nt_fullpath(pszFilename, szFilename, sizeof(szFilename));
     229#else
    380230            fixslash(szFilename);
    381231            fixcase(szFilename);
     232#endif
    382233            pszFilename = szFilename;
    383234        }
     
    398249    }
    399250
    400 #if 0 /* waste of time */
    401251    /*
    402252     * Free the old ones.
     
    408258        free(pDep);
    409259    }
    410 #endif
    411260}
    412261
     
    510359    return pDep;
    511360}
     361
     362
     363/**
     364 * Frees the current dependency chain.
     365 */
     366void depCleanup(void)
     367{
     368    PDEP pDep = g_pDeps;
     369    g_pDeps = NULL;
     370    while (pDep)
     371    {
     372        PDEP pFree = pDep;
     373        pDep = pDep->pNext;
     374        free(pFree);
     375    }
     376}
     377
  • trunk/src/lib/kDep.h

    r785 r1165  
    4747extern void depPrint(FILE *pOutput);
    4848extern void depPrintStubs(FILE *pOutput);
     49extern void depCleanup(void);
    4950
    5051#endif
Note: See TracChangeset for help on using the changeset viewer.