2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
8 #include <exec/memory.h>
9 #include <proto/exec.h>
10 #include <dos/exall.h>
11 #include <dos/rdargs.h>
12 #include "dos_intern.h"
14 /*****************************************************************************
17 #include <proto/dos.h>
19 AROS_LH2(void, FreeDosObject
,
22 AROS_LHA(ULONG
, type
, D1
),
23 AROS_LHA(APTR
, ptr
, D2
),
26 struct DosLibrary
*, DOSBase
, 39, Dos
)
29 Frees an object allocated with AllocDosObject.
32 type - object type. The same parameter as given to AllocDosObject().
33 ptr - Pointer to object.
48 *****************************************************************************/
59 struct FileHandle
*fh
=(struct FileHandle
*)ptr
;
60 if (fh
->fh_Flags
& FHF_OWNBUF
)
61 FreeMem(BADDR(fh
->fh_OrigBuf
),fh
->fh_BufSize
);
73 case DOS_EXALLCONTROL
:
74 if (((struct InternalExAllControl
*)ptr
)->fib
)
75 FreeDosObject(DOS_FIB
, ((struct InternalExAllControl
*)ptr
)->fib
);
82 struct CommandLineInterface
*cli
=(struct CommandLineInterface
*)ptr
;
84 cur
=(BPTR
*)BADDR(cli
->cli_CommandDir
);
85 FreeVec(BADDR(cli
->cli_SetName
));
86 FreeVec(BADDR(cli
->cli_CommandName
));
87 FreeVec(BADDR(cli
->cli_CommandFile
));
88 FreeVec(BADDR(cli
->cli_Prompt
));
92 next
=(BPTR
*)BADDR(cur
[0]);
100 FreeArgs() will not free a RDArgs without a RDA_DAList,
101 see that function for more information as to why...
104 if(((struct RDArgs
*)ptr
)->RDA_DAList
!= 0)
113 } /* FreeDosObject */
118 #define offsetof(TYPE, MEMBER) ((IPTR) &((TYPE *)0)->MEMBER)
119 #define container_of(ptr, type, member) ({ \
120 const typeof(((type *)0)->member) *__mptr = (ptr); \
121 (type *)((char *)__mptr - offsetof(type, member)); })
123 void freedospacket(struct DosPacket
*dp
)
125 FreeVec(container_of(dp
, struct StandardPacket
, sp_Pkt
));