MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / Alloc

Method Alloc

native/thirdpart/tinyxml2/tinyxml2.h:375–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

CreateUnlinkedNodeMethod · 0.80
CreateAttributeMethod · 0.80

Calls 1

PushMethod · 0.80

Tested by

no test coverage detected