]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Formerly file.c.~16~
authorRoland McGrath <roland@redhat.com>
Sun, 2 Aug 1992 10:16:54 +0000 (10:16 +0000)
committerRoland McGrath <roland@redhat.com>
Sun, 2 Aug 1992 10:16:54 +0000 (10:16 +0000)
file.c

diff --git a/file.c b/file.c
index 6d0d3b218e5707e2c79d022ec477afde8a80edf4..e98e6138ab25f4eb809e6dcdc61a420ef50a380b 100644 (file)
--- 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
     }
 }
+\f                              /* !!! 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;
+}