From: uz Date: Tue, 23 Aug 2011 18:04:25 +0000 (+0000) Subject: Fixed a bug: Never remember a pointer to a string buffer, since it becomes X-Git-Tag: V2.13.3~194 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=262ed5db8b0d1511ed09f43f15cd3b0dc854bb17;p=cc65 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 --- 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); }