summaryrefslogtreecommitdiffstats
path: root/core/os
diff options
context:
space:
mode:
Diffstat (limited to 'core/os')
-rw-r--r--core/os/memory.cpp6
-rw-r--r--core/os/memory.h2
-rw-r--r--core/os/os.cpp2
-rw-r--r--core/os/pool_allocator.cpp14
4 files changed, 12 insertions, 12 deletions
diff --git a/core/os/memory.cpp b/core/os/memory.cpp
index 0d15b8dcf5..5f6216a5f1 100644
--- a/core/os/memory.cpp
+++ b/core/os/memory.cpp
@@ -74,7 +74,7 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
void *mem = malloc(p_bytes + (prepad ? PAD_ALIGN : 0));
- ERR_FAIL_COND_V(!mem, nullptr);
+ ERR_FAIL_NULL_V(mem, nullptr);
alloc_count.increment();
@@ -127,7 +127,7 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
*s = p_bytes;
mem = (uint8_t *)realloc(mem, p_bytes + PAD_ALIGN);
- ERR_FAIL_COND_V(!mem, nullptr);
+ ERR_FAIL_NULL_V(mem, nullptr);
s = (uint64_t *)mem;
@@ -145,7 +145,7 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
}
void Memory::free_static(void *p_ptr, bool p_pad_align) {
- ERR_FAIL_COND(p_ptr == nullptr);
+ ERR_FAIL_NULL(p_ptr);
uint8_t *mem = (uint8_t *)p_ptr;
diff --git a/core/os/memory.h b/core/os/memory.h
index 45019894b1..a0524b0ea2 100644
--- a/core/os/memory.h
+++ b/core/os/memory.h
@@ -144,7 +144,7 @@ T *memnew_arr_template(size_t p_elements) {
size_t len = sizeof(T) * p_elements;
uint64_t *mem = (uint64_t *)Memory::alloc_static(len, true);
T *failptr = nullptr; //get rid of a warning
- ERR_FAIL_COND_V(!mem, failptr);
+ ERR_FAIL_NULL_V(mem, failptr);
*(mem - 1) = p_elements;
if (!std::is_trivially_constructible<T>::value) {
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 38ea4a0fdd..991b179e1f 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -355,7 +355,7 @@ void OS::set_cmdline(const char *p_execpath, const List<String> &p_args, const L
}
String OS::get_unique_id() const {
- ERR_FAIL_V("");
+ return "";
}
int OS::get_processor_count() const {
diff --git a/core/os/pool_allocator.cpp b/core/os/pool_allocator.cpp
index c23196efdb..acbaed4ce8 100644
--- a/core/os/pool_allocator.cpp
+++ b/core/os/pool_allocator.cpp
@@ -305,7 +305,7 @@ Error PoolAllocator::resize(ID p_mem, int p_new_size) {
if (!e) {
mt_unlock();
- ERR_FAIL_COND_V(!e, ERR_INVALID_PARAMETER);
+ ERR_FAIL_NULL_V(e, ERR_INVALID_PARAMETER);
}
if (needs_locking && e->lock) {
@@ -431,7 +431,7 @@ bool PoolAllocator::is_locked(ID p_mem) const {
const void *PoolAllocator::get(ID p_mem) const {
if (!needs_locking) {
const Entry *e = get_entry(p_mem);
- ERR_FAIL_COND_V(!e, nullptr);
+ ERR_FAIL_NULL_V(e, nullptr);
return &pool[e->pos];
}
@@ -440,7 +440,7 @@ const void *PoolAllocator::get(ID p_mem) const {
if (!e) {
mt_unlock();
- ERR_FAIL_COND_V(!e, nullptr);
+ ERR_FAIL_NULL_V(e, nullptr);
}
if (e->lock == 0) {
mt_unlock();
@@ -463,7 +463,7 @@ const void *PoolAllocator::get(ID p_mem) const {
void *PoolAllocator::get(ID p_mem) {
if (!needs_locking) {
Entry *e = get_entry(p_mem);
- ERR_FAIL_COND_V(!e, nullptr);
+ ERR_FAIL_NULL_V(e, nullptr);
return &pool[e->pos];
}
@@ -472,7 +472,7 @@ void *PoolAllocator::get(ID p_mem) {
if (!e) {
mt_unlock();
- ERR_FAIL_COND_V(!e, nullptr);
+ ERR_FAIL_NULL_V(e, nullptr);
}
if (e->lock == 0) {
mt_unlock();
@@ -500,7 +500,7 @@ void PoolAllocator::unlock(ID p_mem) {
Entry *e = get_entry(p_mem);
if (!e) {
mt_unlock();
- ERR_FAIL_COND(!e);
+ ERR_FAIL_NULL(e);
}
if (e->lock == 0) {
mt_unlock();
@@ -540,7 +540,7 @@ void PoolAllocator::create_pool(void *p_mem, int p_size, int p_max_entries) {
PoolAllocator::PoolAllocator(int p_size, bool p_needs_locking, int p_max_entries) {
mem_ptr = memalloc(p_size);
- ERR_FAIL_COND(!mem_ptr);
+ ERR_FAIL_NULL(mem_ptr);
align = 1;
create_pool(mem_ptr, p_size, p_max_entries);
needs_locking = p_needs_locking;