From 9c2f72b44c1c48a59d985b2015f8feea8763a77d Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 28 Oct 2014 23:37:03 +0000 Subject: [PATCH] IORequest alib functions: - Allow a NULL ioreq to be passed to DeleteStdIO() and DeleteExtIO(), as per AmigaOS 3.1 AutoDocs. - Reimplemented DeleteStdIO() to simply call DeleteExtIO(). - Corrected and expanded AutoDocs. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@49735 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- compiler/alib/createextio.c | 22 ++++++++++------------ compiler/alib/createstdio.c | 22 ++++++++++------------ compiler/alib/deleteextio.c | 33 ++++++++++++++++----------------- compiler/alib/deletestdio.c | 27 +++++++-------------------- 4 files changed, 43 insertions(+), 61 deletions(-) diff --git a/compiler/alib/createextio.c b/compiler/alib/createextio.c index 9c95da3a58..d0d4cac6a5 100644 --- a/compiler/alib/createextio.c +++ b/compiler/alib/createextio.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2014, The AROS Development Team. All rights reserved. $Id$ Desc: @@ -15,22 +15,23 @@ #include #include - struct IORequest * CreateExtIO ( + struct IORequest * CreateExtIO( /* SYNOPSIS */ struct MsgPort * port, ULONG iosize) /* FUNCTION - Create an extended IORequest structure. This structure can - be freed with DeleteExtIO(). + Create an extended IORequest structure. This structure must be freed + with DeleteExtIO(). INPUTS - port - MsgPort to be signaled on events + port - MsgPort to be signaled on events. May be NULL, in which case + no IORequest is allocated. iosize - Size of the structure RESULT - A pointer to the new IORequest structure. + A pointer to the new IORequest structure, or NULL. NOTES @@ -39,17 +40,15 @@ BUGS SEE ALSO - CreateStdIO(), DeleteExtIO() + CreateStdIO(), DeleteExtIO(), DeleteStdIO() INTERNALS - HISTORY - ******************************************************************************/ { struct IORequest *ioreq=NULL; - if (port && (ioreq = AllocMem (iosize, MEMF_CLEAR|MEMF_PUBLIC))) + if (port && (ioreq = AllocMem(iosize, MEMF_CLEAR|MEMF_PUBLIC))) { /* Initialize the structure */ ioreq->io_Message.mn_Node.ln_Type = NT_MESSAGE; @@ -58,5 +57,4 @@ } return ioreq; -} /* CreateExtIO */ - +} diff --git a/compiler/alib/createstdio.c b/compiler/alib/createstdio.c index 2c470a8fb6..e7a15023a6 100644 --- a/compiler/alib/createstdio.c +++ b/compiler/alib/createstdio.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2001, The AROS Development Team. All rights reserved. + Copyright © 1995-2014, The AROS Development Team. All rights reserved. $Id$ Desc: Create a standard IORequest structure @@ -15,20 +15,21 @@ #include #include - struct IOStdReq * CreateStdIO ( + struct IOStdReq * CreateStdIO( /* SYNOPSIS */ struct MsgPort * port) /* FUNCTION - Create a standard IORequest structure. The structure - can be freed with DeleteStdIO(). + Create a standard IORequest structure. The structure must be freed + with DeleteStdIO(). INPUTS - port - The port to be signaled on events. + port - The port to be signaled on events. May be NULL, in which case + no IORequest is allocated. RESULT - A pointer to the new IORequest structure. + A pointer to the new IORequest structure, or NULL. NOTES @@ -37,14 +38,11 @@ BUGS SEE ALSO - CreateExtIO(), DeleteStdIO() + CreateExtIO(), DeleteExtIO(), DeleteStdIO() INTERNALS - HISTORY - ******************************************************************************/ { - return (struct IOStdReq *)CreateExtIO (port, sizeof (struct IOStdReq)); -} /* CreateStdIO */ - + return (struct IOStdReq *)CreateExtIO(port, sizeof(struct IOStdReq)); +} diff --git a/compiler/alib/deleteextio.c b/compiler/alib/deleteextio.c index bb299492a6..2dd3e390d4 100644 --- a/compiler/alib/deleteextio.c +++ b/compiler/alib/deleteextio.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2014, The AROS Development Team. All rights reserved. $Id$ Desc: Free a structure created by CreateExtIO() @@ -14,7 +14,7 @@ #include #include - void DeleteExtIO ( + void DeleteExtIO( /* SYNOPSIS */ struct IORequest * ioreq) @@ -23,8 +23,7 @@ Free a structure created by CreateExtIO(). INPUTS - ioreq - The returnvalue of CreateExtIO(). Must be - non-NULL. + ioreq - The return value of CreateExtIO(). May be NULL. RESULT None. @@ -36,21 +35,21 @@ BUGS SEE ALSO - CreateStdIO(), CreateExtIO() + CreateStdIO(), CreateExtIO(), DeleteStdIO() INTERNALS - HISTORY - ******************************************************************************/ { - /* Erase some fields to enforce crashes */ - ioreq->io_Message.mn_Node.ln_Type = -1L; - - ioreq->io_Device = (struct Device *)-1L; - ioreq->io_Unit = (struct Unit *)-1L; - - /* Free the memory */ - FreeMem(ioreq,ioreq->io_Message.mn_Length); -} /* DeleteExtIO */ - + if (ioreq != NULL) + { + /* Erase some fields to enforce crashes */ + ioreq->io_Message.mn_Node.ln_Type = -1L; + + ioreq->io_Device = (struct Device *)-1L; + ioreq->io_Unit = (struct Unit *)-1L; + + /* Free the memory */ + FreeMem(ioreq,ioreq->io_Message.mn_Length); + } +} diff --git a/compiler/alib/deletestdio.c b/compiler/alib/deletestdio.c index 5f0b92daed..4e2e4649d9 100644 --- a/compiler/alib/deletestdio.c +++ b/compiler/alib/deletestdio.c @@ -1,20 +1,18 @@ /* - Copyright © 1995-2007, The AROS Development Team. All rights reserved. + Copyright © 1995-2014, The AROS Development Team. All rights reserved. $Id$ - Desc: amiga.lib function DeleteStdIo() + Desc: amiga.lib function DeleteStdIO() Lang: english */ -#include /***************************************************************************** NAME */ #include #include -#include - void DeleteStdIO ( + void DeleteStdIO( /* SYNOPSIS */ struct IOStdReq * io) @@ -23,8 +21,7 @@ Delete a structure which was created by CreateStdIO(). INPUTS - io - The value returned by CreateStdIO(). Must be - non-NULL. + io - The value returned by CreateStdIO(). May be NULL. RESULT None. @@ -38,21 +35,11 @@ BUGS SEE ALSO - CreateStdIO() + CreateStdIO(), CreateExtIO(), DeleteExtIO() INTERNALS - HISTORY - ******************************************************************************/ { -# define ioreq ((struct IORequest *)io) - /* Write illegal values to some fields to enforce crashes */ - ioreq->io_Message.mn_Node.ln_Type = -1L; - - ioreq->io_Device = (struct Device *)-1L; - ioreq->io_Unit = (struct Unit *)-1L; - - FreeMem (ioreq, ioreq->io_Message.mn_Length); -} /* DeleteStdIO */ - + DeleteExtIO((struct IORequest *)io); +} -- 2.11.4.GIT