shithub: rgbds

Download patch

ref: 1f9fd0f060801ac351007f4ce8064420a63dfaea
parent: 1218da79a9ac84a10a49cf2b35a85dd7e8ae5c18
author: stag019 <[email protected]>
date: Sun Dec 22 15:56:31 EST 2013

This fixes an error with using long label names in macros. If the label name you're using is longer than the string length of the literal macro text, a syntax error would occur. This fix makes sure it at least allocates enough bytes for the largest allowed label name.

--- a/src/asm/fstack.c
+++ b/src/asm/fstack.c
@@ -275,7 +275,7 @@
 		pCurrentMacro = sym;
 		CurrentFlexHandle =
 		    yy_scan_bytes(pCurrentMacro->pMacro,
-		    pCurrentMacro->ulMacroSize);
+		    (pCurrentMacro->ulMacroSize < MAXSYMLEN ? MAXSYMLEN : pCurrentMacro->ulMacroSize)); //Dirty hack to fix small macros using long label names.
 		yy_switch_to_buffer(CurrentFlexHandle);
 		return (1);
 	} else