Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,25 @@ Node *pa2stat(Node *a, Node *b, Node *c) /* pat, pat {...} */
Node *linkum(Node *a, Node *b)
{
Node *c;
static Node *prev_head, *prev_tail; /* auto-init to NULL */

if (errorflag) /* don't link things that are wrong */
return a;
if (a == NULL)
return(b);
else if (b == NULL)
return(a);
for (c = a; c->nnext != NULL; c = c->nnext)
;
c->nnext = b;

if (prev_head == a) {
prev_tail->nnext = b;
prev_tail = b;
} else {
for (c = a; c->nnext != NULL; c = c->nnext)
;
c->nnext = b;
prev_head = a;
prev_tail = b;
}
return(a);
}

Expand Down