MCPcopy Create free account
hub / github.com/beefytech/Beef / AllocChars

Method AllocChars

IDEHelper/Compiler/BfSource.cpp:72–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72int 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{

Callers 3

ReadTypedValueMethod · 0.80
CEEmitParseMethod · 0.80

Calls 1

ToParserMethod · 0.45

Tested by

no test coverage detected