shithub: rgbds

Download patch

ref: af70f03933abf02f218044ccc954417eb0e94663
parent: 004bc2e50ef04200a559b3ce8e8e6767a6142494
author: stag019 <[email protected]>
date: Fri Oct 31 15:01:21 EDT 2014

A few more small changes to charmap.c.

--- a/src/asm/charmap.c
+++ b/src/asm/charmap.c
@@ -54,10 +54,14 @@
 	{
 		size = 2;
 	}
-	else
+	else if(first != '\0')
 	{
 		size = 1;
 	}
+	else
+	{
+		size = 0;
+	}
 	strncpy(destination, source, size);
 	destination[size] = 0;
 	return size;
@@ -145,7 +149,7 @@
 	struct Charmap *charmap;
 
 	char outchar[CHARMAPLENGTH + 1];
-	char *input_temp, *buffer;
+	char *buffer;
 	int i, j, length;
 
 	if(pCurrentSection && pCurrentSection -> charmap)
@@ -157,7 +161,6 @@
 		charmap = &globalCharmap;
 	}
 
-	input_temp = *input;
 	if((buffer = (char *) malloc(strlen(*input))) == NULL)
 	{
 		fatalerror("Not enough memory for buffer");
@@ -195,7 +198,6 @@
 		}
 		*input += j;
 	}
-	*input = input_temp;
 	*input = buffer;
 	return length;
 }