2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
5 Desc: Free arguments structure from ReadArgs()
8 #include <proto/exec.h>
9 #include <dos/rdargs.h>
10 #include "dos_intern.h"
12 /*****************************************************************************
15 #include <proto/dos.h>
17 AROS_NTLH1(void, FreeArgs
,
20 AROS_LHA(struct RDArgs
*, args
, D1
),
23 struct DosLibrary
*, DOSBase
, 143, Dos
)
26 FreeArgs() will clean up after a call to ReadArgs(). If the
27 RDArgs structure was allocated by the system in a call to
28 ReadArgs(), then it will be freed. If however, you allocated
29 the RDArgs structure with AllocDosObject(), then you will
30 have to free it yourself with FreeDosObject().
33 args - The data used by ReadArgs(). May be NULL, in which case,
34 FreeArgs() does nothing.
37 Some memory will have been returned to the system.
46 ReadArgs(), AllocDosObject(), FreeDosObject()
50 *****************************************************************************/
57 /* ReadArgs() failed. Clean everything up. */
60 FreeVec(((struct DAList
*)args
->RDA_DAList
)->ArgBuf
);
61 FreeVec(((struct DAList
*)args
->RDA_DAList
)->StrBuf
);
62 FreeVec(((struct DAList
*)args
->RDA_DAList
)->MultVec
);
63 FreeVec((struct DAList
*)args
->RDA_DAList
);
69 Why do I put this here. Unless the user has been bad and
70 set RDA_DAList to something other than NULL, then this
71 RDArgs structure was allocated by ReadArgs(), so we can
72 free it. Otherwise the RDArgs was allocated by
73 AllocDosObject(), so we are not allowed to free it.
75 See the original AmigaOS autodoc if you don't believe me
82 if (args
->RDA_Flags
& RDAF_ALLOCATED_BY_READARGS
)