Changeset 2591 for trunk/src/kmk/dir.c


Ignore:
Timestamp:
Jun 17, 2012, 10:45:31 PM (13 years ago)
Author:
bird
Message:

kmk: Merged in changes from GNU make 3.82. Previous GNU make base version was gnumake-2008-10-28-CVS.

Location:
trunk/src/kmk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk

    • Property svn:ignore
      •  

        old new  
        1313stamp-*
        1414makebook*
         15
        1516.*gdbinit
         17.gdb_history
         18
        1619*.dep
        1720*.dvi
         
        3134*.pg
        3235*.pgs
         36
        3337README
        3438README.DOS
        3539README.W32
         40README.OS2
        3641aclocal.m4
        3742autom4te.cache
         
        5257config.h.W32
        5358config.h-vms
         59
        5460loadavg
        5561loadavg.c
        5662make
         63
        5764.deps
        5865.dep_segment
         66ID
         67TAGS
         68
        5969_*
        6070sun4
         
        7282sol2
        7383i486-linux
         84
        7485customs
         86
        7587install-sh
        7688mkinstalldirs
         89
         90.directive.asc
  • trunk/src/kmk/dir.c

    r1993 r2591  
    11/* Directory hashing 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
     
    2424# define NAMLEN(dirent) strlen((dirent)->d_name)
    2525# ifdef VMS
    26 char *vmsify (char *name, int type);
     26/* its prototype is in vmsdir.h, which is not needed for HAVE_DIRENT_H */
     27const char *vmsify (const char *name, int type);
    2728# endif
    2829#else
     
    133134  static PATH_VAR (new_filename);
    134135  char *df;
    135   int i;
    136136
    137137  if (filename == 0)
     
    139139
    140140  df = new_filename;
    141 
    142   /* First, transform the name part.  */
    143141  while (*filename != '\0')
    144142    {
     
    156154
    157155static int
    158 vms_hash (char *name)
     156vms_hash (const char *name)
    159157{
    160158  int h = 0;
     
    182180/* fake stat entry for a directory */
    183181static int
    184 vmsstat_dir (char *name, struct stat *st)
     182vmsstat_dir (const char *name, struct stat *st)
    185183{
    186184  char *s;
     
    195193  if (s)
    196194    {
     195      /* to keep the compiler happy we said "const char *name", now we cheat */
    197196      *s++ = 0;
    198197      st->st_dev = (char *)vms_hash (name);
     
    203202    {
    204203      st->st_dev = 0;
    205       s = name;
    206       h = vms_hash (s);
     204      h = vms_hash (name);
    207205    }
    208206
     
    496494#else
    497495  p = name + strlen (name);
     496# if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS)
     497  dir_key.name = strcache_add_len (downcase(name), p - name);
     498# else
    498499  dir_key.name = strcache_add_len (name, p - name);
     500# endif
    499501  dir_slot = (struct directory **) hash_find_slot_strcached (&directories, &dir_key);
    500502#endif
     
    516518#endif
    517519#ifndef CONFIG_WITH_STRCACHE2
     520#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS)
     521      dir->name = strcache_add_len (downcase(name), p - name);
     522#else
    518523      dir->name = strcache_add_len (name, p - name);
    519 #else
     524#endif
     525#else  /* CONFIG_WITH_STRCACHE2 */
    520526      dir->name = dir_key.name;
    521 #endif
     527#endif /* CONFIG_WITH_STRCACHE2 */
    522528      hash_insert_at (&directories, dir, dir_slot);
    523529      /* The directory is not in the name hash table.
     
    826832      dirfile_slot = (struct dirfile **) hash_find_slot (&dir->dirfiles, &dirfile_key);
    827833#else
     834# if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS)
     835      dirfile_key.name = strcache_add_len (downcase(d->d_name), len);
     836# else
    828837      dirfile_key.name = strcache_add_len (d->d_name, len);
     838# endif
    829839      dirfile_key.length = len;
    830840      dirfile_slot = (struct dirfile **) hash_find_slot_strcached (&dir->dirfiles, &dirfile_key);
     
    844854#endif
    845855#ifndef CONFIG_WITH_STRCACHE2
     856#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS)
     857          df->name = strcache_add_len (downcase(d->d_name), len);
     858#else
    846859          df->name = strcache_add_len (d->d_name, len);
    847 #else
     860#endif
     861#else  /* CONFIG_WITH_STRCACHE2 */
    848862          df->name = dirfile_key.name;
    849 #endif
     863#endif /* CONFIG_WITH_STRCACHE2 */
    850864          df->length = len;
    851865          df->impossible = 0;
     
    854868      /* Check if the name matches the one we're searching for.  */
    855869#ifndef CONFIG_WITH_STRCACHE2
    856       if (filename != 0 && strieq (d->d_name, filename))
     870      if (filename != 0 && patheq (d->d_name, filename))
    857871#else
    858872      if (filename != 0 && dirfile_key.name == filename)
     
    10101024
    10111025  if (dir->contents == 0)
    1012     {
    1013       /* The directory could not be stat'd.  We allocate a contents
    1014          structure for it, but leave it out of the contents hash table.  */
     1026    /* The directory could not be stat'd.  We allocate a contents
     1027       structure for it, but leave it out of the contents hash table.  */
    10151028#ifndef CONFIG_WITH_ALLOC_CACHES
    1016       dir->contents = xmalloc (sizeof (struct directory_contents));
    1017 #else
    1018       dir->contents = alloccache_alloc (&directory_contents_cache);
    1019 #endif
    1020       memset (dir->contents, '\0', sizeof (struct directory_contents));
    1021     }
     1029    dir->contents = xcalloc (sizeof (struct directory_contents));
     1030#else
     1031    dir->contents = alloccache_calloc (&directory_contents_cache);
     1032#endif
    10221033
    10231034  if (dir->contents->dirfiles.ht_vec == 0)
     
    10401051#endif
    10411052  new->length = strlen (filename);
     1053#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS)
     1054  new->name = strcache_add_len (downcase(filename), new->length);
     1055#else
    10421056  new->name = strcache_add_len (filename, new->length);
     1057#endif
    10431058  new->impossible = 1;
    10441059#ifndef CONFIG_WITH_STRCACHE2
Note: See TracChangeset for help on using the changeset viewer.