use the override options if specified
[AROS.git] / rom / utility / refreshtagitemclones.c
blob29539947d959b95b5f1c7864a62d017f494faff3
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: RefreshTagItemClones()
6 Lang: english
7 */
8 #include "intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <utility/tagitem.h>
14 #include <proto/utility.h>
16 AROS_LH2(void, RefreshTagItemClones,
18 /* SYNOPSIS */
19 AROS_LHA(struct TagItem *, clone, A0),
20 AROS_LHA(const struct TagItem *, original, A1),
22 /* LOCATION */
23 struct UtilityBase *, UtilityBase, 14, Utility)
25 /* FUNCTION
26 If (and only if) the Tag list 'clone' was created by calling
27 CloneTagItems on the Tag list 'original', and the list original
28 has NOT been changed in any way, then this function will change
29 the list 'clone' back to its original state.
31 INPUTS
32 original - The source TagList (unaltered)
33 clone - The destination TagList (MUST be allocated by
34 CloneTagItems())
36 RESULT
37 The second TagList now has the same values as the first.
39 NOTES
40 If either of the inputs is NULL, then the function will not do
41 anything.
43 EXAMPLE
44 struct TagItem *orig, clone;
46 \* TagList orig has some values already *\
47 clone = CloneTagList( orig );
49 \* In between here we do something to the TagItems in clone,
50 but we need to have them restored.
53 RefreshTagItemClones( clone, orig );
55 BUGS
56 None, however if either of the two pre-conditions is not fulfilled
57 then this function will probably be unreliable, or trash memory.
59 We warned you...
61 SEE ALSO
62 CloneTagItems()
64 INTERNALS
66 *****************************************************************************/
68 AROS_LIBFUNC_INIT
70 struct TagItem *current;
72 if( !clone )
73 return;
75 /* If we don't have an original, but do have a clone, set the
76 clone to have a definite end of TagList.
78 This is because CloneTagItems(NULL) is valid.
80 if(!original)
82 clone->ti_Tag = TAG_DONE;
83 return;
86 /* Remember, the clone list is a straight memory block, however
87 the original list may not be.
89 while ((current = NextTagItem ((struct TagItem **)&original)))
91 *clone = *current; /* Copies both tag and data */
92 clone++;
95 AROS_LIBFUNC_EXIT
96 } /* RefreshTagItemClones */