[hackers] [sbase] Revert "bc: set used = 0 in writeout" || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 23 Nov 2025 20:09:44 +0100 (CET)

commit 276256e9c67680bb7e1c7e2c882d449f502e62e7
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
AuthorDate: Sun Nov 23 20:06:17 2025 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
CommitDate: Sun Nov 23 20:06:17 2025 +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.

diff --git a/bc.y b/bc.y
index c5221d7..41b3282 100644
--- a/bc.y
+++ b/bc.y
_AT_@ -101,8 +101,8 @@ program :
          | item program
          ;
 
-item : scolonlst '\n'
- | function {writeout($1);}
+item : scolonlst '\n' {used = 0;}
+ | function {writeout($1); used = 0;}
          ;
 
 scolonlst:
_AT_@ -246,8 +246,6 @@ writeout(char *s)
                 goto err;
         if (write(1, (char[]){'\n'}, 1) < 0)
                 goto err;
- used = 0;
-
         return;
         
 err:
_AT_@ -701,6 +699,7 @@ bc(char *fname)
 
         for (init(); run(); init())
                 ;
+ nested = used = 0;
 }
 static void
 loadlib(void)
Received on Sun Nov 23 2025 - 20:09:44 CET

This archive was generated by hypermail 2.3.0 : Sun Nov 23 2025 - 20:12:36 CET