Formerly vpath.c.~6~

This commit is contained in:
Roland McGrath 1993-01-08 22:07:33 +00:00
parent 50a643208f
commit 035157a2fd

19
vpath.c
View File

@ -124,24 +124,33 @@ construct_vpath_list (pattern, dirpath)
/* Remove matching listings. */ /* Remove matching listings. */
register struct vpath *path, *lastpath; register struct vpath *path, *lastpath;
lastpath = vpaths; lastpath = 0;
for (path = vpaths; path != 0; lastpath = path, path = path->next) path = vpaths;
while (path != 0)
{
struct vpath *next = path->next;
if (pattern == 0 if (pattern == 0
|| (((percent == 0 && path->percent == 0) || (((percent == 0 && path->percent == 0)
|| (percent - pattern == path->percent - path->pattern)) || (percent - pattern == path->percent - path->pattern))
&& streq (pattern, path->pattern))) && streq (pattern, path->pattern)))
{ {
/* Remove it from the linked list. */ /* Remove it from the linked list. */
if (lastpath == vpaths) if (lastpath == 0)
vpaths = path->next; vpaths = path->next;
else else
lastpath->next = path->next; lastpath->next = next;
/* Free its unused storage. */ /* Free its unused storage. */
free (path->pattern); free (path->pattern);
free ((char *) path->searchpath); free ((char *) path->searchpath);
free ((char *) path); , 1993 free ((char *) path);
} }
lastpath = next;
path = next;
}
if (pattern != 0) if (pattern != 0)
free (pattern); free (pattern);
return; return;