commit 276256e9c67680bb7e1c7e2c882d449f502e62e7
parent f0438f7a70b1df3b2ac642af5312b138e9899681
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 20:06:17 +0100
Revert "bc: set used = 0 in writeout"
This reverts commit 0850438f93155902b6a062c94786fa99e4269715.
There intermixed clls to writeout(), so we cannot reset
the memory in writeout. At this moment is clear that we have
to use a better memory allocation mecanism.
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/bc.y b/bc.y
@@ -101,8 +101,8 @@ program :
| item program
;
-item : scolonlst '\n'
- | function {writeout($1);}
+item : scolonlst '\n' {used = 0;}
+ | function {writeout($1); used = 0;}
;
scolonlst:
@@ -246,8 +246,6 @@ writeout(char *s)
goto err;
if (write(1, (char[]){'\n'}, 1) < 0)
goto err;
- used = 0;
-
return;
err:
@@ -701,6 +699,7 @@ bc(char *fname)
for (init(); run(); init())
;
+ nested = used = 0;
}
static void
loadlib(void)