| 70 | } |
| 71 | |
| 72 | int BfSource::AllocChars(int charCount) |
| 73 | { |
| 74 | if (mSrcLength + charCount > mSrcAllocSize) |
| 75 | { |
| 76 | int newAllocSize = std::max(mSrcLength + charCount, mSrcAllocSize * 2); |
| 77 | char* newSrc = new char[newAllocSize + 1]; |
| 78 | memset(newSrc + mSrcAllocSize, 0, newAllocSize - mSrcAllocSize); |
| 79 | if (mSrc != NULL) |
| 80 | { |
| 81 | memcpy(newSrc, mSrc, mSrcLength); |
| 82 | delete [] mSrc; |
| 83 | } |
| 84 | mSrc = newSrc; |
| 85 | mSrcAllocSize = newAllocSize; |
| 86 | |
| 87 | BF_ASSERT(mSourceData->ToParser() != NULL); |
| 88 | mSourceData->mSrc = mSrc; |
| 89 | |
| 90 | HadSrcRealloc(); |
| 91 | } |
| 92 | |
| 93 | int retVal = mSrcLength; |
| 94 | mSrcLength += charCount; |
| 95 | return retVal; |
| 96 | } |
| 97 | |
| 98 | /*void BfSource::AddReplaceNode(BfAstNode* astNode, const StringImpl& replaceStr) |
| 99 | { |
no test coverage detected