MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuTextBufferGrow

Function PiuTextBufferGrow

modules/piu/All/piuText.c:216–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216void PiuTextBufferGrow(xsMachine *the, PiuTextBuffer* buffer, size_t size)
217{
218 size_t available = (*buffer)->available;
219 size_t former = (*buffer)->current;
220 size_t current = former + size;
221 if (current > available) {
222 void* chunk;
223 available += size;
224 chunk = fxRenewChunk(the, *buffer, (xsIntegerValue)available);
225 if (!chunk) {
226 chunk = fxNewChunk(the, (xsIntegerValue)available);
227 c_memcpy(chunk, *buffer, former);
228 *buffer = chunk;
229 }
230 c_memset(((uint8_t*)(*buffer)) + former, 0, available - former);
231 (*buffer)->available = available;
232 }
233 (*buffer)->current = current;
234}
235
236void PiuTextBufferNew(xsMachine* the, size_t available)
237{

Callers 5

PiuTextBeginNodeFunction · 0.85
PiuTextConcatFunction · 0.85
PiuTextEndNodeFunction · 0.85
PiuTextFormatLineFunction · 0.85
PiuCodeSearchFunction · 0.85

Calls 2

fxRenewChunkFunction · 0.85
fxNewChunkFunction · 0.85

Tested by

no test coverage detected