diff --git a/uppsrc/Core/AString.hpp b/uppsrc/Core/AString.hpp index 75d04698d..98e0422a0 100644 --- a/uppsrc/Core/AString.hpp +++ b/uppsrc/Core/AString.hpp @@ -288,6 +288,26 @@ void StringBuffer::Strlen() SetLength((int)strlen__(pbegin)); } +inline +void StringBuffer::Cat(const char *s, int l) +{ + if(pend + l > limit) + ReallocL(s, l); + else { + memcpy8(pend, s, l); + pend += l; + } +} + +inline +void StringBuffer::Cat(int c, int l) +{ + if(pend + l > limit) + ReallocL(NULL, l); + memset8(pend, c, l); + pend += l; +} + force_inline void StringBuffer::Cat(const char *s) { diff --git a/uppsrc/Core/String.cpp b/uppsrc/Core/String.cpp index f852b7ee0..30d7caa2d 100644 --- a/uppsrc/Core/String.cpp +++ b/uppsrc/Core/String.cpp @@ -416,22 +416,9 @@ void StringBuffer::Shrink() pend = pbegin + l; } -void StringBuffer::Cat(const char *s, int l) +void StringBuffer::ReallocL(const char *s, int l) { - if(pend + l > limit) - Realloc(max(GetLength(), l) + GetLength(), s, l); - else { - memcpy8(pend, s, l); - pend += l; - } -} - -void StringBuffer::Cat(int c, int l) -{ - if(pend + l > limit) - Realloc(max(GetLength(), l) + GetLength(), NULL, l); - memset(pend, c, l); - pend += l; + Realloc(max(GetLength(), l) + GetLength(), s, l); } void StringBuffer::Set(String& s) diff --git a/uppsrc/Core/String.h b/uppsrc/Core/String.h index 8e5a4df9c..5caaa2961 100644 --- a/uppsrc/Core/String.h +++ b/uppsrc/Core/String.h @@ -408,6 +408,7 @@ class StringBuffer : NoCopy { char *Alloc(int len, int& alloc); void Realloc(dword n, const char *cat = NULL, int l = 0); + void ReallocL(const char *s, int l); void Expand(); void Zero() { pbegin = pend = buffer; limit = pbegin + 255; } void Free();