Skip to content

Commit

Permalink
Clean __osMalloc.c (HarbourMasters#4351)
Browse files Browse the repository at this point in the history
* Remove #ifs

* Add `NODE_IS_VALID`

* Fix current macros

* `NODE_GET_NEXT` & `NODE_GET_PREV`

* Add macros

* Use macros and general cleanup

* Fix build (hopefully)

* Address review
  • Loading branch information
Pepe20129 authored Nov 12, 2024
1 parent f12a2bb commit ffc132a
Show file tree
Hide file tree
Showing 7 changed files with 249 additions and 158 deletions.
6 changes: 3 additions & 3 deletions soh/include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ void __osMallocInit(Arena* arena, void* start, size_t size);
void __osMallocAddBlock(Arena* arena, void* start, ptrdiff_t size);
void ArenaImpl_RemoveAllBlocks(Arena* arena);
void __osMallocCleanup(Arena* arena);
u8 __osMallocIsInitalized(Arena* arena);
s32 __osMallocIsInitialized(Arena* arena);
void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node);
void* __osMalloc_NoLockDebug(Arena* arena, size_t size, const char* file, s32 line);
void* __osMallocDebug(Arena* arena, size_t size, const char* file, s32 line);
Expand All @@ -2284,7 +2284,7 @@ void* __osReallocDebug(Arena* arena, void* ptr, size_t newSize, const char* file
void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc);
void __osDisplayArena(Arena* arena);
void ArenaImpl_FaultClient(Arena* arena);
u32 __osCheckArena(Arena* arena);
s32 __osCheckArena(Arena* arena);
u8 func_800FF334(Arena* arena);
s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args);
s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...);
Expand Down Expand Up @@ -2408,7 +2408,7 @@ OSThread* __osGetCurrFaultedThread(void);
u32* osViGetCurrentFramebuffer(void);
s32 __osSpSetPc(void* pc);
f32 absf(f32);
void* func_801068B0(void* dst, void* src, size_t size);
void* oot_memmove(void* dest, const void* src, size_t len);
void Message_UpdateOcarinaGame(PlayState* play);
u8 Message_ShouldAdvance(PlayState* play);
u8 Message_ShouldAdvanceSilent(PlayState* play);
Expand Down
14 changes: 7 additions & 7 deletions soh/include/z64.h
Original file line number Diff line number Diff line change
Expand Up @@ -2038,13 +2038,13 @@ typedef struct ArenaNode {
/* 0x04 */ size_t size;
/* 0x08 */ struct ArenaNode* next;
/* 0x0C */ struct ArenaNode* prev;
///* 0x10 */ const char* filename;
///* 0x14 */ s32 line;
///* 0x18 */ OSId threadId;
///* 0x1C */ Arena* arena;
///* 0x20 */ OSTime time;
///* 0x28 */ u8 unk_28[0x30-0x28]; // probably padding
} ArenaNode; // size = 0x10
// /* 0x10 */ const char* filename;
// /* 0x14 */ s32 line;
// /* 0x18 */ OSId threadId;
// /* 0x1C */ Arena* arena;
// /* 0x20 */ OSTime time;
// /* 0x28 */ u8 unk_28[0x30-0x28]; // probably padding
} ArenaNode; // size = 0x30

typedef struct OverlayRelocationSection {
/* 0x00 */ u32 textSize;
Expand Down
Loading

0 comments on commit ffc132a

Please sign in to comment.