Ignore:
Timestamp:
Jun 20, 2012, 12:44:52 AM (13 years ago)
Author:
bird
Message:

gnumake/current -> 3.82-cvs.

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  
    11/* Implementation of pattern-matching file search paths for GNU Make.
    22Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    4 Foundation, Inc.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    140140
    141141
    142 /* Construct the VPATH listing for the pattern and searchpath given.
     142/* Construct the VPATH listing for the PATTERN and DIRPATH given.
    143143
    144144   This function is called to generate selective VPATH lists and also for
     
    148148   variable.
    149149
    150    If SEARCHPATH is nil, remove all previous listings with the same
     150   If DIRPATH is nil, remove all previous listings with the same
    151151   pattern.  If PATTERN is nil, remove all VPATH listings.  Existing
    152    and readable directories that are not "." given in the searchpath
     152   and readable directories that are not "." given in the DIRPATH
    153153   separated by the path element separator (defined in make.h) are
    154154   loaded into the directory hash table if they are not there already
     
    195195
    196196              /* Free its unused storage.  */
    197               free (path->searchpath);
     197              /* MSVC erroneously warns without a cast here.  */
     198              free ((void *)path->searchpath);
    198199              free (path);
    199200            }
     
    300301  else
    301302    /* 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);
    303305}
    304306
     
    325327   FILE exists.  If it is found, we return a cached name of the existing file
    326328   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.  */
    328331
    329332static const char *
    330333selective_vpath_search (struct vpath *path, const char *file,
    331                         FILE_TIMESTAMP *mtime_ptr)
     334                        FILE_TIMESTAMP *mtime_ptr, unsigned int* path_index)
    332335{
    333336  int not_target;
     
    509512          /* Store the name we found and return it.  */
    510513
     514          if (path_index)
     515            *path_index = i;
     516
    511517          return strcache_add_len (name, (p + 1 - name) + flen);
    512518        }
     
    520526   exists.  If it is found, return the cached name of an existing file, and
    521527   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.  */
    523530
    524531const char *
    525 vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr)
     532vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr,
     533              unsigned int* vpath_index, unsigned int* path_index)
    526534{
    527535  struct vpath *v;
     
    537545    return 0;
    538546
     547  if (vpath_index)
     548    {
     549      *vpath_index = 0;
     550      *path_index = 0;
     551    }
     552
    539553  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
    546567
    547568  if (general_vpath != 0)
    548569    {
    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);
    550572      if (p)
    551573        return p;
     
    554576  return 0;
    555577}
     578
     579
     580
    556581
    557582
Note: See TracChangeset for help on using the changeset viewer.