wip commit. acpi button driver.
[AROS.git] / rom / utility / allocatetagitems.c
blobb9fb912f987967636ac94ab21297b40a0ed20f0f
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: AllocateTagItems()
6 Lang: english
7 */
8 #include <proto/exec.h>
9 #include "intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <utility/tagitem.h>
15 #include <proto/utility.h>
17 AROS_LH1(struct TagItem *, AllocateTagItems,
19 /* SYNOPSIS */
20 AROS_LHA(ULONG, numTags, D0),
22 /* LOCATION */
23 struct UtilityBase *, UtilityBase, 11, Utility)
25 /* FUNCTION
26 Allocate a number of TagItems in an array for whatever you like.
27 The memory allocated will be cleared.
29 INPUTS
30 numTags - The number of TagItems to allocate.
32 RESULT
33 A pointer to an array of struct TagItem containing numTags tags.
35 NOTES
36 The number you supply must include the terminating tag (ie TAG_DONE)
37 There is no provision for extra TagItems at the end of the list.
39 If the number of tags to allocate is zero, then none will be.
41 EXAMPLE
42 struct TagItem *tagList;
44 tagList = AllocateTagItems( 4 );
46 tagList[0].ti_Tag = NA_Name;
47 tagList[0].ti_Data = (IPTR)"A list of tags";
48 tagList[3].ti_Tag = TAG_DONE;
50 \* Do what you want with your TagList here ... *\
52 FreeTagItems( tagList );
54 BUGS
56 SEE ALSO
57 FreeTagItems()
59 INTERNALS
61 HISTORY
62 29-10-95 digulla automatically created from
63 utility_lib.fd and clib/utility_protos.h
64 11-08-96 iaint Moved code into the AROS source.
66 *****************************************************************************/
68 AROS_LIBFUNC_INIT
69 struct TagItem *tags = NULL;
71 if( numTags )
72 tags = AllocVec( numTags * sizeof(struct TagItem) ,
73 MEMF_CLEAR | MEMF_PUBLIC );
75 return tags;
77 AROS_LIBFUNC_EXIT
79 } /* AllocateTagItems */