/* * $Id$ * * $Date$ * $Revision$ * * Written in 2018 by Daniel "Daytona675x" Müßener * * This file is part of the MiniGL library project * See the file Licence.txt for more details * */ #include "sysinc.h" #include "util.h" void *AllocVecInternal(ULONG byteSize, ULONG attributes) { #if defined (__amigaos4__XXX) // For unknown reasons this may lead to a crash on exit. // No idea why. MEMF_SHARED should be appropriate for every existing former AllocVec call in this lib // and the rest is fine too. Anyway: // Reverted to old AllocVec for. return IExec->AllocVecTags(byteSize,AVT_Type,MEMF_SHARED,AVT_Alignment,32,(attributes & MEMF_CLEAR) ? AVT_ClearWithValue : TAG_DONE,0,TAG_DONE); #else return IExec->AllocVec(byteSize,attributes); #endif } void FreeVecInternal(void *memoryBlock) { IExec->FreeVec(memoryBlock); } void FreeVecInternalCheckAndClear(void **memoryBlock) { if(*memoryBlock) { IExec->FreeVec(*memoryBlock); *memoryBlock=NULL; } } struct IORequest *CreateIORequestInternal(struct MsgPort *ioReplyPort, ULONG size) { #if defined (__amigaos4__) return (struct IORequest *)IExec->AllocSysObjectTags(ASOT_IOREQUEST,ASOIOR_Size,size,ASOIOR_ReplyPort,ioReplyPort,TAG_DONE); #else return IExec->CreateIORequest(ioReplyPort,size); #endif } void DeleteIORequestInternal(struct IORequest *ioReq) { #if defined (__amigaos4__) IExec->FreeSysObject(ASOT_IOREQUEST,(APTR)ioReq); #else IExec->DeleteIORequest(ioReq); #endif } struct MsgPort* CreateMsgPortInternal(void) { #if defined (__amigaos4__) return (struct MsgPort *)IExec->AllocSysObject(ASOT_PORT,NULL); #else return IExec->CreateMsgPort(); #endif } void DeleteMsgPortInternal(struct MsgPort *port) { #if defined (__amigaos4__) IExec->FreeSysObject(ASOT_PORT,(APTR)port); #else IExec->DeleteMsgPort(port); #endif }