From: uz Date: Sun, 21 Aug 2011 20:17:43 +0000 (+0000) Subject: Change prototype for GT_AsString to make it easier usable. X-Git-Tag: V2.13.3~205 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b88dc209fcd3b4007e388dd9c1ef135d7d99bca0;p=cc65 Change prototype for GT_AsString to make it easier usable. git-svn-id: svn://svn.cc65.org/cc65/trunk@5257 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/common/gentype.c b/src/common/gentype.c index 7bdddaf33..9c25f4255 100644 --- a/src/common/gentype.c +++ b/src/common/gentype.c @@ -79,8 +79,10 @@ unsigned GT_GetArraySize (StrBuf* Type) -void GT_AsString (const StrBuf* Type, StrBuf* String) -/* Convert the type into a readable representation */ +const char* GT_AsString (const StrBuf* Type, StrBuf* String) +/* Convert the type into a readable representation. The target string buffer + * will be zero terminated and a pointer to the contents are returned. + */ { static const char HexTab[16] = "0123456789ABCDEF"; unsigned I; @@ -98,7 +100,10 @@ void GT_AsString (const StrBuf* Type, StrBuf* String) } /* Terminate the string so it can be used with string functions */ - SB_Terminate (String); + SB_Terminate (String); + + /* Return the contents of String */ + return SB_GetConstBuf (String); } diff --git a/src/common/gentype.h b/src/common/gentype.h index afadbbb12..5d0425fda 100644 --- a/src/common/gentype.h +++ b/src/common/gentype.h @@ -136,8 +136,10 @@ unsigned GT_GetArraySize (StrBuf* Type); * The index position will get moved past the array size. */ -void GT_AsString (const StrBuf* Type, StrBuf* String); -/* Convert the type into a readable representation */ +const char* GT_AsString (const StrBuf* Type, StrBuf* String); +/* Convert the type into a readable representation. The target string buffer + * will be zero terminated and a pointer to the contents are returned. + */