diff lwlink/script.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 554831f03338
line wrap: on
line diff
--- a/lwlink/script.c	Sat Jan 22 09:40:52 2011 -0700
+++ b/lwlink/script.c	Sat Jan 22 09:58:24 2011 -0700
@@ -27,8 +27,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <lw_alloc.h>
+#include <lw_string.h>
+
 #include "lwlink.h"
-#include "util.h"
 
 // the built-in DECB target linker script
 static char *decb_script =
@@ -87,7 +89,7 @@
 		size = ftell(f);
 		rewind(f);
 		
-		script = lw_malloc(size + 2);
+		script = lw_alloc(size + 2);
 		
 		bread = fread(script, 1, size, f);
 		if (bread < size)
@@ -132,7 +134,7 @@
 			for (i = 0; i < nscriptls; i++)
 				size += strlen(scriptls[i]) + 1;
 			
-			rscript = lw_malloc(size + 1);
+			rscript = lw_alloc(size + 1);
 			oscript = rscript;
 			for (i = 0; i < nscriptls; i++)
 			{
@@ -155,7 +157,7 @@
 		for (ptr = script; *ptr && *ptr != '\n' && *ptr != '\r'; ptr++)
 			/* do nothing */ ;
 		
-		line = lw_malloc(ptr - script + 1);
+		line = lw_alloc(ptr - script + 1);
 		memcpy(line, script, ptr - script);
 		line[ptr - script] = '\0';