Changeset 2596 for vendor/gnumake/current/vpath.c
- Timestamp:
- Jun 20, 2012, 12:44:52 AM (13 years ago)
- Location:
- vendor/gnumake/current
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current
- Property svn:ignore deleted
-
vendor/gnumake/current/vpath.c
r1989 r2596 1 1 /* Implementation of pattern-matching file search paths for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 140 140 141 141 142 /* Construct the VPATH listing for the pattern and searchpathgiven.142 /* Construct the VPATH listing for the PATTERN and DIRPATH given. 143 143 144 144 This function is called to generate selective VPATH lists and also for … … 148 148 variable. 149 149 150 If SEARCHPATH is nil, remove all previous listings with the same150 If DIRPATH is nil, remove all previous listings with the same 151 151 pattern. If PATTERN is nil, remove all VPATH listings. Existing 152 and readable directories that are not "." given in the searchpath152 and readable directories that are not "." given in the DIRPATH 153 153 separated by the path element separator (defined in make.h) are 154 154 loaded into the directory hash table if they are not there already … … 195 195 196 196 /* Free its unused storage. */ 197 free (path->searchpath); 197 /* MSVC erroneously warns without a cast here. */ 198 free ((void *)path->searchpath); 198 199 free (path); 199 200 } … … 300 301 else 301 302 /* There were no entries, so free whatever space we allocated. */ 302 free (vpath); 303 /* MSVC erroneously warns without a cast here. */ 304 free ((void *)vpath); 303 305 } 304 306 … … 325 327 FILE exists. If it is found, we return a cached name of the existing file 326 328 and set *MTIME_PTR (if MTIME_PTR is not NULL) to its modtime (or zero if no 327 stat call was done). Otherwise we return NULL. */ 329 stat call was done). Also set the matching directory index in PATH_INDEX 330 if it is not NULL. Otherwise we return NULL. */ 328 331 329 332 static const char * 330 333 selective_vpath_search (struct vpath *path, const char *file, 331 FILE_TIMESTAMP *mtime_ptr )334 FILE_TIMESTAMP *mtime_ptr, unsigned int* path_index) 332 335 { 333 336 int not_target; … … 509 512 /* Store the name we found and return it. */ 510 513 514 if (path_index) 515 *path_index = i; 516 511 517 return strcache_add_len (name, (p + 1 - name) + flen); 512 518 } … … 520 526 exists. If it is found, return the cached name of an existing file, and 521 527 set *MTIME_PTR (if MTIME_PTR is not NULL) to its modtime (or zero if no 522 stat call was done). Otherwise we return 0. */ 528 stat call was done). Also set the matching directory index in VPATH_INDEX 529 and PATH_INDEX if they are not NULL. Otherwise we return 0. */ 523 530 524 531 const char * 525 vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr) 532 vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr, 533 unsigned int* vpath_index, unsigned int* path_index) 526 534 { 527 535 struct vpath *v; … … 537 545 return 0; 538 546 547 if (vpath_index) 548 { 549 *vpath_index = 0; 550 *path_index = 0; 551 } 552 539 553 for (v = vpaths; v != 0; v = v->next) 540 if (pattern_matches (v->pattern, v->percent, file)) 541 { 542 const char *p = selective_vpath_search (v, file, mtime_ptr); 543 if (p) 544 return p; 545 } 554 { 555 if (pattern_matches (v->pattern, v->percent, file)) 556 { 557 const char *p = selective_vpath_search ( 558 v, file, mtime_ptr, path_index); 559 if (p) 560 return p; 561 } 562 563 if (vpath_index) 564 ++*vpath_index; 565 } 566 546 567 547 568 if (general_vpath != 0) 548 569 { 549 const char *p = selective_vpath_search (general_vpath, file, mtime_ptr); 570 const char *p = selective_vpath_search ( 571 general_vpath, file, mtime_ptr, path_index); 550 572 if (p) 551 573 return p; … … 554 576 return 0; 555 577 } 578 579 580 556 581 557 582
Note:
See TracChangeset
for help on using the changeset viewer.