summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc')
-rw-r--r--third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc b/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc
index d12947ce55..558c9dbe42 100644
--- a/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc
+++ b/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc
@@ -41,11 +41,13 @@ bool ThreadMemoryManagerInit(JxlMemoryManager* self,
} else {
memset(self, 0, sizeof(*self));
}
- if (!self->alloc != !self->free) {
+ bool is_default_alloc = (self->alloc == nullptr);
+ bool is_default_free = (self->free == nullptr);
+ if (is_default_alloc != is_default_free) {
return false;
}
- if (!self->alloc) self->alloc = ThreadMemoryManagerDefaultAlloc;
- if (!self->free) self->free = ThreadMemoryManagerDefaultFree;
+ if (is_default_alloc) self->alloc = ThreadMemoryManagerDefaultAlloc;
+ if (is_default_free) self->free = ThreadMemoryManagerDefaultFree;
return true;
}
@@ -57,7 +59,7 @@ void* ThreadMemoryManagerAlloc(const JxlMemoryManager* memory_manager,
void ThreadMemoryManagerFree(const JxlMemoryManager* memory_manager,
void* address) {
- return memory_manager->free(memory_manager->opaque, address);
+ memory_manager->free(memory_manager->opaque, address);
}
} // namespace