From 55211af76164fe6c39249c14be47363d35a4db0f Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Fri, 25 Jan 2019 21:45:01 +0100 Subject: add memory allocation functions --- alf/alf.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'alf/alf.h') diff --git a/alf/alf.h b/alf/alf.h index 38e3b0b..f5e3b26 100644 --- a/alf/alf.h +++ b/alf/alf.h @@ -89,6 +89,18 @@ ALF_CreateApplication(HINSTANCE hInstance); void ALF_TeardownApplication(ALFAPP app); +void * +ALF_Alloc(SIZE_T nmemb, SIZE_T size); + +void * +ALF_ReAlloc(void *ptr, SIZE_T nmemb, SIZE_T size); + +#define ALF_New(type, count) ((type *)ALF_Alloc((count), sizeof(type))) +#define ALF_ReNew(ptr, type, count) ((type *)ALF_ReAlloc(ptr, (count), sizeof(type))) + +void +ALF_Free(const void *p); + LPTSTR ALF_RegisterWindowClass(ALFAPP app, const ALFWindowClassParams *params); @@ -180,10 +192,10 @@ ALF_SetText(HWND hwnd, const TCHAR *text); void ALF_SetWidgetText(HWND parent, WORD id, const TCHAR *text); -TCHAR * // free with HeapFree +TCHAR * // free with ALF_Free ALF_Text(HWND hwnd); -TCHAR * // free with HeapFree +TCHAR * // free with ALF_Free ALF_WidgetText(HWND parent, WORD id); DWORD @@ -236,7 +248,7 @@ ALF_ComboBoxInsertString(HWND combo, int index, const TCHAR *text); void ALF_ComboBoxRemoveString(HWND combo, int index); -TCHAR * // free with HeapFree +TCHAR * // free with ALF_Free ALF_ComboBoxStringForIndex(HWND combo, int index); int @@ -245,7 +257,7 @@ ALF_ComboBoxCurrentIndex(HWND combo); void ALF_ComboBoxSetCurrentIndex(HWND combo, int index); -TCHAR * // free with HeapFree +TCHAR * // free with ALF_Free ALF_ComboBoxCurrentText(HWND combo); void -- cgit v1.2.3