mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 19:07:35 +00:00
LibThread: Remove LOCKER() macro, as it adds no value
The LOCKER() macro appears to have been added to LibThread as a userspace analog to the previous LOCKER() macro that existed in the kernel. The kernel version used the macro to inject __FILE__ and __LINE__ number into the lock acquisition for debugging. However AK::SourceLocation was used to remove the need for the macro. So the kernel version no longer exists. The LOCKER() in LibThread doesn't appear to actually need to be a macro, using the type directly works fine, and arguably is more readable as it removes an unnecessary level of indirection.
This commit is contained in:
parent
0b7395848a
commit
691b6f69c5
5 changed files with 17 additions and 15 deletions
|
@ -157,7 +157,7 @@ enum class CallerWillInitializeMemory {
|
|||
|
||||
static void* malloc_impl(size_t size, CallerWillInitializeMemory caller_will_initialize_memory)
|
||||
{
|
||||
LOCKER(malloc_lock());
|
||||
LibThread::Locker locker(malloc_lock());
|
||||
|
||||
if (s_log_malloc)
|
||||
dbgln("LibC: malloc({})", size);
|
||||
|
@ -278,7 +278,7 @@ static void free_impl(void* ptr)
|
|||
|
||||
g_malloc_stats.number_of_free_calls++;
|
||||
|
||||
LOCKER(malloc_lock());
|
||||
LibThread::Locker locker(malloc_lock());
|
||||
|
||||
void* block_base = (void*)((FlatPtr)ptr & ChunkedBlock::ChunkedBlock::block_mask);
|
||||
size_t magic = *(size_t*)block_base;
|
||||
|
@ -380,7 +380,7 @@ size_t malloc_size(void* ptr)
|
|||
{
|
||||
if (!ptr)
|
||||
return 0;
|
||||
LOCKER(malloc_lock());
|
||||
LibThread::Locker locker(malloc_lock());
|
||||
void* page_base = (void*)((FlatPtr)ptr & ChunkedBlock::block_mask);
|
||||
auto* header = (const CommonHeader*)page_base;
|
||||
auto size = header->m_size;
|
||||
|
@ -398,7 +398,7 @@ void* realloc(void* ptr, size_t size)
|
|||
if (!size)
|
||||
return nullptr;
|
||||
|
||||
LOCKER(malloc_lock());
|
||||
LibThread::Locker locker(malloc_lock());
|
||||
auto existing_allocation_size = malloc_size(ptr);
|
||||
|
||||
if (size <= existing_allocation_size) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue