tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] [patch] symbol allocator


From: Marcelo Jimenez
Subject: [Tinycc-devel] [patch] symbol allocator
Date: Tue, 30 Aug 2005 22:17:19 -0300

Simplifying/clarifying the symbol allocator:

sym_free_first *must* be NULL upon the entry of __sym_malloc, this is
the entry condition. Also sym_free_first will be imediately
overwritten upon return of __sym_malloc, so there is no need to set
it.

Index: tcc.c
===================================================================
RCS file: /cvsroot/tinycc/tinycc/tcc.c,v
retrieving revision 1.172
diff -u -r1.172 tcc.c
--- tcc.c       17 Jun 2005 22:05:58 -0000      1.172
+++ tcc.c       31 Aug 2005 01:07:38 -0000
@@ -1100,19 +1100,16 @@
 /* symbol allocator */
 static Sym *__sym_malloc(void)
 {
-    Sym *sym_pool, *sym, *last_sym;
+    Sym *sym, *last_sym;
     int i;
 
-    sym_pool = tcc_malloc(SYM_POOL_NB * sizeof(Sym));
-
-    last_sym = sym_free_first;
-    sym = sym_pool;
+    sym = tcc_malloc(SYM_POOL_NB * sizeof(Sym));
+    last_sym = NULL;
     for(i = 0; i < SYM_POOL_NB; i++) {
         sym->next = last_sym;
         last_sym = sym;
         sym++;
     }
-    sym_free_first = last_sym;
     return last_sym;
 }

Attachment: symbol_allocator.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]