Beafed up the string buffer module

git-svn-id: svn://svn.cc65.org/cc65/trunk@2496 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-10-10 16:43:01 +00:00
parent 2541ddd2f6
commit e08261dff3
2 changed files with 63 additions and 9 deletions

View File

@@ -102,7 +102,7 @@ void FreeStrBuf (StrBuf* B)
void SB_Realloc (StrBuf* B, unsigned NewSize)
static void SB_Realloc (StrBuf* B, unsigned NewSize)
/* Reallocate the string buffer space, make sure at least NewSize bytes are
* available.
*/
@@ -136,6 +136,18 @@ char SB_At (const StrBuf* B, unsigned Index)
void SB_Drop (StrBuf* B, unsigned Count)
/* Drop characters from the end of the string. */
{
PRECONDITION (Count <= B->Len);
B->Len -= Count;
if (B->Index > B->Len) {
B->Index = B->Len;
}
}
void SB_Terminate (StrBuf* B)
/* Zero terminate the given string buffer. NOTE: The terminating zero is not
* accounted for in B->Len, if you want that, you have to use AppendChar!