Changeset 503 for trunk/src/gmake/dir.c
- Timestamp:
- Sep 15, 2006, 7:09:38 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/dir.c
r287 r503 1 1 /* Directory hashing for GNU Make. 2 Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 2002,2003 Free Software Foundation, Inc. 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software 4 Foundation, Inc. 4 5 This file is part of GNU Make. 5 6 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. */ 7 GNU Make is free software; you can redistribute it and/or modify it under the 8 terms of the GNU General Public License as published by the Free Software 9 Foundation; either version 2, or (at your option) any later version. 10 11 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY 12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License along with 16 GNU Make; see the file COPYING. If not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ 20 18 21 19 #include "make.h" … … 157 155 { 158 156 unsigned char uc = *name; 157 #ifdef HAVE_CASE_INSENSITIVE_FS 159 158 h = (h << 4) + (isupper (uc) ? tolower (uc) : uc); 159 #else 160 h = (h << 4) + uc; 161 #endif 160 162 name++; 161 163 g = h & 0xf0000000; … … 288 290 } 289 291 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 290 303 static int 291 304 directory_contents_hash_cmp (const void *xv, const void *yv) … … 299 312 if (result) 300 313 return result; 301 result = x->ctime - y->ctime;314 result = MAKECMP(x->ctime, y->ctime); 302 315 if (result) 303 316 return result; 304 317 #else 305 318 # ifdef VMS 306 result = x->ino[0] - y->ino[0];319 result = MAKECMP(x->ino[0], y->ino[0]); 307 320 if (result) 308 321 return result; 309 result = x->ino[1] - y->ino[1];322 result = MAKECMP(x->ino[1], y->ino[1]); 310 323 if (result) 311 324 return result; 312 result = x->ino[2] - y->ino[2];325 result = MAKECMP(x->ino[2], y->ino[2]); 313 326 if (result) 314 327 return result; 315 328 # else 316 result = x->ino - y->ino;329 result = MAKECMP(x->ino, y->ino); 317 330 if (result) 318 331 return result; … … 320 333 #endif /* WINDOWS32 */ 321 334 322 return x->dev - y->dev;335 return MAKECMP(x->dev, y->dev); 323 336 } 324 337 … … 419 432 char fs_label[BUFSIZ]; 420 433 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; 424 437 #endif 425 438 #ifdef VMS … … 631 644 * on directories (ugh!). 632 645 */ 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) 637 647 { 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; 648 668 } 649 669 else
Note:
See TracChangeset
for help on using the changeset viewer.