From a33462d0dcd57572b116e73700f4c4f058a5bdaf Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 11 May 2026 17:53:44 -0400 Subject: [PATCH 1/2] Align dir.c with 4.4 more closely --- src/dir.c | 69 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/src/dir.c b/src/dir.c index 69e53d9fa..0e148deaa 100644 --- a/src/dir.c +++ b/src/dir.c @@ -1,5 +1,5 @@ /* Directory hashing for GNU Make. -Copyright (C) 1988-2020 Free Software Foundation, Inc. +Copyright (C) 1988-2022 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify it under the @@ -12,12 +12,13 @@ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with -this program. If not, see . */ +this program. If not, see . */ #include "makeint.h" #include "hash.h" #include "filedef.h" #include "dep.h" +#include "debug.h" #ifdef HAVE_DIRENT_H # include @@ -164,7 +165,7 @@ vms_hash (const char *name) while (*name) { - unsigned char uc = *name; + unsigned char uc = (unsigned char) *name; int g; #ifdef HAVE_CASE_INSENSITIVE_FS h = (h << 4) + (isupper (uc) ? tolower (uc) : uc); @@ -221,6 +222,12 @@ vmsstat_dir (const char *name, struct stat *st) #endif /* _USE_STD_STAT */ #endif /* VMS */ +/* Never have more than this many directories open at once. */ + +#define MAX_OPEN_DIRECTORIES 10 + +static unsigned int open_directories = 0; + /* Hash table of directories. */ #ifndef DIRECTORY_BUCKETS @@ -251,9 +258,25 @@ struct directory_contents # endif #endif /* WINDOWS32 */ struct hash_table dirfiles; /* Files in this directory. */ + unsigned long counter; /* command_count value when last read. */ DIR *dirstream; /* Stream reading this directory. */ }; +static struct directory_contents * +clear_directory_contents (struct directory_contents *dc) +{ + dc->counter = 0; + if (dc->dirstream) + { + --open_directories; + closedir (dc->dirstream); + dc->dirstream = 0; + } + hash_free (&dc->dirfiles, 1); + + return NULL; +} + static unsigned long directory_contents_hash_1 (const void *key_0) { @@ -331,7 +354,9 @@ static struct hash_table directory_contents; struct directory { - const char *name; /* Name of the directory. */ + const char *name; /* Name of the directory. */ + unsigned long counter; /* command_count value when last read. + Used for non-existent directories. */ /* The directory's contents. This data may be shared by several entries in the hash table, which refer to the same directory @@ -361,12 +386,6 @@ directory_hash_cmp (const void *x, const void *y) /* Table of directories hashed by name. */ static struct hash_table directories; -/* Never have more than this many directories open at once. */ - -#define MAX_OPEN_DIRECTORIES 10 - -static unsigned int open_directories = 0; - /* Hash table of files in each directory. */ @@ -501,6 +520,10 @@ dir_contents_file_exists_p (struct directory_contents *dir, { struct dirfile *df; struct dirent *d; +#ifdef WINDOWS32 + struct stat st; + int rehash = 0; +#endif if (dir == 0 || dir->dirfiles.ht_vec == 0) /* The directory could not be stat'd or opened. */ @@ -609,10 +632,8 @@ file_exists_p (const char *name) const char *slash; #ifndef NO_ARCHIVES - { - if (ar_name (name)) - return ar_member_date (name) != (time_t) -1; - } + if (ar_name (name)) + return ar_member_date (name) != (time_t) -1; #endif dirend = strrchr (name, '/'); @@ -831,8 +852,6 @@ print_dir_data_base (void) /* Hooks for globbing. */ -#include - /* Structure describing state of iterating through a directory hash table. */ struct dirstream @@ -923,17 +942,10 @@ read_dirstream (__ptr_t stream) * On MS-Windows, stat() "succeeds" for foo/bar/. where foo/bar is a * regular file; fix that here. */ -#if !defined(stat) && !defined(WINDOWS32) || defined(VMS) -# ifndef VMS +#if !defined(stat) && !defined(WINDOWS32) # ifndef HAVE_SYS_STAT_H int stat (const char *path, struct stat *sbuf); # endif -# else - /* We are done with the fake stat. Go back to the real stat */ -# ifdef stat -# undef stat -# endif -# endif # define local_stat stat #else static int @@ -946,17 +958,10 @@ local_stat (const char *path, struct stat *buf) #endif /* Similarly for lstat. */ -#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS) -# ifndef VMS +#if !defined(lstat) && !defined(WINDOWS32) # ifndef HAVE_SYS_STAT_H int lstat (const char *path, struct stat *sbuf); # endif -# else - /* We are done with the fake lstat. Go back to the real lstat */ -# ifdef lstat -# undef lstat -# endif -# endif # define local_lstat lstat #elif defined(WINDOWS32) /* Windows doesn't support lstat(). */ From 7c889a35291321fe947ada2424deff7576eec75e Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 11 May 2026 17:59:06 -0400 Subject: [PATCH 2/2] http: -> https: and remake/make 4.4 sync --- src/getopt.c | 60 +++++++++++++++++++++------------------------------ src/getopt.h | 4 ++-- src/getopt1.c | 4 ++-- src/gettext.h | 4 ++-- src/git2cl | 6 +++--- 5 files changed, 33 insertions(+), 45 deletions(-) diff --git a/src/getopt.c b/src/getopt.c index 525e1b044..9f31a70dd 100644 --- a/src/getopt.c +++ b/src/getopt.c @@ -3,7 +3,7 @@ NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! -Copyright (C) 1987-2020 Free Software Foundation, Inc. +Copyright (C) 1987-2022 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. @@ -18,7 +18,7 @@ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with -this program. If not, see . */ +this program. If not, see . */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ @@ -40,12 +40,6 @@ this program. If not, see . */ #include -#ifdef _GNU_SOURCE -# define ATTRIBUTE_UNUSED __attribute__((unused)) -#else -# define ATTRIBUTE_UNUSED -#endif - /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling @@ -383,9 +377,7 @@ exchange (char **argv) static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * -_getopt_initialize (int argc ATTRIBUTE_UNUSED, - char *const *argv ATTRIBUTE_UNUSED, - const char *optstring) +_getopt_initialize (int argc, char *const *argv, const char *optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped @@ -434,7 +426,7 @@ _getopt_initialize (int argc ATTRIBUTE_UNUSED, if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else - memset (mempcpy (__getopt_nonoption_flags, orig_str, len), + memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } @@ -505,8 +497,7 @@ _getopt_initialize (int argc ATTRIBUTE_UNUSED, int _getopt_internal (int argc, char *const *argv, const char *optstring, - const struct option *longopts, - int *longind, int long_only) + const struct option *longopts, int *longind, int long_only) { optarg = NULL; @@ -665,7 +656,7 @@ _getopt_internal (int argc, char *const *argv, const char *optstring, if (ambig && !exact) { if (opterr) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + fprintf (stderr, _("%s: option '%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; @@ -686,23 +677,21 @@ _getopt_internal (int argc, char *const *argv, const char *optstring, else { if (opterr) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option '--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option '%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; } } else if (pfound->has_arg == 1) @@ -713,7 +702,7 @@ _getopt_internal (int argc, char *const *argv, const char *optstring, { if (opterr) fprintf (stderr, - _("%s: option `%s' requires an argument\n"), + _("%s: option '%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); optopt = pfound->val; @@ -742,11 +731,11 @@ _getopt_internal (int argc, char *const *argv, const char *optstring, { if (argv[optind][1] == '-') /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + fprintf (stderr, _("%s: unrecognized option '--%s'\n"), argv[0], nextchar); else /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + fprintf (stderr, _("%s: unrecognized option '%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; @@ -756,7 +745,6 @@ _getopt_internal (int argc, char *const *argv, const char *optstring, } } - /* Look at and handle the next short option-character. */ { diff --git a/src/getopt.h b/src/getopt.h index abfc31e70..f96172d0c 100644 --- a/src/getopt.h +++ b/src/getopt.h @@ -1,5 +1,5 @@ /* Declarations for getopt. -Copyright (C) 1989-2020 Free Software Foundation, Inc. +Copyright (C) 1989-2022 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. @@ -14,7 +14,7 @@ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with -this program. If not, see . */ +this program. If not, see . */ #ifndef _GETOPT_H #define _GETOPT_H 1 diff --git a/src/getopt1.c b/src/getopt1.c index 0bef6b03c..481a358b4 100644 --- a/src/getopt1.c +++ b/src/getopt1.c @@ -1,5 +1,5 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. -Copyright (C) 1987-1994, 1996-2020 Free Software Foundation, Inc. +Copyright (C) 1987-1994, 1996-2022 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. @@ -14,7 +14,7 @@ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with -this program. If not, see . */ +this program. If not, see . */ #ifdef HAVE_CONFIG_H #include diff --git a/src/gettext.h b/src/gettext.h index 8647b3704..9498fadaf 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU . -Copyright (C) 1995-2020 Free Software Foundation, Inc. +Copyright (C) 1995-2022 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify it under the @@ -12,7 +12,7 @@ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with -this program. If not, see . */ +this program. If not, see . */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 diff --git a/src/git2cl b/src/git2cl index 5d9b90c99..713ae5f8b 100755 --- a/src/git2cl +++ b/src/git2cl @@ -2,7 +2,7 @@ # Copyright (C) 2007, 2008 Simon Josefsson # Copyright (C) 2007 Luis Mondesi -# * calls git directly. To use it just: +# * calls git directly. To use it just: # cd ~/Project/my_git_repo; git2cl > ChangeLog # * implements strptime() # * fixes bugs in $comment parsing @@ -59,7 +59,7 @@ Thus, typically you would use it as follows: =head1 SEE ALSO Output format specification: - + =head1 AUTHORS @@ -350,7 +350,7 @@ while (my $_l = <$fh>) { $state = 1 if ($_l =~ m,^$, and $author and (@date+0>0)); } elsif ($state == 1) { # * modifying our input text is a bad choice - # let's make a copy of it first, then we remove spaces + # let's make a copy of it first, then we remove spaces # * if we meet a "merge branch" statement, we need to start # over and find a real entry # Luis Mondesi