Corrected an unexpected corner-case error in which if a newline in

a spice netlist falls exactly on the last non-null position of the
input buffer after the buffer has been expanded to accept more
input data, then the next line gets read in automatically, and
the newline gets treated as whitespace and not a newline.
This commit is contained in:
R. Timothy Edwards 2025-08-25 10:31:19 -04:00
parent 4443826f9e
commit c269f1de89
2 changed files with 6 additions and 1 deletions

View File

@ -1 +1 @@
1.5.296 1.5.297

View File

@ -329,6 +329,11 @@ int GetNextLineNoNewline(char *delimiter)
llen = strlen(line); llen = strlen(line);
} }
while (llen == linesize - 1) { while (llen == linesize - 1) {
/* Note that in the rare case where a newline is in the last buffer
* position, we're done.
*/
if (*(line + llen - 1) == '\n') break;
newbuf = (char *)MALLOC(linesize + 501); newbuf = (char *)MALLOC(linesize + 501);
strcpy(newbuf, line); strcpy(newbuf, line);
FREE(line); FREE(line);