network: Fix clang-tidy warnings

This commit is contained in:
F5
2023-11-22 16:12:35 +08:00
parent c4479366ef
commit 0f243283a0
2 changed files with 8 additions and 6 deletions

View File

@@ -415,8 +415,8 @@ ByteTagListData*
ByteTagList::Allocate(uint32_t size)
{
NS_LOG_FUNCTION(this << size);
uint8_t* buffer = new uint8_t[size + sizeof(ByteTagListData) - 4];
ByteTagListData* data = (ByteTagListData*)buffer;
auto* buffer = new uint8_t[size + sizeof(ByteTagListData) - 4];
auto* data = (ByteTagListData*)buffer;
data->count = 1;
data->size = size;
data->dirty = 0;
@@ -427,7 +427,7 @@ void
ByteTagList::Deallocate(ByteTagListData* data)
{
NS_LOG_FUNCTION(this << data);
if (data == 0)
if (data == nullptr)
{
return;
}
@@ -436,7 +436,7 @@ ByteTagList::Deallocate(ByteTagListData* data)
#ifdef NS3_MTP
std::atomic_thread_fence(std::memory_order_acquire);
#endif
uint8_t* buffer = (uint8_t*)data;
auto* buffer = (uint8_t*)data;
delete[] buffer;
}
}

View File

@@ -576,7 +576,8 @@ PacketMetadata::Create(uint32_t size)
}
#ifdef NS3_MTP
while (m_freeListUsing.exchange(true, std::memory_order_acquire))
;
{
};
#endif
while (!m_freeList.empty())
{
@@ -615,7 +616,8 @@ PacketMetadata::Recycle(PacketMetadata::Data* data)
}
#ifdef NS3_MTP
while (m_freeListUsing.exchange(true, std::memory_order_acquire))
;
{
};
#endif
NS_LOG_LOGIC("recycle size=" << data->m_size << ", list=" << m_freeList.size());
NS_ASSERT(data->m_count == 0);