mirror of
https://github.com/cc65/cc65.git
synced 2025-01-14 00:32:08 +00:00
Check for a size of zero in SB_CopyBuf to make the code somewhat faster.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4675 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
314893619a
commit
b942fd0b56
@ -226,10 +226,12 @@ void SB_Terminate (StrBuf* B)
|
|||||||
void SB_CopyBuf (StrBuf* Target, const char* Buf, unsigned Size)
|
void SB_CopyBuf (StrBuf* Target, const char* Buf, unsigned Size)
|
||||||
/* Copy Buf to Target, discarding the old contents of Target */
|
/* Copy Buf to Target, discarding the old contents of Target */
|
||||||
{
|
{
|
||||||
|
if (Size) {
|
||||||
if (Target->Allocated < Size) {
|
if (Target->Allocated < Size) {
|
||||||
SB_CheapRealloc (Target, Size);
|
SB_CheapRealloc (Target, Size);
|
||||||
}
|
}
|
||||||
memcpy (Target->Buf, Buf, Size);
|
memcpy (Target->Buf, Buf, Size);
|
||||||
|
}
|
||||||
Target->Len = Size;
|
Target->Len = Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user