Clean up unnecessary else statement right after previous return

This commit is contained in:
Jim Huang 2019-06-24 00:38:52 +08:00 committed by Jim Huang
parent 06f8da4218
commit ce25fffc69
5 changed files with 19 additions and 33 deletions

View file

@ -94,7 +94,6 @@ static void* mi_realloc_zero_aligned_at(void* p, size_t newsize, size_t alignmen
&& (((uintptr_t)p + offset) % alignment) == 0) {
return p; // reallocation still fits, is aligned and not more than 50% waste
}
else {
void* newp = mi_malloc_aligned_at(newsize,alignment,offset);
if (newp != NULL) {
if (zero && newsize > size) {
@ -107,7 +106,6 @@ static void* mi_realloc_zero_aligned_at(void* p, size_t newsize, size_t alignmen
}
return newp;
}
}
static void* _mi_realloc_aligned(void* p, size_t newsize, size_t alignment, bool zero) mi_attr_noexcept {
mi_assert(alignment > 0);

View file

@ -154,11 +154,9 @@ static malloc_zone_t* mi_get_default_zone()
if (ret == KERN_SUCCESS && count > 0) {
return zones[0];
}
else {
// fallback
return malloc_default_zone();
}
}
static void __attribute__((constructor)) _mi_macosx_override_malloc()

View file

@ -266,10 +266,8 @@ size_t mi_usable_size(void* p) mi_attr_noexcept {
mi_assert_internal(adjust >= 0 && (size_t)adjust <= size);
return (size - adjust);
}
else {
return size;
}
}
@ -418,10 +416,8 @@ char* mi_heap_realpath(mi_heap_t* heap, const char* fname, char* resolved_name)
else if (resolved_name != NULL) {
return resolved_name;
}
else {
return mi_heap_strndup(heap, buf, PATH_MAX);
}
}
#else
#include <limits.h>
#ifndef PATH_MAX
@ -432,12 +428,10 @@ char* mi_heap_realpath(mi_heap_t* heap, const char* fname, char* resolved_name)
if (resolved_name != NULL) {
return realpath(fname,resolved_name);
}
else {
char buf[PATH_MAX+1];
char* rname = realpath(fname,buf);
return mi_heap_strndup(heap,rname,PATH_MAX); // ok if `rname==NULL`
}
}
#endif
char* mi_realpath(const char* fname, char* resolved_name) mi_attr_noexcept {

View file

@ -493,10 +493,8 @@ static bool mi_heap_area_visitor(const mi_heap_t* heap, const mi_heap_area_ex_t*
if (args->visit_blocks) {
return mi_heap_area_visit_blocks(xarea, args->visitor, args->arg);
}
else {
return true;
}
}
// Visit all blocks in a heap
bool mi_heap_visit_blocks(const mi_heap_t* heap, bool visit_blocks, mi_block_visit_fun* visitor, void* arg) {

View file

@ -150,10 +150,8 @@ size_t mi_good_size(size_t size) mi_attr_noexcept {
if (size <= MI_LARGE_SIZE_MAX) {
return _mi_bin_size(_mi_bin(size));
}
else {
return _mi_align_up(size,_mi_os_page_size());
}
}
#if (MI_DEBUG>1)
static bool mi_page_queue_contains(mi_page_queue_t* queue, const mi_page_t* page) {