mirror of
https://github.com/mirror/make.git
synced 2025-02-04 08:40:27 +08:00
- Add static pattern targets to the string cache.
- Use specific free_*() calls where appropriate.
This commit is contained in:
parent
44ac2cdb4d
commit
8688ef20cf
@ -1,6 +1,12 @@
|
|||||||
2009-09-26 Paul Smith <psmith@gnu.org>
|
2009-09-26 Paul Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
* read.c (record_files): Use free_ns() to free struct nameseq.
|
||||||
|
(eval): Ditto.
|
||||||
|
|
||||||
|
* rule.c (freerule): Use free_dep_chain().
|
||||||
|
|
||||||
* read.c (record_files): Free FILENAMES chain for implicit rules.
|
* read.c (record_files): Free FILENAMES chain for implicit rules.
|
||||||
|
(eval): Static pattern targets go into the string cache.
|
||||||
|
|
||||||
* function.c (string_glob): Free NAME in the nameseq chain.
|
* function.c (string_glob): Free NAME in the nameseq chain.
|
||||||
|
|
||||||
|
3
dep.h
3
dep.h
@ -80,7 +80,8 @@ struct nameseq *ar_glob (const char *arname, const char *member_pattern, unsigne
|
|||||||
#define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name)
|
#define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name)
|
||||||
|
|
||||||
#define alloc_dep() (xcalloc (sizeof (struct dep)))
|
#define alloc_dep() (xcalloc (sizeof (struct dep)))
|
||||||
#define free_dep(_d) free (_d)
|
#define free_ns(_n) free (_n)
|
||||||
|
#define free_dep(_d) free_ns (_d)
|
||||||
|
|
||||||
struct dep *copy_dep_chain (const struct dep *d);
|
struct dep *copy_dep_chain (const struct dep *d);
|
||||||
void free_dep_chain (struct dep *d);
|
void free_dep_chain (struct dep *d);
|
||||||
|
14
read.c
14
read.c
@ -852,7 +852,7 @@ eval (struct ebuffer *ebuf, int set_default)
|
|||||||
const char *name = files->name;
|
const char *name = files->name;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
free (files);
|
free_ns (files);
|
||||||
files = next;
|
files = next;
|
||||||
|
|
||||||
r = eval_makefile (name,
|
r = eval_makefile (name,
|
||||||
@ -1142,7 +1142,7 @@ eval (struct ebuffer *ebuf, int set_default)
|
|||||||
{
|
{
|
||||||
struct nameseq *target;
|
struct nameseq *target;
|
||||||
target = PARSE_FILE_SEQ (&p2, struct nameseq, ':', NULL,
|
target = PARSE_FILE_SEQ (&p2, struct nameseq, ':', NULL,
|
||||||
PARSEFS_NOGLOB|PARSEFS_NOCACHE);
|
PARSEFS_NOGLOB);
|
||||||
++p2;
|
++p2;
|
||||||
if (target == 0)
|
if (target == 0)
|
||||||
fatal (fstart, _("missing target pattern"));
|
fatal (fstart, _("missing target pattern"));
|
||||||
@ -1152,7 +1152,7 @@ eval (struct ebuffer *ebuf, int set_default)
|
|||||||
pattern = target->name;
|
pattern = target->name;
|
||||||
if (pattern_percent == 0)
|
if (pattern_percent == 0)
|
||||||
fatal (fstart, _("target pattern contains no `%%'"));
|
fatal (fstart, _("target pattern contains no `%%'"));
|
||||||
free (target);
|
free_ns (target);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pattern = 0;
|
pattern = 0;
|
||||||
@ -1779,7 +1779,7 @@ record_target_var (struct nameseq *filenames, char *defn,
|
|||||||
struct pattern_var *p;
|
struct pattern_var *p;
|
||||||
|
|
||||||
nextf = filenames->next;
|
nextf = filenames->next;
|
||||||
free (filenames);
|
free_ns (filenames);
|
||||||
|
|
||||||
/* If it's a pattern target, then add it to the pattern-specific
|
/* If it's a pattern target, then add it to the pattern-specific
|
||||||
variable list. */
|
variable list. */
|
||||||
@ -1938,7 +1938,7 @@ record_files (struct nameseq *filenames, const char *pattern,
|
|||||||
/* Count the targets to create an array of target names.
|
/* Count the targets to create an array of target names.
|
||||||
We already have the first one. */
|
We already have the first one. */
|
||||||
nextf = filenames->next;
|
nextf = filenames->next;
|
||||||
free (filenames);
|
free_ns (filenames);
|
||||||
filenames = nextf;
|
filenames = nextf;
|
||||||
|
|
||||||
for (c = 1; nextf; ++c, nextf = nextf->next)
|
for (c = 1; nextf; ++c, nextf = nextf->next)
|
||||||
@ -1963,7 +1963,7 @@ record_files (struct nameseq *filenames, const char *pattern,
|
|||||||
++c;
|
++c;
|
||||||
|
|
||||||
nextf = filenames->next;
|
nextf = filenames->next;
|
||||||
free (filenames);
|
free_ns (filenames);
|
||||||
filenames = nextf;
|
filenames = nextf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1981,7 +1981,7 @@ record_files (struct nameseq *filenames, const char *pattern,
|
|||||||
struct file *f;
|
struct file *f;
|
||||||
struct dep *this = 0;
|
struct dep *this = 0;
|
||||||
|
|
||||||
free (filenames);
|
free_ns (filenames);
|
||||||
|
|
||||||
/* Check for special targets. Do it here instead of, say, snap_deps()
|
/* Check for special targets. Do it here instead of, say, snap_deps()
|
||||||
so that we can immediately use the value. */
|
so that we can immediately use the value. */
|
||||||
|
9
rule.c
9
rule.c
@ -401,15 +401,8 @@ static void
|
|||||||
freerule (struct rule *rule, struct rule *lastrule)
|
freerule (struct rule *rule, struct rule *lastrule)
|
||||||
{
|
{
|
||||||
struct rule *next = rule->next;
|
struct rule *next = rule->next;
|
||||||
struct dep *dep;
|
|
||||||
|
|
||||||
dep = rule->deps;
|
free_dep_chain (rule->deps);
|
||||||
while (dep)
|
|
||||||
{
|
|
||||||
struct dep *t = dep->next;
|
|
||||||
free_dep (dep);
|
|
||||||
dep = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
free (rule->targets);
|
free (rule->targets);
|
||||||
free (rule->suffixes);
|
free (rule->suffixes);
|
||||||
|
Loading…
Reference in New Issue
Block a user