From ea73b61cea2b6e50e0079042eae1185a726e2273 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 16 Sep 2020 21:22:50 -0400 Subject: rough decomp --- include/darray.h | 7 ++++--- include/hashtable.h | 12 ++++++------ include/nonport.h | 2 +- include/qsort.h | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/darray.h b/include/darray.h index ec6010f..db8b264 100644 --- a/include/darray.h +++ b/include/darray.h @@ -7,7 +7,7 @@ extern "C" { #include "types.h" -typedef int (*CompareFunction)(const void *, const void *); +typedef s32 (*CompareFunction)(const void *, const void *); typedef BOOL (*MapFunction)(const void *, s32); typedef void (*DtorFunction)(void *); @@ -20,9 +20,10 @@ typedef struct DArray { char *buf; } DArray; -void *ArrayNew(u32 p1, s32 p2, s32 p3); +DArray *ArrayNew(u32 p1, s32 p2, DtorFunction dtor); void *ArrayNth(DArray *p1, s32 p2); -void *ArrayMapBackwards2(DArray *p1, s32 p2, s32 p3); +void ArrayMapBackwards(DArray *p1, MapFunction p2, s32 p3); +void *ArrayMapBackwards2(DArray *p1, MapFunction p2, s32 p3); #ifdef __cplusplus } diff --git a/include/hashtable.h b/include/hashtable.h index 79acbf6..784ab35 100644 --- a/include/hashtable.h +++ b/include/hashtable.h @@ -12,20 +12,20 @@ typedef s32 (*HashFunction)(void *, s32); typedef struct HashTable { DArray **chains; s32 size; - s32 unk8; + DtorFunction dtor; HashFunction hashFunc; - s32 unk10; // comparison callback? + CompareFunction compar; } HashTable; -HashTable *TableNew(u32 p1, s32 p2, HashFunction hf, s32 p4, s32 p5); -HashTable *TableNew2(u32 p1, s32 size, s32 p3, HashFunction hf, s32 p5, s32 p6); +HashTable *TableNew(u32 p1, s32 p2, HashFunction hf, CompareFunction cmp, DtorFunction dtor); +HashTable *TableNew2(u32 p1, s32 size, s32 p3, HashFunction hf, CompareFunction cmp, DtorFunction dtor); void TableFree(HashTable *table); s32 TableCount(HashTable *table); void TableEnter(HashTable *table, void *elem); BOOL TableRemove(HashTable *table, void *elem); void *TableLookup(HashTable *table, void *elem); -void TableMapSafe(HashTable *table, s32 p2, s32 p3); -void *TableMapSafe2(HashTable *table, s32 p2, s32 p3); +void TableMapSafe(HashTable *table, MapFunction p2, s32 p3); +void *TableMapSafe2(HashTable *table, MapFunction p2, s32 p3); #ifdef __cplusplus } diff --git a/include/nonport.h b/include/nonport.h index 2cc5146..c1ed0e7 100644 --- a/include/nonport.h +++ b/include/nonport.h @@ -6,7 +6,7 @@ extern "C" { #endif void *gsimalloc(u32 sz); - +void *gsirealloc(void *ptr, u32 sz); void gsifree(void *ptr); #ifdef __cplusplus diff --git a/include/qsort.h b/include/qsort.h index c68b747..c13ae0e 100644 --- a/include/qsort.h +++ b/include/qsort.h @@ -5,8 +5,8 @@ extern "C" { #endif -void qsort(void *base, size_t nmemb, size_t size, - int (*compar)(const void *, const void *)); +void qsort(void *base, u32 nmemb, u32 size, + s32 (*compar)(const void *, const void *)); #ifdef __cplusplus } -- cgit v1.2.3