summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1992-08-02 10:16:54 +0000
committerRoland McGrath <roland@redhat.com>1992-08-02 10:16:54 +0000
commite07d203a2f9d5f343420a7b56a91255df4c0e586 (patch)
tree3700767b6ec3e7cb94e46612742616618e7837b5 /file.c
parent92546f9ff947e3d4d9be9ea229092a69be421bbf (diff)
downloadgunmake-e07d203a2f9d5f343420a7b56a91255df4c0e586.tar.gz
Formerly file.c.~16~
Diffstat (limited to 'file.c')
-rw-r--r--file.c53
1 files changed, 45 insertions, 8 deletions
diff --git a/file.c b/file.c
index 6d0d3b2..e98e613 100644
--- a/file.c
+++ b/file.c
@@ -125,10 +125,8 @@ rename_file (file, name)
char *name;
{
char *oldname = file->name;
- register unsigned int oldhash, newhash;
+ register unsigned int oldhash;
register char *n;
- register struct file *f;
- struct file *oldfile;
while (file->renamed != 0)
file = file->renamed;
@@ -140,6 +138,20 @@ rename_file (file, name)
HASH (oldhash, *n);
oldhash %= FILE_BUCKETS;
+ file_hash_enter (file, name, oldhash);
+}
+
+void
+file_hash_enter (file, name, oldhash)
+ register struct file *file;
+ char *name;
+ unsigned int oldhash;
+{
+ register unsigned int newhash;
+ struct file *oldfile;
+ register char *n;
+ register struct file *f;
+
newhash = 0;
for (n = name; *n != '\0'; ++n)
HASH (newhash, *n);
@@ -151,7 +163,7 @@ rename_file (file, name)
if (streq (oldfile->name, name))
break;
- if (newhash != oldhash || oldfile != 0)
+ if (oldhash != 0 && (newhash != oldhash || oldfile != 0))
{
/* Remove FILE from its hash bucket. */
@@ -199,16 +211,18 @@ rename_file (file, name)
one given in the rule explicitly mentioning this name,
but give a message to let the user know what's going on. */
makefile_error (file->cmds->filename, file->cmds->lineno,
- "Commands were specified for file `%s' at %s:%u,",
- oldname, oldfile->cmds->filename, oldfile->cmds->lineno);
+ "Commands were specified for \
+file `%s' at %s:%u,",
+ oldfile->name, oldfile->cmds->filename,
+ oldfile->cmds->lineno);
makefile_error (file->cmds->filename, file->cmds->lineno,
"but `%s' is now considered the same file \
as `%s'.",
- oldname, name);
+ oldfile->name, name);
makefile_error (file->cmds->filename, file->cmds->lineno,
"Commands for `%s' will be ignored \
in favor of those for `%s'.",
- name, oldname);
+ name, oldfile->name);
}
}
@@ -476,3 +490,26 @@ print_file_data_base ()
#endif
}
}
+ /* !!! compile frob */
+struct file *
+file_linear_list ()
+{
+ register unsigned int bucket;
+ register struct file *f, *nextf;
+ struct file *chain = NULL;
+
+ for (bucket = 0; bucket < sizeof (files) / sizeof (files[0]); ++bucket)
+ for (f = files[bucket]; f != NULL; f = nextf)
+ {
+ nextf = f->next;
+ if (f->is_target)
+ {
+ if (f->cmds != NULL)
+ f->cmds = (struct commands *) f->cmds->commands;
+ f->next = chain;
+ chain = f;
+ }
+ }
+
+ return chain;
+}