summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1993-01-08 22:07:33 +0000
committerRoland McGrath <roland@redhat.com>1993-01-08 22:07:33 +0000
commit035157a2fdb2fe5243631748d6c4475856890be0 (patch)
treec5a7ad70fd0327cd994e29a7fc111ee57bd5c546
parent50a643208f3035fd5471b505033adbd33b942d92 (diff)
downloadgunmake-035157a2fdb2fe5243631748d6c4475856890be0.tar.gz
Formerly vpath.c.~6~
-rw-r--r--vpath.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/vpath.c b/vpath.c
index d804150..aa8f367 100644
--- a/vpath.c
+++ b/vpath.c
@@ -124,24 +124,33 @@ construct_vpath_list (pattern, dirpath)
/* Remove matching listings. */
register struct vpath *path, *lastpath;
- lastpath = vpaths;
- for (path = vpaths; path != 0; lastpath = path, path = path->next)
- if (pattern == 0
- || (((percent == 0 && path->percent == 0)
- || (percent - pattern == path->percent - path->pattern))
- && streq (pattern, path->pattern)))
- {
- /* Remove it from the linked list. */
- if (lastpath == vpaths)
- vpaths = path->next;
- else
- lastpath->next = path->next;
-
- /* Free its unused storage. */
- free (path->pattern);
- free ((char *) path->searchpath);
- free ((char *) path);
- }
+ lastpath = 0;
+ path = vpaths;
+ while (path != 0)
+ {
+ struct vpath *next = path->next;
+
+ if (pattern == 0
+ || (((percent == 0 && path->percent == 0)
+ || (percent - pattern == path->percent - path->pattern))
+ && streq (pattern, path->pattern)))
+ {
+ /* Remove it from the linked list. */
+ if (lastpath == 0)
+ vpaths = path->next;
+ else
+ lastpath->next = next;
+
+ /* Free its unused storage. */
+ free (path->pattern);
+ free ((char *) path->searchpath);
+, 1993 free ((char *) path);
+ }
+
+ lastpath = next;
+ path = next;
+ }
+
if (pattern != 0)
free (pattern);
return;