diff lwcc/symbol.c @ 299:856caf91ffaa ccdev

Added token list structure and switched some stuff to use it Swithced to using a token list structure instead of manually fiddling pointers throughout the macro expansion code. Also fixed up some problematic things related to stringification and concatenation.
author William Astle <lost@l-w.ca>
date Sun, 15 Sep 2013 13:06:00 -0600
parents 83fcc1ed6ad6
children 54f213c8fb81
line wrap: on
line diff
--- a/lwcc/symbol.c	Sat Sep 14 22:42:53 2013 -0600
+++ b/lwcc/symbol.c	Sun Sep 15 13:06:00 2013 -0600
@@ -31,19 +31,13 @@
 void symbol_free(struct symtab_e *s)
 {
 	int i;
-	struct token *t;
-	
+
 	lw_free(s -> name);
 	
 	for (i = 0; i < s -> nargs; i++)
 		lw_free(s -> params[i]);
 	lw_free(s -> params);
-	while (s -> tl)
-	{
-		t = s -> tl;
-		s -> tl = t -> next;
-		token_free(t);
-	}
+	token_list_destroy(s -> tl);
 }
 
 struct symtab_e *symtab_find(struct preproc_info *pp, char *name)
@@ -77,7 +71,7 @@
 	}
 }
 
-void symtab_define(struct preproc_info *pp, char *name, struct token *def, int nargs, char **params, int vargs)
+void symtab_define(struct preproc_info *pp, char *name, struct token_list *def, int nargs, char **params, int vargs)
 {
 	struct symtab_e *s;