MCPcopy Create free account
hub / github.com/ZDoom/Raze / Realloc

Method Realloc

source/common/utility/zstring.cpp:1368–1386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1366}
1367
1368FStringData *FStringData::Realloc (size_t newstrlen)
1369{
1370 assert (RefCount <= 1);
1371
1372 newstrlen += 1 + sizeof(FStringData); // Add space for header and terminating null
1373 newstrlen = (newstrlen + 7) & ~7; // Pad length up
1374
1375#ifdef _WIN32
1376 FStringData *block = (FStringData *)HeapReAlloc (StringHeap, 0, this, newstrlen);
1377#else
1378 FStringData *block = (FStringData *)realloc (this, newstrlen);
1379#endif
1380 if (block == NULL)
1381 {
1382 throw std::bad_alloc();
1383 }
1384 block->AllocLen = (unsigned int)newstrlen - sizeof(FStringData) - 1;
1385 return block;
1386}
1387
1388void FStringData::Dealloc ()
1389{

Callers 1

ReallocBufferMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected