]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Formerly vpath.c.~4~
authorRoland McGrath <roland@redhat.com>
Tue, 10 Nov 1992 20:29:48 +0000 (20:29 +0000)
committerRoland McGrath <roland@redhat.com>
Tue, 10 Nov 1992 20:29:48 +0000 (20:29 +0000)
vpath.c

diff --git a/vpath.c b/vpath.c
index 1b9109b020236ede5ffc8ca7d4074c8b7d51d978..986a18acb9fbcc8ed918567c0048e1185f5e4361 100644 (file)
--- a/vpath.c
+++ b/vpath.c
@@ -147,11 +147,6 @@ construct_vpath_list (pattern, dirpath)
       return;
     }
 
-  /* Skip over any initial colons and blanks.  */
-  p = dirpath;
-  while (*p == ':' || isblank (*p))
-    ++p;
-
   /* Figure out the maximum number of VPATH entries and
      put it in MAXELEM.  We start with 2, one before the
      first colon and one nil, the list terminator and
@@ -164,19 +159,17 @@ construct_vpath_list (pattern, dirpath)
   vpath = (char **) xmalloc (maxelem * sizeof (char *));
   maxvpath = 0;
 
-  elem = 0;
+  /* Skip over any initial colons and blanks.  */
   p = dirpath;
+  while (*p == ':' || isblank (*p))
+    ++p;
+
+  elem = 0;
   while (*p != '\0')
     {
       char *v;
       unsigned int len;
 
-      /* Find the next entry.  */
-      while (*p != ':' && !isblank (*p))
-       ++p;
-      if (*p == '\0')
-       break;
-
       /* Find the end of this entry.  */
       v = p;
       while (*p != '\0' && *p != ':' && !isblank (*p))
@@ -206,6 +199,10 @@ construct_vpath_list (pattern, dirpath)
       else
        /* The directory does not exist.  Omit from the list.  */
        free (v);
+
+      /* Skip over colons and blanks between entries.  */
+      while (*p == ':' || isblank (*p))
+       ++p;
     }
 
   if (elem > 0)