MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / ReAllocate

Method ReAllocate

scintilla/src/SplitVector.h:83–96  ·  view source on GitHub ↗

Reallocate the storage for the buffer to be newSize and copy exisiting contents to the new buffer. Must not be used to decrease the size of the buffer.

Source from the content-addressed store, hash-verified

81 /// copy exisiting contents to the new buffer.
82 /// Must not be used to decrease the size of the buffer.
83 void ReAllocate(int newSize) {
84 if (newSize > size) {
85 // Move the gap to the end
86 GapTo(lengthBody);
87 T *newBody = new T[newSize];
88 if ((size != 0) && (body != 0)) {
89 memmove(newBody, body, sizeof(T) * lengthBody);
90 delete []body;
91 }
92 body = newBody;
93 gapLength += newSize - size;
94 size = newSize;
95 }
96 }
97
98 /// Retrieve the character at a particular position.
99 /// Retrieving positions outside the range of the buffer returns 0.

Callers 1

AllocateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected