Misc Cleanup (#1257)

* a lot of brackets, and some other things

* oops

* another bracket

* check flag all

* just a few more...

* PR suggestions

* PR comment

* pr

* one more bracket
This commit is contained in:
engineer124
2023-06-05 05:43:12 +10:00
committed by GitHub
parent a995e4cf61
commit 47bc7c12e2
110 changed files with 1086 additions and 623 deletions
+2 -2
View File
@@ -275,7 +275,7 @@ void __osFree(Arena* arena, void* ptr) {
node = (ArenaNode*)((uintptr_t)ptr - sizeof(ArenaNode));
if (ptr != NULL && node->magic == NODE_MAGIC && !node->isFree) {
if ((ptr != NULL) && (node->magic == NODE_MAGIC) && !node->isFree) {
next = node->next;
prev = node->prev;
node->isFree = true;
@@ -297,7 +297,7 @@ void __osFree(Arena* arena, void* ptr) {
// Checks if the previous node is contiguous to the current node and if it isn't currently allocated. Then merge
// the two nodes into one.
if (prev != NULL && prev->isFree && (uintptr_t)node == (uintptr_t)prev + sizeof(ArenaNode) + prev->size) {
if ((prev != NULL) && prev->isFree && ((uintptr_t)node == (uintptr_t)prev + sizeof(ArenaNode) + prev->size)) {
if (next != NULL) {
next->prev = prev;
}
+1 -1
View File
@@ -61,7 +61,7 @@ void* SystemHeap_RunBlockFunc8(void* blk, size_t nBlk, size_t blkSize, BlockFunc
blk = SystemHeap_Malloc(nBlk * blkSize);
}
if (blk != NULL && blockFunc != NULL) {
if ((blk != NULL) && (blockFunc != NULL)) {
uintptr_t pos = blk;
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {