Indentation fix, cleanup.
[AROS.git] / rom / exec / gettaskstorageslot.c
blobe6b7e33b55926f3c392ceec76ca8ba88941fd6ad
1 /*
2 Copyright © 2012-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
8 #include <exec/nodes.h>
9 #include <exec/lists.h>
10 #include <clib/macros.h>
12 #include "exec_intern.h"
13 #include "taskstorage.h"
15 /*****************************************************************************
17 NAME */
18 #include <proto/exec.h>
20 AROS_LH1(IPTR, GetTaskStorageSlot,
22 /* LOCATION */
23 AROS_LHA(LONG, id, D0),
24 struct ExecBase *, SysBase, 185, Exec)
26 /* FUNCTION
27 Get a value for a task storage slot.
29 INPUTS
30 id - slot ID returned from AllocTaskStorageSlot().
32 RESULT
33 Value stored by SetTaskStorageSlot(), or (IPTR)NULL if the slot was
34 never used.
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 AllocTaskStorageSlot(), FreeTaskStorageSlot(), SetTaskStorageSlot()
45 INTERNALS
47 ******************************************************************************/
49 AROS_LIBFUNC_INIT
51 return TaskGetStorageSlot(GET_THIS_TASK, id);
53 AROS_LIBFUNC_EXIT
56 IPTR TaskGetStorageSlot(struct Task * t, LONG id)
58 struct ETask *et = GetETask(t);
59 IPTR *ts;
61 D(bug("TaskGetStorageSlot: %p: Get TaskGetStorageSlot %d\n", et, id);)
63 if (!et) {
64 /* Only ETasks can do this */
65 D(bug("TaskGetStorageSlot: Not an ETask!\n");)
66 return (IPTR)NULL;
69 ts = et->et_TaskStorage;
70 if (ts == NULL || ts[__TS_FIRSTSLOT] <= id) {
71 D(bug("TaskGetStorageSlot: ID %d was not set!\n", id);)
72 return (IPTR)NULL;
75 return ts[id];