mirror of
https://github.com/mirror/make.git
synced 2025-02-05 01:00:11 +08:00
- Rename strieq() to patheq() for clarity.
- Convert xmalloc/memset pairs to xcalloc.
This commit is contained in:
parent
c0239cdbfa
commit
7746a1f74f
@ -1,3 +1,12 @@
|
|||||||
|
2010-01-10 Paul Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
* make.h (patheq): Rename strieq() to patheq() for clarity.
|
||||||
|
* dir.c (dir_contents_file_exists_p): Use it.
|
||||||
|
|
||||||
|
* dir.c (file_impossible): Convert xmalloc/memset to xcalloc.
|
||||||
|
* file.c (enter_file): Ditto.
|
||||||
|
* job.c (new_job): Ditto.
|
||||||
|
|
||||||
2009-12-11 Eli Zaretskii <eliz@gnu.org>
|
2009-12-11 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
* job.c (construct_command_argv_internal) <sh_cmds_dos>
|
* job.c (construct_command_argv_internal) <sh_cmds_dos>
|
||||||
|
7
dir.c
7
dir.c
@ -721,7 +721,7 @@ dir_contents_file_exists_p (struct directory_contents *dir,
|
|||||||
hash_insert_at (&dir->dirfiles, df, dirfile_slot);
|
hash_insert_at (&dir->dirfiles, df, dirfile_slot);
|
||||||
}
|
}
|
||||||
/* Check if the name matches the one we're searching for. */
|
/* Check if the name matches the one we're searching for. */
|
||||||
if (filename != 0 && strieq (d->d_name, filename))
|
if (filename != 0 && patheq (d->d_name, filename))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,12 +872,9 @@ file_impossible (const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dir->contents == 0)
|
if (dir->contents == 0)
|
||||||
{
|
|
||||||
/* The directory could not be stat'd. We allocate a contents
|
/* The directory could not be stat'd. We allocate a contents
|
||||||
structure for it, but leave it out of the contents hash table. */
|
structure for it, but leave it out of the contents hash table. */
|
||||||
dir->contents = xmalloc (sizeof (struct directory_contents));
|
dir->contents = xcalloc (sizeof (struct directory_contents));
|
||||||
memset (dir->contents, '\0', sizeof (struct directory_contents));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dir->contents->dirfiles.ht_vec == 0)
|
if (dir->contents->dirfiles.ht_vec == 0)
|
||||||
{
|
{
|
||||||
|
3
file.c
3
file.c
@ -181,8 +181,7 @@ enter_file (const char *name)
|
|||||||
if (! HASH_VACANT (f) && !f->double_colon)
|
if (! HASH_VACANT (f) && !f->double_colon)
|
||||||
return f;
|
return f;
|
||||||
|
|
||||||
new = xmalloc (sizeof (struct file));
|
new = xcalloc (sizeof (struct file));
|
||||||
memset (new, '\0', sizeof (struct file));
|
|
||||||
new->name = new->hname = name;
|
new->name = new->hname = name;
|
||||||
new->update_status = -1;
|
new->update_status = -1;
|
||||||
|
|
||||||
|
3
job.c
3
job.c
@ -1611,8 +1611,7 @@ new_job (struct file *file)
|
|||||||
/* Start the command sequence, record it in a new
|
/* Start the command sequence, record it in a new
|
||||||
`struct child', and add that to the chain. */
|
`struct child', and add that to the chain. */
|
||||||
|
|
||||||
c = xmalloc (sizeof (struct child));
|
c = xcalloc (sizeof (struct child));
|
||||||
memset (c, '\0', sizeof (struct child));
|
|
||||||
c->file = file;
|
c->file = file;
|
||||||
c->command_lines = lines;
|
c->command_lines = lines;
|
||||||
c->sh_batch_file = NULL;
|
c->sh_batch_file = NULL;
|
||||||
|
20
make.h
20
make.h
@ -264,23 +264,23 @@ char *strsignal (int signum);
|
|||||||
host does not conform to POSIX. */
|
host does not conform to POSIX. */
|
||||||
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
|
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
|
||||||
|
|
||||||
#ifndef iAPX286
|
/* Test if two strings are equal. Is this worthwhile? Should be profiled. */
|
||||||
# define streq(a, b) \
|
#define streq(a, b) \
|
||||||
((a) == (b) || \
|
((a) == (b) || \
|
||||||
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
|
(*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
|
||||||
# ifdef HAVE_CASE_INSENSITIVE_FS
|
|
||||||
# define strieq(a, b) \
|
/* Test if two strings are equal, but match case-insensitively on systems
|
||||||
|
which have case-insensitive filesystems. Should only be used for
|
||||||
|
filenames! */
|
||||||
|
#ifdef HAVE_CASE_INSENSITIVE_FS
|
||||||
|
# define patheq(a, b) \
|
||||||
((a) == (b) \
|
((a) == (b) \
|
||||||
|| (tolower((unsigned char)*(a)) == tolower((unsigned char)*(b)) \
|
|| (tolower((unsigned char)*(a)) == tolower((unsigned char)*(b)) \
|
||||||
&& (*(a) == '\0' || !strcasecmp ((a) + 1, (b) + 1))))
|
&& (*(a) == '\0' || !strcasecmp ((a) + 1, (b) + 1))))
|
||||||
# else
|
|
||||||
# define strieq(a, b) streq(a, b)
|
|
||||||
# endif
|
|
||||||
#else
|
#else
|
||||||
/* Buggy compiler can't handle this. */
|
# define patheq(a, b) streq(a, b)
|
||||||
# define streq(a, b) (strcmp ((a), (b)) == 0)
|
|
||||||
# define strieq(a, b) (strcmp ((a), (b)) == 0)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0)
|
#define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0)
|
||||||
|
|
||||||
#if defined(__GNUC__) || defined(ENUM_BITFIELDS)
|
#if defined(__GNUC__) || defined(ENUM_BITFIELDS)
|
||||||
|
Loading…
Reference in New Issue
Block a user