Changeset 503 for trunk/src/gmake/dir.c


Ignore:
Timestamp:
Sep 15, 2006, 7:09:38 AM (19 years ago)
Author:
bird
Message:

Untested merge with GNU Make v3.81 (vendor/gnumake/2005-05-16 -> vendor/gnumake/current).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/dir.c

    r287 r503  
    11/* Directory hashing for GNU Make.
    2 Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    3 2002,2003 Free Software Foundation, Inc.
     2Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
     4Foundation, Inc.
    45This file is part of GNU Make.
    56
    6 GNU Make is free software; you can redistribute it and/or modify
    7 it under the terms of the GNU General Public License as published by
    8 the Free Software Foundation; either version 2, or (at your option)
    9 any later version.
    10 
    11 GNU Make is distributed in the hope that it will be useful,
    12 but WITHOUT ANY WARRANTY; without even the implied warranty of
    13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14 GNU General Public License for more details.
    15 
    16 You should have received a copy of the GNU General Public License
    17 along with GNU Make; see the file COPYING.  If not, write to
    18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    19 Boston, MA 02111-1307, USA.  */
     7GNU Make is free software; you can redistribute it and/or modify it under the
     8terms of the GNU General Public License as published by the Free Software
     9Foundation; either version 2, or (at your option) any later version.
     10
     11GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     12WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     13A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     14
     15You should have received a copy of the GNU General Public License along with
     16GNU Make; see the file COPYING.  If not, write to the Free Software
     17Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.  */
    2018
    2119#include "make.h"
     
    157155    {
    158156      unsigned char uc = *name;
     157#ifdef HAVE_CASE_INSENSITIVE_FS
    159158      h = (h << 4) + (isupper (uc) ? tolower (uc) : uc);
     159#else
     160      h = (h << 4) + uc;
     161#endif
    160162      name++;
    161163      g = h & 0xf0000000;
     
    288290}
    289291
     292/* Sometimes it's OK to use subtraction to get this value:
     293     result = X - Y;
     294   But, if we're not sure of the type of X and Y they may be too large for an
     295   int (on a 64-bit system for example).  So, use ?: instead.
     296   See Savannah bug #15534.
     297
     298   NOTE!  This macro has side-effects!
     299*/
     300
     301#define MAKECMP(_x,_y)  ((_x)<(_y)?-1:((_x)==(_y)?0:1))
     302
    290303static int
    291304directory_contents_hash_cmp (const void *xv, const void *yv)
     
    299312  if (result)
    300313    return result;
    301   result = x->ctime - y->ctime;
     314  result = MAKECMP(x->ctime, y->ctime);
    302315  if (result)
    303316    return result;
    304317#else
    305318# ifdef VMS
    306   result = x->ino[0] - y->ino[0];
     319  result = MAKECMP(x->ino[0], y->ino[0]);
    307320  if (result)
    308321    return result;
    309   result = x->ino[1] - y->ino[1];
     322  result = MAKECMP(x->ino[1], y->ino[1]);
    310323  if (result)
    311324    return result;
    312   result = x->ino[2] - y->ino[2];
     325  result = MAKECMP(x->ino[2], y->ino[2]);
    313326  if (result)
    314327    return result;
    315328# else
    316   result = x->ino - y->ino;
     329  result = MAKECMP(x->ino, y->ino);
    317330  if (result)
    318331    return result;
     
    320333#endif /* WINDOWS32 */
    321334
    322   return x->dev - y->dev;
     335  return MAKECMP(x->dev, y->dev);
    323336}
    324337
     
    419432  char  fs_label[BUFSIZ];
    420433  char  fs_type[BUFSIZ];
    421   long  fs_serno;
    422   long  fs_flags;
    423   long  fs_len;
     434  unsigned long  fs_serno;
     435  unsigned long  fs_flags;
     436  unsigned long  fs_len;
    424437#endif
    425438#ifdef VMS
     
    631644       * on directories (ugh!).
    632645       */
    633       if (dir->path_key
    634           && (dir->fs_flags & FS_FAT
    635               || (stat(dir->path_key, &st) == 0
    636                   && st.st_mtime > dir->mtime)))
     646      if (dir->path_key)
    637647        {
    638           /* reset date stamp to show most recent re-process */
    639           dir->mtime = st.st_mtime;
    640 
    641           /* make sure directory can still be opened */
    642           dir->dirstream = opendir(dir->path_key);
    643 
    644           if (dir->dirstream)
    645             rehash = 1;
    646           else
    647             return 0; /* couldn't re-read - fail */
     648          if ((dir->fs_flags & FS_FAT) != 0)
     649            {
     650              dir->mtime = time ((time_t *) 0);
     651              rehash = 1;
     652            }
     653          else if (stat(dir->path_key, &st) == 0 && st.st_mtime > dir->mtime)
     654            {
     655              /* reset date stamp to show most recent re-process.  */
     656              dir->mtime = st.st_mtime;
     657              rehash = 1;
     658            }
     659
     660          /* If it has been already read in, all done.  */
     661          if (!rehash)
     662            return 0;
     663
     664          /* make sure directory can still be opened; if not return.  */
     665          dir->dirstream = opendir(dir->path_key);
     666          if (!dir->dirstream)
     667            return 0;
    648668        }
    649669      else
Note: See TracChangeset for help on using the changeset viewer.