Explode terminates in an empty list

This commit is contained in:
Devine Lu Linvega 2024-04-11 09:54:31 -07:00
parent 30690c1d83
commit 819ea2f1fa
1 changed files with 2 additions and 6 deletions

View File

@ -43,12 +43,8 @@ plode(char *s)
if(!depth) return s; if(!depth) return s;
} }
} else { /* explode */ } else { /* explode */
*outp_++ = *s++; while((c = *s++) && !spacer(c))
if(!spacer(*s)) *outp_++ = ' '; *outp_++ = c, *outp_++ = ' ', *outp_++ = '(', depth++;
while((c = *s++) && !spacer(c)) {
*outp_++ = '(', *outp_++ = c, depth++, c = *s;
if(!spacer(c)) *outp_++ = ' ';
}
for(i = 0; i < depth; i++) for(i = 0; i < depth; i++)
*outp_++ = ')'; *outp_++ = ')';
} }