Skip to content

Commit

Permalink
Remove duplicate code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdelv committed Oct 30, 2024
1 parent b57c932 commit 45800b0
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions system/jlib/jstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,17 +1071,10 @@ StringBuffer & StringBuffer::replaceString(const char* oldStr, const char* newSt
{
if (memcmp(buffer, oldStr, oldlen) == 0)
{
if (newlen <= curLen)
{
memmove(buffer, newStr, newlen);
curLen = newlen;
}
else
{
if (newlen > curLen)
ensureCapacity(newlen);
memcpy(buffer, newStr, newlen);
curLen = newlen;
}
memcpy(buffer, newStr, newlen);
curLen = newlen;
}
}
else
Expand Down

0 comments on commit 45800b0

Please sign in to comment.