Convenience method FreeAll

This commit is contained in:
Slapparoo 2022-12-19 22:32:49 +13:00
parent 777203d952
commit ff2bbca1ab
2 changed files with 9 additions and 1 deletions

View file

@ -555,6 +555,7 @@ public extern U8 *ReAlloc( U8 *src, U64 size, CTask *mem_task=NU
public _extern _MHEAP_CTRL CHeapCtrl *MHeapCtrl( U8 *src); public _extern _MHEAP_CTRL CHeapCtrl *MHeapCtrl( U8 *src);
public _extern _MSIZE I64 MSize( U8 *src); //size of heap object public _extern _MSIZE I64 MSize( U8 *src); //size of heap object
public _extern _MSIZE2 I64 MSize2( U8 *src); //Internal size public _extern _MSIZE2 I64 MSize2( U8 *src); //Internal size
public extern U0 FreeAll(...); //Free all pointers passed
#help_index "Memory/HeapCtrl" #help_index "Memory/HeapCtrl"
public extern U0 HeapCtrlDel( CHeapCtrl *hc); public extern U0 HeapCtrlDel( CHeapCtrl *hc);
@ -735,4 +736,4 @@ public extern F64 tS(); //From SysTimerFreq.
#help_index "Windows" #help_index "Windows"
public extern Bool WinInside(I64 x, I64 y, CTask *task=NULL, I64 border=0); public extern Bool WinInside(I64 x, I64 y, CTask *task=NULL, I64 border=0);
#help_index "" #help_index ""

View file

@ -504,3 +504,10 @@ U8 *SysStrNew(U8 *buf)
{//Alloc copy of string in System task's heap. {//Alloc copy of string in System task's heap.
return StrNew(buf, sys_task); return StrNew(buf, sys_task);
} }
U0 FreeAll(...)
{// Free all pointers passed
U64 cur_arg = 0;
while (argc--)
Free(argv[cur_arg++]);
}