Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions include/coreinit/ipcbufpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,15 @@ IPCBufPoolCreate(void *buffer,
uint32_t *outNumMessages,
uint32_t unk0x0c);

void *
IPCBufPoolAllocate(IPCBufPool *pool,
uint32_t size);

IOSError
IPCBufPoolFree(IPCBufPool *pool,
void *message);

void *
IPCBufPoolAllocate(IPCBufPool *pool,
uint32_t size)
WUT_MALLOC WUT_FREED_BY(IPCBufPoolFree, 2) WUT_ALLOC_SIZE(2);

IOSError
IPCBufPoolGetAttributes(IPCBufPool *pool,
IPCBufPoolAttributes *attribs);
Expand Down
14 changes: 8 additions & 6 deletions include/coreinit/memblockheap.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,21 @@ MEMAddBlockHeapTracking(MEMHeapHandle heap,
MEMBlockHeapTracking *tracking,
uint32_t size);

void
MEMFreeToBlockHeap(MEMHeapHandle heap,
void *data);

void *
MEMAllocFromBlockHeapAt(MEMHeapHandle heap,
void *addr,
uint32_t size);
uint32_t size)
WUT_MALLOC WUT_FREED_BY(MEMFreeToBlockHeap, 2) WUT_ALLOC_SIZE(3);

void *
MEMAllocFromBlockHeapEx(MEMHeapHandle heap,
uint32_t size,
int32_t align);

void
MEMFreeToBlockHeap(MEMHeapHandle heap,
void *data);
int32_t align)
WUT_MALLOC WUT_FREED_BY(MEMFreeToBlockHeap, 2) WUT_ALLOC_SIZE(2) WUT_ALLOC_ALIGN(3);

uint32_t
MEMGetAllocatableSizeForBlockHeapEx(MEMHeapHandle heap,
Expand Down
4 changes: 2 additions & 2 deletions include/coreinit/memdefaultheap.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
extern "C" {
#endif

typedef void *(*MEMAllocFromDefaultHeapFn)(uint32_t size);
typedef void *(*MEMAllocFromDefaultHeapExFn)(uint32_t size, int32_t alignment);
typedef WUT_ALLOC_SIZE(1) void *(*MEMAllocFromDefaultHeapFn)(uint32_t size);
typedef WUT_ALLOC_SIZE(1) WUT_ALLOC_ALIGN(2) void *(*MEMAllocFromDefaultHeapExFn)(uint32_t size, int32_t alignment);
typedef void (*MEMFreeToDefaultHeapFn)(void *ptr);

extern MEMAllocFromDefaultHeapFn MEMAllocFromDefaultHeap;
Expand Down
11 changes: 6 additions & 5 deletions include/coreinit/memexpheap.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ MEMCreateExpHeapEx(void *heap,
void *
MEMDestroyExpHeap(MEMHeapHandle heap);

void *
MEMAllocFromExpHeapEx(MEMHeapHandle heap,
uint32_t size,
int alignment);

void
MEMFreeToExpHeap(MEMHeapHandle heap,
void *block);

void *
MEMAllocFromExpHeapEx(MEMHeapHandle heap,
uint32_t size,
int alignment)
WUT_MALLOC WUT_FREED_BY(MEMFreeToExpHeap, 2) WUT_ALLOC_ALIGN(3);

MEMExpHeapMode
MEMSetAllocModeForExpHeap(MEMHeapHandle heap,
MEMExpHeapMode mode);
Expand Down
11 changes: 6 additions & 5 deletions include/coreinit/memfrmheap.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ MEMCreateFrmHeapEx(void *heap,
void *
MEMDestroyFrmHeap(MEMHeapHandle heap);

void *
MEMAllocFromFrmHeapEx(MEMHeapHandle heap,
uint32_t size,
int alignment);

void
MEMFreeToFrmHeap(MEMHeapHandle heap,
MEMFrmHeapFreeMode mode);

void *
MEMAllocFromFrmHeapEx(MEMHeapHandle heap,
uint32_t size,
int alignment)
WUT_MALLOC WUT_ALLOC_SIZE(2) WUT_ALLOC_ALIGN(3);

BOOL
MEMRecordStateForFrmHeap(MEMHeapHandle heap,
uint32_t tag);
Expand Down
7 changes: 4 additions & 3 deletions include/coreinit/memunitheap.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ MEMCreateUnitHeapEx(void *heap,
void *
MEMDestroyUnitHeap(MEMHeapHandle heap);

void *
MEMAllocFromUnitHeap(MEMHeapHandle heap);

void
MEMFreeToUnitHeap(MEMHeapHandle heap,
void *block);

void *
MEMAllocFromUnitHeap(MEMHeapHandle heap)
WUT_MALLOC WUT_FREED_BY(MEMFreeToUnitHeap, 2);

void
MEMiDumpUnitHeap(MEMHeapHandle heap);

Expand Down
11 changes: 7 additions & 4 deletions include/sndcore2/voice.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,24 @@ AXVoiceBegin(AXVoice *v);
int32_t
AXVoiceEnd(AXVoice *v);

void
AXFreeVoice(AXVoice *voice);

AXVoice *
AXAcquireVoice(uint32_t priority,
AXVoiceCallbackFn callback,
void *userContext);
void *userContext)
WUT_FREED_BY(AXFreeVoice, 1);

AXVoice *
AXAcquireVoiceEx(uint32_t priority,
AXVoiceCallbackExFn callback,
void *userContext);
void *userContext)
WUT_FREED_BY(AXFreeVoice, 1);

BOOL
AXCheckVoiceOffsets(AXVoiceOffsets *offsets);

void
AXFreeVoice(AXVoice *voice);

uint32_t
AXGetMaxVoices();
Expand Down
15 changes: 11 additions & 4 deletions include/wut.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@

#if defined(__GNUC__) || defined(__clang__)

#define WUT_DEPRECATED(reason) __attribute__((__deprecated__(reason)))
#define WUT_FORMAT_PRINTF(fmt, args) __attribute__((__format__(__printf__, fmt, args)))
#define WUT_DEPRECATED(reason) __attribute__((__deprecated__(reason)))
#define WUT_FORMAT_PRINTF(fmt, args) __attribute__((__format__(__printf__, fmt, args)))
#define WUT_MALLOC __attribute__((malloc))
#define WUT_FREED_BY(freeFn, ptrIndex) __attribute__((malloc(freeFn, ptrIndex)))
#define WUT_ALLOC_SIZE(posIndex) __attribute__((alloc_size(posIndex)))
#define WUT_ALLOC_ALIGN(posIndex) __attribute__((alloc_align(posIndex)))

#else // not __GNUC__ and not __clang__

#define WUT_DEPRECATED(reason)
#define WUT_FORMAT_PRINTF(fmt, args)

#define WUT_MALLOC
#define WUT_FREED_BY(freeFn, ptrIndex)
#define WUT_ALLOC_SIZE(posIndex)
#define WUT_ALLOC_ALIGN(posIndex)
#endif //__GNUC__ or __clang__

#ifdef DEBUG
Expand All @@ -24,9 +31,9 @@
#define WUT_DEBUG_REPORT(fmt, ...)
#endif

#include "wut_rplwrap.h"
#include "wut_structsize.h"
#include "wut_types.h"
#include "wut_rplwrap.h"
#ifdef DEBUG
#include <coreinit/debug.h>
#endif