diff lwlink/expr.c @ 8:fdc11ef4115b

Switched lwlink to lw_cmdline from argp and also brought in lw_alloc and lw_string to replace util.c
author lost@l-w.ca
date Sat, 22 Jan 2011 09:58:24 -0700
parents 7317fbe024af
children
line wrap: on
line diff
--- a/lwlink/expr.c	Sat Jan 22 09:40:52 2011 -0700
+++ b/lwlink/expr.c	Sat Jan 22 09:58:24 2011 -0700
@@ -28,14 +28,16 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <lw_alloc.h>
+#include <lw_string.h>
+
 #include "expr.h"
-#include "util.h"
 
 lw_expr_stack_t *lw_expr_stack_create(void)
 {
 	lw_expr_stack_t *s;
 	
-	s = lw_malloc(sizeof(lw_expr_stack_t));
+	s = lw_alloc(sizeof(lw_expr_stack_t));
 	s -> head = NULL;
 	s -> tail = NULL;
 	return s;
@@ -80,7 +82,7 @@
 {
 	lw_expr_term_t *t;
 
-	t = lw_malloc(sizeof(lw_expr_term_t));
+	t = lw_alloc(sizeof(lw_expr_term_t));
 	t -> term_type = LW_TERM_OPER;
 	t -> value = oper;
 	return t;
@@ -90,7 +92,7 @@
 {
 	lw_expr_term_t *t;
 	
-	t = lw_malloc(sizeof(lw_expr_term_t));
+	t = lw_alloc(sizeof(lw_expr_term_t));
 	t -> term_type = LW_TERM_INT;
 	t -> value = val;
 	return t;
@@ -100,7 +102,7 @@
 {
 	lw_expr_term_t *t;
 	
-	t = lw_malloc(sizeof(lw_expr_term_t));
+	t = lw_alloc(sizeof(lw_expr_term_t));
 	t -> term_type = LW_TERM_SYM;
 	t -> symbol = lw_strdup(sym);
 	t -> value = symtype;
@@ -135,7 +137,7 @@
 		exit(1);
 	}
 	
-	n = lw_malloc(sizeof(lw_expr_stack_node_t));
+	n = lw_alloc(sizeof(lw_expr_stack_node_t));
 	n -> next = NULL;
 	n -> prev = s -> tail;
 	n -> term = lw_expr_term_dup(t);