MCPcopy Create free account
hub / github.com/avast/retdec / Alloc

Method Alloc

deps/tinyxml2/include/tinyxml2/tinyxml2.h:374–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372 }
373
374 virtual void* Alloc() {
375 if ( !_root ) {
376 // Need a new block.
377 Block* block = new Block();
378 _blockPtrs.Push( block );
379
380 Item* blockItems = block->items;
381 for( int i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) {
382 blockItems[i].next = &(blockItems[i + 1]);
383 }
384 blockItems[ITEMS_PER_BLOCK - 1].next = 0;
385 _root = blockItems;
386 }
387 Item* const result = _root;
388 TIXMLASSERT( result != 0 );
389 _root = _root->next;
390
391 ++_currentAllocs;
392 if ( _currentAllocs > _maxAllocs ) {
393 _maxAllocs = _currentAllocs;
394 }
395 ++_nAllocs;
396 ++_nUntracked;
397 return result;
398 }
399
400 virtual void Free( void* mem ) {
401 if ( !mem ) {

Callers 2

CreateAttributeMethod · 0.80
CreateUnlinkedNodeMethod · 0.80

Calls 1

PushMethod · 0.45

Tested by

no test coverage detected