mirror of
https://github.com/mirror/make.git
synced 2024-12-27 13:20:34 +08:00
[Bug #39158] Source cleanups suggested by cppcheck utility.
This commit is contained in:
parent
72462ef1e1
commit
87ac68fe79
20
ChangeLog
20
ChangeLog
@ -1,5 +1,25 @@
|
|||||||
2013-07-21 Paul Smith <psmith@gnu.org>
|
2013-07-21 Paul Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
Cleanups detected by cppcheck. Fixes Savannah bug #39158.
|
||||||
|
* arscan.c (ar_scan): Reduce the scope of local variables.
|
||||||
|
* dir.c (vms_hash): Ditto.
|
||||||
|
(find_directory): Ditto.
|
||||||
|
(file_impossible_p): Ditto.
|
||||||
|
* expand.c (variable_expand_string): Ditto.
|
||||||
|
* function.c (func_sort): Ditto.
|
||||||
|
(func_and): Ditto.
|
||||||
|
* job.c (reap_children): Ditto.
|
||||||
|
(exec_command): Ditto.
|
||||||
|
* main.c (main): Ditto.
|
||||||
|
* misc.c (collapse_continuations): Ditto.
|
||||||
|
* read.c (eval): Ditto.
|
||||||
|
(parse_file_seq): Ditto.
|
||||||
|
* vpath.c (gpath_search): Ditto.
|
||||||
|
(selective_vpath_search): Ditto.
|
||||||
|
* job.c (is_bourne_compatible_shell): Simplify for non-Windows systems.
|
||||||
|
* remake.c (f_mtime): Remove duplicate test.
|
||||||
|
* signame.c (strsignal): Fix bogus conditional.
|
||||||
|
|
||||||
* job.c (assign_child_tempfiles): Assign OUTFD to -1 for safety.
|
* job.c (assign_child_tempfiles): Assign OUTFD to -1 for safety.
|
||||||
(start_job_command): Don't test output_sync and sync_cmd: redundant.
|
(start_job_command): Don't test output_sync and sync_cmd: redundant.
|
||||||
Changes suggested by Frank Heckenbach <f.heckenbach@fh-soft.de>.
|
Changes suggested by Frank Heckenbach <f.heckenbach@fh-soft.de>.
|
||||||
|
7
arscan.c
7
arscan.c
@ -328,12 +328,10 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
|
|||||||
{
|
{
|
||||||
#ifdef AIAMAG
|
#ifdef AIAMAG
|
||||||
FL_HDR fl_header;
|
FL_HDR fl_header;
|
||||||
#ifdef AIAMAGBIG
|
# ifdef AIAMAGBIG
|
||||||
int big_archive = 0;
|
int big_archive = 0;
|
||||||
FL_HDR_BIG fl_header_big;
|
FL_HDR_BIG fl_header_big;
|
||||||
#endif
|
# endif
|
||||||
#else
|
|
||||||
int long_name = 0;
|
|
||||||
#endif
|
#endif
|
||||||
char *namemap = 0;
|
char *namemap = 0;
|
||||||
int desc = open (archive, O_RDONLY, 0);
|
int desc = open (archive, O_RDONLY, 0);
|
||||||
@ -461,6 +459,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
|
|||||||
char namebuf[sizeof member_header.ar_name + 1];
|
char namebuf[sizeof member_header.ar_name + 1];
|
||||||
char *name;
|
char *name;
|
||||||
int is_namemap; /* Nonzero if this entry maps long names. */
|
int is_namemap; /* Nonzero if this entry maps long names. */
|
||||||
|
int long_name = 0;
|
||||||
#endif
|
#endif
|
||||||
long int eltsize;
|
long int eltsize;
|
||||||
int eltmode;
|
int eltmode;
|
||||||
|
50
dir.c
50
dir.c
@ -145,11 +145,11 @@ static int
|
|||||||
vms_hash (const char *name)
|
vms_hash (const char *name)
|
||||||
{
|
{
|
||||||
int h = 0;
|
int h = 0;
|
||||||
int g;
|
|
||||||
|
|
||||||
while (*name)
|
while (*name)
|
||||||
{
|
{
|
||||||
unsigned char uc = *name;
|
unsigned char uc = *name;
|
||||||
|
int g;
|
||||||
#ifdef HAVE_CASE_INSENSITIVE_FS
|
#ifdef HAVE_CASE_INSENSITIVE_FS
|
||||||
h = (h << 4) + (isupper (uc) ? tolower (uc) : uc);
|
h = (h << 4) + (isupper (uc) ? tolower (uc) : uc);
|
||||||
#else
|
#else
|
||||||
@ -414,19 +414,10 @@ static struct directory *find_directory (const char *name);
|
|||||||
static struct directory *
|
static struct directory *
|
||||||
find_directory (const char *name)
|
find_directory (const char *name)
|
||||||
{
|
{
|
||||||
const char *p;
|
|
||||||
struct directory *dir;
|
struct directory *dir;
|
||||||
struct directory **dir_slot;
|
struct directory **dir_slot;
|
||||||
struct directory dir_key;
|
struct directory dir_key;
|
||||||
int r;
|
|
||||||
#ifdef WINDOWS32
|
|
||||||
char* w32_path;
|
|
||||||
char fs_label[BUFSIZ];
|
|
||||||
char fs_type[BUFSIZ];
|
|
||||||
unsigned long fs_serno;
|
|
||||||
unsigned long fs_flags;
|
|
||||||
unsigned long fs_len;
|
|
||||||
#endif
|
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
if ((*name == '.') && (*(name+1) == 0))
|
if ((*name == '.') && (*(name+1) == 0))
|
||||||
name = "[]";
|
name = "[]";
|
||||||
@ -440,11 +431,11 @@ find_directory (const char *name)
|
|||||||
|
|
||||||
if (HASH_VACANT (dir))
|
if (HASH_VACANT (dir))
|
||||||
{
|
{
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
/* The directory was not found. Create a new entry for it. */
|
/* The directory was not found. Create a new entry for it. */
|
||||||
|
const char *p = name + strlen (name);
|
||||||
|
struct stat st;
|
||||||
|
int r;
|
||||||
|
|
||||||
p = name + strlen (name);
|
|
||||||
dir = xmalloc (sizeof (struct directory));
|
dir = xmalloc (sizeof (struct directory));
|
||||||
#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS)
|
#if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS)
|
||||||
dir->name = strcache_add_len (downcase (name), p - name);
|
dir->name = strcache_add_len (downcase (name), p - name);
|
||||||
@ -488,6 +479,9 @@ find_directory (const char *name)
|
|||||||
{
|
{
|
||||||
/* Search the contents hash table; device and inode are the key. */
|
/* Search the contents hash table; device and inode are the key. */
|
||||||
|
|
||||||
|
#ifdef WINDOWS32
|
||||||
|
char *w32_path;
|
||||||
|
#endif
|
||||||
struct directory_contents *dc;
|
struct directory_contents *dc;
|
||||||
struct directory_contents **dc_slot;
|
struct directory_contents **dc_slot;
|
||||||
struct directory_contents dc_key;
|
struct directory_contents dc_key;
|
||||||
@ -511,7 +505,13 @@ find_directory (const char *name)
|
|||||||
if (HASH_VACANT (dc))
|
if (HASH_VACANT (dc))
|
||||||
{
|
{
|
||||||
/* Nope; this really is a directory we haven't seen before. */
|
/* Nope; this really is a directory we haven't seen before. */
|
||||||
|
#ifdef WINDOWS32
|
||||||
|
char fs_label[BUFSIZ];
|
||||||
|
char fs_type[BUFSIZ];
|
||||||
|
unsigned long fs_serno;
|
||||||
|
unsigned long fs_flags;
|
||||||
|
unsigned long fs_len;
|
||||||
|
#endif
|
||||||
dc = (struct directory_contents *)
|
dc = (struct directory_contents *)
|
||||||
xmalloc (sizeof (struct directory_contents));
|
xmalloc (sizeof (struct directory_contents));
|
||||||
|
|
||||||
@ -522,11 +522,8 @@ find_directory (const char *name)
|
|||||||
dc->ctime = st.st_ctime;
|
dc->ctime = st.st_ctime;
|
||||||
dc->mtime = st.st_mtime;
|
dc->mtime = st.st_mtime;
|
||||||
|
|
||||||
/*
|
/* NTFS is the only WINDOWS32 filesystem that bumps mtime on a
|
||||||
* NTFS is the only WINDOWS32 filesystem that bumps mtime
|
directory when files are added/deleted from a directory. */
|
||||||
* on a directory when files are added/deleted from
|
|
||||||
* a directory.
|
|
||||||
*/
|
|
||||||
w32_path[3] = '\0';
|
w32_path[3] = '\0';
|
||||||
if (GetVolumeInformation (w32_path, fs_label, sizeof (fs_label),
|
if (GetVolumeInformation (w32_path, fs_label, sizeof (fs_label),
|
||||||
&fs_serno, &fs_len, &fs_flags, fs_type,
|
&fs_serno, &fs_len, &fs_flags, fs_type,
|
||||||
@ -894,7 +891,6 @@ int
|
|||||||
file_impossible_p (const char *filename)
|
file_impossible_p (const char *filename)
|
||||||
{
|
{
|
||||||
const char *dirend;
|
const char *dirend;
|
||||||
const char *p = filename;
|
|
||||||
struct directory_contents *dir;
|
struct directory_contents *dir;
|
||||||
struct dirfile *dirfile;
|
struct dirfile *dirfile;
|
||||||
struct dirfile dirfile_key;
|
struct dirfile dirfile_key;
|
||||||
@ -939,12 +935,12 @@ file_impossible_p (const char *filename)
|
|||||||
dirend++;
|
dirend++;
|
||||||
#endif
|
#endif
|
||||||
cp = alloca (dirend - filename + 1);
|
cp = alloca (dirend - filename + 1);
|
||||||
memcpy (cp, p, dirend - p);
|
memcpy (cp, filename, dirend - filename);
|
||||||
cp[dirend - p] = '\0';
|
cp[dirend - filename] = '\0';
|
||||||
dirname = cp;
|
dirname = cp;
|
||||||
}
|
}
|
||||||
dir = find_directory (dirname)->contents;
|
dir = find_directory (dirname)->contents;
|
||||||
p = filename = slash + 1;
|
filename = slash + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir == 0 || dir->dirfiles.ht_vec == 0)
|
if (dir == 0 || dir->dirfiles.ht_vec == 0)
|
||||||
@ -952,13 +948,13 @@ file_impossible_p (const char *filename)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef __MSDOS__
|
#ifdef __MSDOS__
|
||||||
filename = dosify (p);
|
filename = dosify (filename);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CASE_INSENSITIVE_FS
|
#ifdef HAVE_CASE_INSENSITIVE_FS
|
||||||
filename = downcase (p);
|
filename = downcase (filename);
|
||||||
#endif
|
#endif
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
filename = vmsify (p, 1);
|
filename = vmsify (filename, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dirfile_key.name = filename;
|
dirfile_key.name = filename;
|
||||||
|
10
expand.c
10
expand.c
@ -304,10 +304,8 @@ variable_expand_string (char *line, const char *string, long length)
|
|||||||
if (colon)
|
if (colon)
|
||||||
{
|
{
|
||||||
/* This looks like a substitution reference: $(FOO:A=B). */
|
/* This looks like a substitution reference: $(FOO:A=B). */
|
||||||
const char *subst_beg, *subst_end, *replace_beg, *replace_end;
|
const char *subst_beg = colon + 1;
|
||||||
|
const char *subst_end = lindex (subst_beg, end, '=');
|
||||||
subst_beg = colon + 1;
|
|
||||||
subst_end = lindex (subst_beg, end, '=');
|
|
||||||
if (subst_end == 0)
|
if (subst_end == 0)
|
||||||
/* There is no = in sight. Punt on the substitution
|
/* There is no = in sight. Punt on the substitution
|
||||||
reference and treat this as a variable name containing
|
reference and treat this as a variable name containing
|
||||||
@ -315,8 +313,8 @@ variable_expand_string (char *line, const char *string, long length)
|
|||||||
colon = 0;
|
colon = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
replace_beg = subst_end + 1;
|
const char *replace_beg = subst_end + 1;
|
||||||
replace_end = end;
|
const char *replace_end = end;
|
||||||
|
|
||||||
/* Extract the variable name before the colon
|
/* Extract the variable name before the colon
|
||||||
and look up that variable. */
|
and look up that variable. */
|
||||||
|
@ -1113,7 +1113,6 @@ func_sort (char *o, char **argv, const char *funcname UNUSED)
|
|||||||
int wordi;
|
int wordi;
|
||||||
char *p;
|
char *p;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Find the maximum number of words we'll have. */
|
/* Find the maximum number of words we'll have. */
|
||||||
t = argv[0];
|
t = argv[0];
|
||||||
@ -1138,6 +1137,8 @@ func_sort (char *o, char **argv, const char *funcname UNUSED)
|
|||||||
|
|
||||||
if (wordi)
|
if (wordi)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
/* Now sort the list of words. */
|
/* Now sort the list of words. */
|
||||||
qsort (words, wordi, sizeof (char *), alpha_compare);
|
qsort (words, wordi, sizeof (char *), alpha_compare);
|
||||||
|
|
||||||
@ -1281,12 +1282,12 @@ static char *
|
|||||||
func_and (char *o, char **argv, const char *funcname UNUSED)
|
func_and (char *o, char **argv, const char *funcname UNUSED)
|
||||||
{
|
{
|
||||||
char *expansion;
|
char *expansion;
|
||||||
int result;
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
const char *begp = *argv;
|
const char *begp = *argv;
|
||||||
const char *endp = begp + strlen (*argv) - 1;
|
const char *endp = begp + strlen (*argv) - 1;
|
||||||
|
int result;
|
||||||
|
|
||||||
/* An empty condition is always false. */
|
/* An empty condition is always false. */
|
||||||
strip_whitespace (&begp, &endp);
|
strip_whitespace (&begp, &endp);
|
||||||
|
30
job.c
30
job.c
@ -427,8 +427,8 @@ _is_unixy_shell (const char *path)
|
|||||||
int
|
int
|
||||||
is_bourne_compatible_shell (const char *path)
|
is_bourne_compatible_shell (const char *path)
|
||||||
{
|
{
|
||||||
/* list of known unix (Bourne-like) shells */
|
/* List of known POSIX (or POSIX-ish) shells. */
|
||||||
const char *unix_shells[] = {
|
static const char *unix_shells[] = {
|
||||||
"sh",
|
"sh",
|
||||||
"bash",
|
"bash",
|
||||||
"ksh",
|
"ksh",
|
||||||
@ -438,7 +438,7 @@ is_bourne_compatible_shell (const char *path)
|
|||||||
"dash",
|
"dash",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
unsigned i, len;
|
const char **s;
|
||||||
|
|
||||||
/* find the rightmost '/' or '\\' */
|
/* find the rightmost '/' or '\\' */
|
||||||
const char *name = strrchr (path, '/');
|
const char *name = strrchr (path, '/');
|
||||||
@ -451,18 +451,18 @@ is_bourne_compatible_shell (const char *path)
|
|||||||
else if (!name) /* name and p must be 0 */
|
else if (!name) /* name and p must be 0 */
|
||||||
name = path;
|
name = path;
|
||||||
|
|
||||||
if (*name == '/' || *name == '\\') name++;
|
if (*name == '/' || *name == '\\')
|
||||||
|
++name;
|
||||||
|
|
||||||
/* this should be able to deal with extensions on Windows-like systems */
|
/* this should be able to deal with extensions on Windows-like systems */
|
||||||
for (i = 0; unix_shells[i] != NULL; i++)
|
for (s = unix_shells; *s != NULL; ++s)
|
||||||
{
|
{
|
||||||
len = strlen (unix_shells[i]);
|
|
||||||
#if defined(WINDOWS32) || defined(__MSDOS__)
|
#if defined(WINDOWS32) || defined(__MSDOS__)
|
||||||
if ((strncasecmp (name, unix_shells[i], len) == 0) &&
|
unsigned int len = strlen (*s);
|
||||||
(strlen (name) >= len && STOP_SET (name[len], MAP_DOT|MAP_NUL)))
|
if ((strlen (name) >= len && STOP_SET (name[len], MAP_DOT|MAP_NUL))
|
||||||
|
&& strncasecmp (name, *s, len) == 0)
|
||||||
#else
|
#else
|
||||||
if ((strncmp (name, unix_shells[i], len) == 0) &&
|
if (strcmp (name, *s) == 0)
|
||||||
(strlen (name) >= len && name[len] == '\0'))
|
|
||||||
#endif
|
#endif
|
||||||
return 1; /* a known unix-style shell */
|
return 1; /* a known unix-style shell */
|
||||||
}
|
}
|
||||||
@ -992,7 +992,6 @@ reap_children (int block, int err)
|
|||||||
#ifdef WINDOWS32
|
#ifdef WINDOWS32
|
||||||
{
|
{
|
||||||
HANDLE hPID;
|
HANDLE hPID;
|
||||||
int werr;
|
|
||||||
HANDLE hcTID, hcPID;
|
HANDLE hcTID, hcPID;
|
||||||
DWORD dwWaitStatus = 0;
|
DWORD dwWaitStatus = 0;
|
||||||
exit_code = 0;
|
exit_code = 0;
|
||||||
@ -1021,9 +1020,8 @@ reap_children (int block, int err)
|
|||||||
hPID = process_wait_for_any (block, &dwWaitStatus);
|
hPID = process_wait_for_any (block, &dwWaitStatus);
|
||||||
if (hPID)
|
if (hPID)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* was an error found on this process? */
|
/* was an error found on this process? */
|
||||||
werr = process_last_err (hPID);
|
int werr = process_last_err (hPID);
|
||||||
|
|
||||||
/* get exit data */
|
/* get exit data */
|
||||||
exit_code = process_exit_code (hPID);
|
exit_code = process_exit_code (hPID);
|
||||||
@ -2553,7 +2551,6 @@ exec_command (char **argv, char **envp)
|
|||||||
#ifdef WINDOWS32
|
#ifdef WINDOWS32
|
||||||
HANDLE hPID;
|
HANDLE hPID;
|
||||||
HANDLE hWaitPID;
|
HANDLE hWaitPID;
|
||||||
int err = 0;
|
|
||||||
int exit_code = EXIT_FAILURE;
|
int exit_code = EXIT_FAILURE;
|
||||||
|
|
||||||
/* make sure CreateProcess() has Path it needs */
|
/* make sure CreateProcess() has Path it needs */
|
||||||
@ -2579,7 +2576,7 @@ exec_command (char **argv, char **envp)
|
|||||||
while (hWaitPID)
|
while (hWaitPID)
|
||||||
{
|
{
|
||||||
/* was an error found on this process? */
|
/* was an error found on this process? */
|
||||||
err = process_last_err (hWaitPID);
|
int err = process_last_err (hWaitPID);
|
||||||
|
|
||||||
/* get exit data */
|
/* get exit data */
|
||||||
exit_code = process_exit_code (hWaitPID);
|
exit_code = process_exit_code (hWaitPID);
|
||||||
@ -2618,10 +2615,8 @@ exec_command (char **argv, char **envp)
|
|||||||
child_access ();
|
child_access ();
|
||||||
|
|
||||||
# ifdef __EMX__
|
# ifdef __EMX__
|
||||||
|
|
||||||
/* Run the program. */
|
/* Run the program. */
|
||||||
pid = spawnvpe (P_NOWAIT, argv[0], argv, envp);
|
pid = spawnvpe (P_NOWAIT, argv[0], argv, envp);
|
||||||
|
|
||||||
if (pid >= 0)
|
if (pid >= 0)
|
||||||
return pid;
|
return pid;
|
||||||
|
|
||||||
@ -2630,7 +2625,6 @@ exec_command (char **argv, char **envp)
|
|||||||
errno = ENOEXEC;
|
errno = ENOEXEC;
|
||||||
|
|
||||||
# else
|
# else
|
||||||
|
|
||||||
/* Run the program. */
|
/* Run the program. */
|
||||||
environ = envp;
|
environ = envp;
|
||||||
execvp (argv[0], argv);
|
execvp (argv[0], argv);
|
||||||
|
3
main.c
3
main.c
@ -1232,11 +1232,10 @@ main (int argc, char **argv, char **envp)
|
|||||||
if (program == 0)
|
if (program == 0)
|
||||||
{
|
{
|
||||||
/* Extract program from full path */
|
/* Extract program from full path */
|
||||||
int argv0_len;
|
|
||||||
program = strrchr (argv[0], '\\');
|
program = strrchr (argv[0], '\\');
|
||||||
if (program)
|
if (program)
|
||||||
{
|
{
|
||||||
argv0_len = strlen (program);
|
int argv0_len = strlen (program);
|
||||||
if (argv0_len > 4 && streq (&program[argv0_len - 4], ".exe"))
|
if (argv0_len > 4 && streq (&program[argv0_len - 4], ".exe"))
|
||||||
/* Remove .exe extension */
|
/* Remove .exe extension */
|
||||||
program[argv0_len - 4] = '\0';
|
program[argv0_len - 4] = '\0';
|
||||||
|
8
misc.c
8
misc.c
@ -50,9 +50,7 @@ alpha_compare (const void *v1, const void *v2)
|
|||||||
void
|
void
|
||||||
collapse_continuations (char *line)
|
collapse_continuations (char *line)
|
||||||
{
|
{
|
||||||
register char *in, *out, *p;
|
char *in, *out, *p;
|
||||||
register int backslash;
|
|
||||||
register unsigned int bs_write;
|
|
||||||
|
|
||||||
in = strchr (line, '\n');
|
in = strchr (line, '\n');
|
||||||
if (in == 0)
|
if (in == 0)
|
||||||
@ -67,8 +65,8 @@ collapse_continuations (char *line)
|
|||||||
/* BS_WRITE gets the number of quoted backslashes at
|
/* BS_WRITE gets the number of quoted backslashes at
|
||||||
the end just before IN, and BACKSLASH gets nonzero
|
the end just before IN, and BACKSLASH gets nonzero
|
||||||
if the next character is quoted. */
|
if the next character is quoted. */
|
||||||
backslash = 0;
|
unsigned int backslash = 0;
|
||||||
bs_write = 0;
|
unsigned int bs_write = 0;
|
||||||
for (p = in - 1; p >= line && *p == '\\'; --p)
|
for (p = in - 1; p >= line && *p == '\\'; --p)
|
||||||
{
|
{
|
||||||
if (backslash)
|
if (backslash)
|
||||||
|
5
read.c
5
read.c
@ -1297,14 +1297,13 @@ eval (struct ebuffer *ebuf, int set_default)
|
|||||||
|
|
||||||
if (set_default && default_goal_var->value[0] == '\0')
|
if (set_default && default_goal_var->value[0] == '\0')
|
||||||
{
|
{
|
||||||
const char *name;
|
|
||||||
struct dep *d;
|
struct dep *d;
|
||||||
struct nameseq *t = filenames;
|
struct nameseq *t = filenames;
|
||||||
|
|
||||||
for (; t != 0; t = t->next)
|
for (; t != 0; t = t->next)
|
||||||
{
|
{
|
||||||
int reject = 0;
|
int reject = 0;
|
||||||
name = t->name;
|
const char *name = t->name;
|
||||||
|
|
||||||
/* We have nothing to do if this is an implicit rule. */
|
/* We have nothing to do if this is an implicit rule. */
|
||||||
if (strchr (name, '%') != 0)
|
if (strchr (name, '%') != 0)
|
||||||
@ -2981,7 +2980,6 @@ parse_file_seq (char **stringp, unsigned int size, int stopmap,
|
|||||||
/* tmp points to tmpbuf after the prefix, if any.
|
/* tmp points to tmpbuf after the prefix, if any.
|
||||||
tp is the end of the buffer. */
|
tp is the end of the buffer. */
|
||||||
static char *tmpbuf = NULL;
|
static char *tmpbuf = NULL;
|
||||||
static int tmpbuf_len = 0;
|
|
||||||
|
|
||||||
int cachep = NONE_SET (flags, PARSEFS_NOCACHE);
|
int cachep = NONE_SET (flags, PARSEFS_NOCACHE);
|
||||||
|
|
||||||
@ -3009,6 +3007,7 @@ parse_file_seq (char **stringp, unsigned int size, int stopmap,
|
|||||||
|
|
||||||
/* Get enough temporary space to construct the largest possible target. */
|
/* Get enough temporary space to construct the largest possible target. */
|
||||||
{
|
{
|
||||||
|
static int tmpbuf_len = 0;
|
||||||
int l = strlen (*stringp) + 1;
|
int l = strlen (*stringp) + 1;
|
||||||
if (l > tmpbuf_len)
|
if (l > tmpbuf_len)
|
||||||
{
|
{
|
||||||
|
1
remake.c
1
remake.c
@ -1402,7 +1402,6 @@ f_mtime (struct file *file, int search)
|
|||||||
started. So, turn off the intermediate bit so make doesn't
|
started. So, turn off the intermediate bit so make doesn't
|
||||||
delete it, since it didn't create it. */
|
delete it, since it didn't create it. */
|
||||||
if (mtime != NONEXISTENT_MTIME && file->command_state == cs_not_started
|
if (mtime != NONEXISTENT_MTIME && file->command_state == cs_not_started
|
||||||
&& file->command_state == cs_not_started
|
|
||||||
&& !file->tried_implicit && file->intermediate)
|
&& !file->tried_implicit && file->intermediate)
|
||||||
file->intermediate = 0;
|
file->intermediate = 0;
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ strsignal (int sig)
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sig > 0 || sig < NSIG)
|
if (sig > 0 && sig < NSIG)
|
||||||
return (char *) sys_siglist[sig];
|
return (char *) sys_siglist[sig];
|
||||||
|
|
||||||
sprintf (buf, "Signal %d", sig);
|
sprintf (buf, "Signal %d", sig);
|
||||||
|
19
vpath.c
19
vpath.c
@ -306,12 +306,13 @@ construct_vpath_list (char *pattern, char *dirpath)
|
|||||||
int
|
int
|
||||||
gpath_search (const char *file, unsigned int len)
|
gpath_search (const char *file, unsigned int len)
|
||||||
{
|
{
|
||||||
const char **gp;
|
|
||||||
|
|
||||||
if (gpaths && (len <= gpaths->maxlen))
|
if (gpaths && (len <= gpaths->maxlen))
|
||||||
for (gp = gpaths->searchpath; *gp != NULL; ++gp)
|
{
|
||||||
if (strneq (*gp, file, len) && (*gp)[len] == '\0')
|
const char **gp;
|
||||||
return 1;
|
for (gp = gpaths->searchpath; *gp != NULL; ++gp)
|
||||||
|
if (strneq (*gp, file, len) && (*gp)[len] == '\0')
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -334,7 +335,7 @@ selective_vpath_search (struct vpath *path, const char *file,
|
|||||||
const char **vpath = path->searchpath;
|
const char **vpath = path->searchpath;
|
||||||
unsigned int maxvpath = path->maxlen;
|
unsigned int maxvpath = path->maxlen;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int flen, vlen, name_dplen;
|
unsigned int flen, name_dplen;
|
||||||
int exists = 0;
|
int exists = 0;
|
||||||
|
|
||||||
/* Find out if *FILE is a target.
|
/* Find out if *FILE is a target.
|
||||||
@ -374,12 +375,10 @@ selective_vpath_search (struct vpath *path, const char *file,
|
|||||||
for (i = 0; vpath[i] != 0; ++i)
|
for (i = 0; vpath[i] != 0; ++i)
|
||||||
{
|
{
|
||||||
int exists_in_cache = 0;
|
int exists_in_cache = 0;
|
||||||
char *p;
|
char *p = name;
|
||||||
|
unsigned int vlen = strlen (vpath[i]);
|
||||||
p = name;
|
|
||||||
|
|
||||||
/* Put the next VPATH entry into NAME at P and increment P past it. */
|
/* Put the next VPATH entry into NAME at P and increment P past it. */
|
||||||
vlen = strlen (vpath[i]);
|
|
||||||
memcpy (p, vpath[i], vlen);
|
memcpy (p, vpath[i], vlen);
|
||||||
p += vlen;
|
p += vlen;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user