From 262ed5db8b0d1511ed09f43f15cd3b0dc854bb17 Mon Sep 17 00:00:00 2001 From: uz Date: Tue, 23 Aug 2011 18:04:25 +0000 Subject: [PATCH] Fixed a bug: Never remember a pointer to a string buffer, since it becomes invalid when the string buffer gets resized. git-svn-id: svn://svn.cc65.org/cc65/trunk@5268 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/common/gentype.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/gentype.c b/src/common/gentype.c index f676e2b86..aa1471aa4 100644 --- a/src/common/gentype.c +++ b/src/common/gentype.c @@ -54,7 +54,7 @@ void GT_AddArray (StrBuf* Type, unsigned ArraySize) unsigned SizeBytes; /* Remember the current position */ - char* A = SB_GetBuf (Type) + SB_GetLen (Type); + unsigned Pos = SB_GetLen (Type); /* Add a dummy array token */ SB_AppendChar (Type, GT_TYPE_ARRAY); @@ -68,7 +68,7 @@ void GT_AddArray (StrBuf* Type, unsigned ArraySize) } while (ArraySize); /* Write the correct array token */ - *A = GT_ARRAY (SizeBytes); + SB_GetBuf (Type)[Pos] = GT_ARRAY (SizeBytes); } -- 2.39.5