From 13154bd79d519a5f6260263aff46fecc78aa118d Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 4 Dec 2016 15:55:00 +0100 Subject: [PATCH] Fixed: Replace free methods by freeBlock to avoid clash with free macros --HG-- branch : develop --- code/nel/include/nel/3d/quad_grid.h | 2 +- code/nel/include/nel/3d/tile_bank.h | 2 +- code/nel/include/nel/3d/vertex_buffer_heap.h | 2 +- code/nel/include/nel/misc/block_memory.h | 2 +- .../include/nel/misc/contiguous_block_allocator.h | 2 +- code/nel/include/nel/misc/fixed_size_allocator.h | 2 +- code/nel/include/nel/misc/heap_memory.h | 2 +- code/nel/include/nel/misc/object_arena_allocator.h | 2 +- code/nel/include/nel/misc/pool_memory.h | 2 +- .../src/3d/driver/opengl/driver_opengl_vertex.cpp | 4 ++-- .../opengl/driver_opengl_vertex_buffer_hard.cpp | 12 ++++++------ .../driver/opengl/driver_opengl_vertex_buffer_hard.h | 10 +++++----- code/nel/src/3d/landscape.cpp | 12 ++++++------ code/nel/src/3d/tile_bank.cpp | 2 +- code/nel/src/3d/vegetable_manager.cpp | 6 +++--- code/nel/src/3d/visual_collision_manager.cpp | 4 ++-- code/nel/src/misc/contiguous_block_allocator.cpp | 2 +- code/nel/src/misc/fixed_size_allocator.cpp | 2 +- code/nel/src/misc/heap_memory.cpp | 2 +- code/nel/src/misc/object_arena_allocator.cpp | 4 ++-- code/nel/src/pacs/move_container.cpp | 4 ++-- 21 files changed, 41 insertions(+), 41 deletions(-) diff --git a/code/nel/include/nel/3d/quad_grid.h b/code/nel/include/nel/3d/quad_grid.h index 12160b540..b03164520 100644 --- a/code/nel/include/nel/3d/quad_grid.h +++ b/code/nel/include/nel/3d/quad_grid.h @@ -654,7 +654,7 @@ template typename CQuadGrid::CIterator CQuadGrid::erase(typename if(!ptr->Selected) next= NULL; // delete the object. - _NodeBlockMemory.free(ptr); + _NodeBlockMemory.freeBlock(ptr); return CIterator((CNode*)next); diff --git a/code/nel/include/nel/3d/tile_bank.h b/code/nel/include/nel/3d/tile_bank.h index ec96afb64..1205c5940 100644 --- a/code/nel/include/nel/3d/tile_bank.h +++ b/code/nel/include/nel/3d/tile_bank.h @@ -140,7 +140,7 @@ public: private: void clearTile (CTile::TBitmap type); - void free () + void freeBlock () { nlassert ((_Flags&=NL3D_CTILE_FREE_FLAG)==0); _Flags|=NL3D_CTILE_FREE_FLAG; diff --git a/code/nel/include/nel/3d/vertex_buffer_heap.h b/code/nel/include/nel/3d/vertex_buffer_heap.h index c87426f7b..009d72489 100644 --- a/code/nel/include/nel/3d/vertex_buffer_heap.h +++ b/code/nel/include/nel/3d/vertex_buffer_heap.h @@ -69,7 +69,7 @@ public: bool allocate(uint numVertices, uint &indexStart); /// free a subset of the VB. nlstop if subset not found... - void free(uint indexStart); + void freeBlock(uint indexStart); // @} diff --git a/code/nel/include/nel/misc/block_memory.h b/code/nel/include/nel/misc/block_memory.h index 65fb36c46..912f92d1c 100644 --- a/code/nel/include/nel/misc/block_memory.h +++ b/code/nel/include/nel/misc/block_memory.h @@ -132,7 +132,7 @@ public: } /// delete an element allocated with this manager. dtor is called. NULL is tested. - void free(T* ptr) + void freeBlock(T* ptr) { if(!ptr) return; diff --git a/code/nel/include/nel/misc/contiguous_block_allocator.h b/code/nel/include/nel/misc/contiguous_block_allocator.h index 7a15d296d..43d6fac09 100644 --- a/code/nel/include/nel/misc/contiguous_block_allocator.h +++ b/code/nel/include/nel/misc/contiguous_block_allocator.h @@ -55,7 +55,7 @@ public: // allocated a block of n bytes void *alloc(uint numBytes); // deallocate a block - void free(void *block, uint numBytes); + void freeBlock(void *block, uint numBytes); // compute the total number of bytes allocated since init // NB : freed block are not subtracted from that total !! uint getNumAllocatedBytes() const { return _NumAllocatedBytes; } diff --git a/code/nel/include/nel/misc/fixed_size_allocator.h b/code/nel/include/nel/misc/fixed_size_allocator.h index 079c54bc0..ffc975250 100644 --- a/code/nel/include/nel/misc/fixed_size_allocator.h +++ b/code/nel/include/nel/misc/fixed_size_allocator.h @@ -45,7 +45,7 @@ public: /// alloc a block void *alloc(); /// destroy and dealloc a block - void free(void *block); + void freeBlock(void *block); // uint getNumBytesPerBlock() const { return _NumBytesPerBlock; } uint getNumBlockPerChunk() const { return _NumBlockPerChunk; } diff --git a/code/nel/include/nel/misc/heap_memory.h b/code/nel/include/nel/misc/heap_memory.h index cd1a4ab2b..0aeb3aec5 100644 --- a/code/nel/include/nel/misc/heap_memory.h +++ b/code/nel/include/nel/misc/heap_memory.h @@ -65,7 +65,7 @@ public: */ void *allocate(uint size); /// free a block allocated with alloate(). no-op if NULL. nlstop() if don't find this block. - void free(void *ptr); + void freeBlock(void *ptr); // ********************* diff --git a/code/nel/include/nel/misc/object_arena_allocator.h b/code/nel/include/nel/misc/object_arena_allocator.h index 6d318aca8..26b5daa50 100644 --- a/code/nel/include/nel/misc/object_arena_allocator.h +++ b/code/nel/include/nel/misc/object_arena_allocator.h @@ -49,7 +49,7 @@ public: */ void *alloc(uint size); // free an object that has previously been allocated with alloc. size should be remembered by the caller. - void free(void *); + void freeBlock(void *); // get the number of allocated objects uint getNumAllocatedBlocks() const; # ifdef NL_DEBUG diff --git a/code/nel/include/nel/misc/pool_memory.h b/code/nel/include/nel/misc/pool_memory.h index def4125dc..1bd3dbda9 100644 --- a/code/nel/include/nel/misc/pool_memory.h +++ b/code/nel/include/nel/misc/pool_memory.h @@ -90,7 +90,7 @@ public: /* * Free all the elements allocated since last free(). Memory is kept for next allocations. */ - void free () + void freeBlock () { typename std::list< std::vector >::iterator ite=_BlockList.begin(); while (ite!=_BlockList.end()) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp index bb0cf0c9f..ecadaaac2 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp @@ -1713,9 +1713,9 @@ void CDriverGL::resetVertexArrayRange() // After, Clear the 2 vertexArrayRange, if any. if(_AGPVertexArrayRange) - _AGPVertexArrayRange->free(); + _AGPVertexArrayRange->freeBlock(); if(_VRAMVertexArrayRange) - _VRAMVertexArrayRange->free(); + _VRAMVertexArrayRange->freeBlock(); } diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp index 6684ad100..b625af7f2 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp @@ -167,7 +167,7 @@ uint CVertexArrayRangeNVidia::sizeAllocated() const // *************************************************************************** -void CVertexArrayRangeNVidia::free() +void CVertexArrayRangeNVidia::freeBlock() { H_AUTO_OGL(CVertexArrayRangeNVidia_free) // release the ptr. @@ -244,7 +244,7 @@ void *CVertexArrayRangeNVidia::allocateVB(uint32 size) void CVertexArrayRangeNVidia::freeVB(void *ptr) { H_AUTO_OGL(CVertexArrayRangeNVidia_freeVB) - _HeapMemory.free(ptr); + _HeapMemory.freeBlock(ptr); } @@ -545,7 +545,7 @@ uint CVertexArrayRangeATI::sizeAllocated() const return _VertexArraySize; } // *************************************************************************** -void CVertexArrayRangeATI::free() +void CVertexArrayRangeATI::freeBlock() { H_AUTO_OGL(CVertexArrayRangeATI_free) // release the ptr. @@ -623,7 +623,7 @@ void *CVertexArrayRangeATI::allocateVB(uint32 size) void CVertexArrayRangeATI::freeVB(void *ptr) { H_AUTO_OGL(CVertexArrayRangeATI_freeVB) - _HeapMemory.free(ptr); + _HeapMemory.freeBlock(ptr); } @@ -853,7 +853,7 @@ bool CVertexArrayRangeMapObjectATI::allocate(uint32 size, CVertexBuffer::TPrefer } // *************************************************************************** -void CVertexArrayRangeMapObjectATI::free() +void CVertexArrayRangeMapObjectATI::freeBlock() { H_AUTO_OGL(CVertexArrayRangeMapObjectATI_free) _SizeAllocated = 0; @@ -1205,7 +1205,7 @@ bool CVertexArrayRangeARB::allocate(uint32 size, CVertexBuffer::TPreferredMemory } // *************************************************************************** -void CVertexArrayRangeARB::free() +void CVertexArrayRangeARB::freeBlock() { H_AUTO_OGL(CVertexArrayRangeARB_free) _SizeAllocated = 0; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h index 1ec64ccf2..302ff0de8 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h @@ -57,7 +57,7 @@ public: /// allocate a vertex array space. false if error. client must free before re-allocate. virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType)= 0; /// free this space. - virtual void free()= 0; + virtual void freeBlock()= 0; /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb) =0; /// return the size allocated. 0 if not allocated or failure @@ -141,7 +141,7 @@ public: /// allocate a vertex array sapce. false if error. must free before re-allocate. virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType); /// free this space. - virtual void free(); + virtual void freeBlock(); /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb); /// return the size allocated. 0 if not allocated or failure @@ -258,7 +258,7 @@ public: /// allocate a vertex array sapce. false if error. must free before re-allocate. virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType); /// free this space. - virtual void free(); + virtual void freeBlock(); /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb); /// return the size allocated. 0 if not allocated or failure @@ -367,7 +367,7 @@ public: */ virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType); /// free this space. - virtual void free(); + virtual void freeBlock(); /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb); /// return the size allocated. 0 if not allocated or failure @@ -480,7 +480,7 @@ public: */ virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType); /// free this space. - virtual void free(); + virtual void freeBlock(); /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb); /// return the size allocated. 0 if not allocated or failure diff --git a/code/nel/src/3d/landscape.cpp b/code/nel/src/3d/landscape.cpp index e3658dd88..b54bffa28 100644 --- a/code/nel/src/3d/landscape.cpp +++ b/code/nel/src/3d/landscape.cpp @@ -3216,37 +3216,37 @@ void CLandscape::deleteTessFace(CTessFace *f) // for refine() mgt, must remove from refine priority list, or from the temp rootTessFaceToUpdate list. f->unlinkInPList(); - TessFaceAllocator.free(f); + TessFaceAllocator.freeBlock(f); } // *************************************************************************** void CLandscape::deleteTessVertex(CTessVertex *v) { - TessVertexAllocator.free(v); + TessVertexAllocator.freeBlock(v); } // *************************************************************************** void CLandscape::deleteTessNearVertex(CTessNearVertex *v) { - TessNearVertexAllocator.free(v); + TessNearVertexAllocator.freeBlock(v); } // *************************************************************************** void CLandscape::deleteTessFarVertex(CTessFarVertex *v) { - TessFarVertexAllocator.free(v); + TessFarVertexAllocator.freeBlock(v); } // *************************************************************************** void CLandscape::deleteTileMaterial(CTileMaterial *tm) { - TileMaterialAllocator.free(tm); + TileMaterialAllocator.freeBlock(tm); } // *************************************************************************** void CLandscape::deleteTileFace(CTileFace *tf) { - TileFaceAllocator.free(tf); + TileFaceAllocator.freeBlock(tf); } diff --git a/code/nel/src/3d/tile_bank.cpp b/code/nel/src/3d/tile_bank.cpp index 5cacae18e..23075448e 100644 --- a/code/nel/src/3d/tile_bank.cpp +++ b/code/nel/src/3d/tile_bank.cpp @@ -243,7 +243,7 @@ void CTileBank::freeTile (int tileIndex) nlassert (tileIndex<(sint)_TileVector.size()); // Free - _TileVector[tileIndex].free(); + _TileVector[tileIndex].freeBlock(); // Resize tile table int i; diff --git a/code/nel/src/3d/vegetable_manager.cpp b/code/nel/src/3d/vegetable_manager.cpp index 084942fea..8946bc67b 100644 --- a/code/nel/src/3d/vegetable_manager.cpp +++ b/code/nel/src/3d/vegetable_manager.cpp @@ -750,7 +750,7 @@ void CVegetableManager::deleteClipBlock(CVegetableClipBlock *clipBlock) _EmptyClipBlockList.remove(clipBlock); // delete - _ClipBlockMemory.free(clipBlock); + _ClipBlockMemory.freeBlock(clipBlock); } @@ -785,7 +785,7 @@ void CVegetableManager::deleteSortBlock(CVegetableSortBlock *sortBlock) sortBlock->_Owner->_SortBlockList.remove(sortBlock); // delete - _SortBlockMemory.free(sortBlock); + _SortBlockMemory.freeBlock(sortBlock); } @@ -881,7 +881,7 @@ void CVegetableManager::deleteIg(CVegetableInstanceGroup *ig) // unlink from sortBlock, and delete. sortBlock->_InstanceGroupList.remove(ig); - _InstanceGroupMemory.free(ig); + _InstanceGroupMemory.freeBlock(ig); // decRef the clipBlock diff --git a/code/nel/src/3d/visual_collision_manager.cpp b/code/nel/src/3d/visual_collision_manager.cpp index cafc9948e..c5c45578f 100644 --- a/code/nel/src/3d/visual_collision_manager.cpp +++ b/code/nel/src/3d/visual_collision_manager.cpp @@ -98,7 +98,7 @@ CVisualTileDescNode *CVisualCollisionManager::newVisualTileDescNode() // *************************************************************************** void CVisualCollisionManager::deleteVisualTileDescNode(CVisualTileDescNode *ptr) { - _TileDescNodeAllocator.free(ptr); + _TileDescNodeAllocator.freeBlock(ptr); } // *************************************************************************** @@ -110,7 +110,7 @@ CPatchQuadBlock *CVisualCollisionManager::newPatchQuadBlock() // *************************************************************************** void CVisualCollisionManager::deletePatchQuadBlock(CPatchQuadBlock *ptr) { - _PatchQuadBlockAllocator.free(ptr); + _PatchQuadBlockAllocator.freeBlock(ptr); } diff --git a/code/nel/src/misc/contiguous_block_allocator.cpp b/code/nel/src/misc/contiguous_block_allocator.cpp index 6db4b0d63..b99c6b090 100644 --- a/code/nel/src/misc/contiguous_block_allocator.cpp +++ b/code/nel/src/misc/contiguous_block_allocator.cpp @@ -90,7 +90,7 @@ void *CContiguousBlockAllocator::alloc(uint numBytes) } // ********************************************************************************************************* -void CContiguousBlockAllocator::free(void *block, uint numBytes) +void CContiguousBlockAllocator::freeBlock(void *block, uint numBytes) { if (!block) return; #ifdef NL_DEBUG diff --git a/code/nel/src/misc/fixed_size_allocator.cpp b/code/nel/src/misc/fixed_size_allocator.cpp index 30693ddfd..6ec664db4 100644 --- a/code/nel/src/misc/fixed_size_allocator.cpp +++ b/code/nel/src/misc/fixed_size_allocator.cpp @@ -73,7 +73,7 @@ void *CFixedSizeAllocator::alloc() #define aligned_offsetof(s, m) ((offsetof(s, m) + (NL_DEFAULT_MEMORY_ALIGNMENT - 1)) & ~(NL_DEFAULT_MEMORY_ALIGNMENT - 1)) // ***************************************************************************************************************** -void CFixedSizeAllocator::free(void *block) +void CFixedSizeAllocator::freeBlock(void *block) { if (!block) return; /// get the node from the object diff --git a/code/nel/src/misc/heap_memory.cpp b/code/nel/src/misc/heap_memory.cpp index 0c3918ba0..89ce75e50 100644 --- a/code/nel/src/misc/heap_memory.cpp +++ b/code/nel/src/misc/heap_memory.cpp @@ -165,7 +165,7 @@ void *CHeapMemory::allocate(uint size) } // *************************************************************************** -void CHeapMemory::free(void *ptr) +void CHeapMemory::freeBlock(void *ptr) { if(ptr==NULL) return; diff --git a/code/nel/src/misc/object_arena_allocator.cpp b/code/nel/src/misc/object_arena_allocator.cpp index 5fba66005..e27a066ec 100644 --- a/code/nel/src/misc/object_arena_allocator.cpp +++ b/code/nel/src/misc/object_arena_allocator.cpp @@ -97,7 +97,7 @@ void *CObjectArenaAllocator::alloc(uint size) } // ***************************************************************************************************************** -void CObjectArenaAllocator::free(void *block) +void CObjectArenaAllocator::freeBlock(void *block) { if (!block) return; uint8 *realBlock = (uint8 *) block - NL_DEFAULT_MEMORY_ALIGNMENT; // sizeof(uint); // a uint is used at start of block to give its size @@ -114,7 +114,7 @@ void CObjectArenaAllocator::free(void *block) } uint entry = ((size + (_Granularity - 1)) / _Granularity); nlassert(entry < _ObjectSizeToAllocator.size()); - _ObjectSizeToAllocator[entry]->free(realBlock); + _ObjectSizeToAllocator[entry]->freeBlock(realBlock); #ifdef NL_DEBUG std::map::iterator it = _MemBlockToAllocID.find(realBlock); nlassert(it != _MemBlockToAllocID.end()); diff --git a/code/nel/src/pacs/move_container.cpp b/code/nel/src/pacs/move_container.cpp index 7eeca8f08..c302b53ab 100644 --- a/code/nel/src/pacs/move_container.cpp +++ b/code/nel/src/pacs/move_container.cpp @@ -1304,8 +1304,8 @@ void CMoveContainer::freeAllOTInfo () { H_AUTO (NLPACS_Free_All_OT_Info); - _AllocOTDynamicInfo.free (); - _AllocOTStaticInfo.free (); + _AllocOTDynamicInfo.freeBlock (); + _AllocOTStaticInfo.freeBlock (); } // ***************************************************************************