From 926ef40c5266d3135e197bb9532360811bf9a399 Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sat, 16 Jan 2021 20:17:57 -0500 Subject: Get rid of Task_data_OP macro This macro is so annoying. Can we please do away with it? --- src/task.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index a97496009..e0db8b6fa 100644 --- a/src/task.c +++ b/src/task.c @@ -136,32 +136,17 @@ void TaskDummy(u8 taskId) { } -#define TASK_DATA_OP(taskId, offset, op) \ -{ \ - u32 tasksAddr = (u32)gTasks; \ - u32 addr = taskId * sizeof(struct Task) + offset; \ - u32 dataAddr = tasksAddr + offsetof(struct Task, data); \ - addr += dataAddr; \ - op; \ -} - +#define TASK_SPACE NUM_TASKS - 2 // So we can insert the two tasks at the last two array elements void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc) { - TASK_DATA_OP(taskId, 28, *((u16 *)addr) = (u32)followupFunc) - TASK_DATA_OP(taskId, 30, *((u16 *)addr) = (u32)followupFunc >> 16) + gTasks[taskId].data[TASK_SPACE] = (s16)((u32)followupFunc); + gTasks[taskId].data[TASK_SPACE + 1] = (s16)((u32)followupFunc >> 16); gTasks[taskId].func = func; } void SwitchTaskToFollowupFunc(u8 taskId) { - s32 func; - - gTasks[taskId].func = NULL; - - TASK_DATA_OP(taskId, 28, func = *((u16 *)addr)) - TASK_DATA_OP(taskId, 30, func |= *((s16 *)addr) << 16) - - gTasks[taskId].func = (TaskFunc)func; + gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[TASK_SPACE]) | (gTasks[taskId].data[TASK_SPACE + 1] << 16)); } bool8 FuncIsActiveTask(TaskFunc func) @@ -183,7 +168,7 @@ u8 FindTaskIdByFunc(TaskFunc func) if (gTasks[i].isActive == TRUE && gTasks[i].func == func) return (u8)i; - return 0xFF; + return TAIL_SENTINEL; //No task found } u8 GetTaskCount(void) @@ -200,7 +185,7 @@ u8 GetTaskCount(void) void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value) { - if (dataElem < NUM_TASK_DATA - 1) + if (dataElem <= TASK_SPACE) { gTasks[taskId].data[dataElem] = value; gTasks[taskId].data[dataElem + 1] = value >> 16; @@ -209,7 +194,7 @@ void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value) u32 GetWordTaskArg(u8 taskId, u8 dataElem) { - if (dataElem < NUM_TASK_DATA - 1) + if (dataElem <= TASK_SPACE) return (u16)gTasks[taskId].data[dataElem] | (gTasks[taskId].data[dataElem + 1] << 16); else return 0; -- cgit v1.2.3 From 26246ce2812a10c442a914f5d916b2e6d7637e7e Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sat, 16 Jan 2021 20:29:42 -0500 Subject: Update task.c --- src/task.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index e0db8b6fa..ee58ba47c 100644 --- a/src/task.c +++ b/src/task.c @@ -139,14 +139,18 @@ void TaskDummy(u8 taskId) #define TASK_SPACE NUM_TASKS - 2 // So we can insert the two tasks at the last two array elements void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc) { - gTasks[taskId].data[TASK_SPACE] = (s16)((u32)followupFunc); - gTasks[taskId].data[TASK_SPACE + 1] = (s16)((u32)followupFunc >> 16); + u8 taskNum = TASK_SPACE; // Should be const + + gTasks[taskId].data[taskNum] = (s16)((u32)followupFunc); + gTasks[taskId].data[taskNum + 1] = (s16)((u32)followupFunc >> 16); gTasks[taskId].func = func; } void SwitchTaskToFollowupFunc(u8 taskId) { - gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[TASK_SPACE]) | (gTasks[taskId].data[TASK_SPACE + 1] << 16)); + u8 taskNum = TASK_SPACE; // Should be const + + gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[taskNum]) | (gTasks[taskId].data[taskNum + 1] << 16)); } bool8 FuncIsActiveTask(TaskFunc func) @@ -168,7 +172,7 @@ u8 FindTaskIdByFunc(TaskFunc func) if (gTasks[i].isActive == TRUE && gTasks[i].func == func) return (u8)i; - return TAIL_SENTINEL; //No task found + return TAIL_SENTINEL; // No task found } u8 GetTaskCount(void) -- cgit v1.2.3 From 6b5ce647dff4e3b04228929cc407393267befeef Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sat, 16 Jan 2021 20:31:09 -0500 Subject: Update task.c --- src/task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index ee58ba47c..f3771f08e 100644 --- a/src/task.c +++ b/src/task.c @@ -136,7 +136,7 @@ void TaskDummy(u8 taskId) { } -#define TASK_SPACE NUM_TASKS - 2 // So we can insert the two tasks at the last two array elements +#define TASK_SPACE NUM_TASKS - 2 // So we can reserve space for the last array element void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc) { u8 taskNum = TASK_SPACE; // Should be const -- cgit v1.2.3 From a950167d897a46ecce0e40050fd1f5025b9c211c Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sat, 16 Jan 2021 21:05:35 -0500 Subject: Remove define --- src/task.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index f3771f08e..03ae2c6be 100644 --- a/src/task.c +++ b/src/task.c @@ -136,10 +136,9 @@ void TaskDummy(u8 taskId) { } -#define TASK_SPACE NUM_TASKS - 2 // So we can reserve space for the last array element void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc) { - u8 taskNum = TASK_SPACE; // Should be const + u8 taskNum = NUM_TASKS - 2; // Should be const gTasks[taskId].data[taskNum] = (s16)((u32)followupFunc); gTasks[taskId].data[taskNum + 1] = (s16)((u32)followupFunc >> 16); @@ -148,7 +147,7 @@ void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc void SwitchTaskToFollowupFunc(u8 taskId) { - u8 taskNum = TASK_SPACE; // Should be const + u8 taskNum = NUM_TASKS - 2; // Should be const gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[taskNum]) | (gTasks[taskId].data[taskNum + 1] << 16)); } @@ -189,7 +188,7 @@ u8 GetTaskCount(void) void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value) { - if (dataElem <= TASK_SPACE) + if (dataElem < NUM_TASKS - 1) { gTasks[taskId].data[dataElem] = value; gTasks[taskId].data[dataElem + 1] = value >> 16; @@ -198,7 +197,7 @@ void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value) u32 GetWordTaskArg(u8 taskId, u8 dataElem) { - if (dataElem <= TASK_SPACE) + if (dataElem < NUM_TASKS - 1) return (u16)gTasks[taskId].data[dataElem] | (gTasks[taskId].data[dataElem + 1] << 16); else return 0; -- cgit v1.2.3 From 0159c0c1ae336ccded07a912466870eb452ba608 Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sat, 16 Jan 2021 21:09:51 -0500 Subject: Update task.c --- src/task.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index 03ae2c6be..6c8ccdfb0 100644 --- a/src/task.c +++ b/src/task.c @@ -138,7 +138,7 @@ void TaskDummy(u8 taskId) void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc) { - u8 taskNum = NUM_TASKS - 2; // Should be const + u8 taskNum = NUM_TASK_DATA - 2; // Should be const gTasks[taskId].data[taskNum] = (s16)((u32)followupFunc); gTasks[taskId].data[taskNum + 1] = (s16)((u32)followupFunc >> 16); @@ -147,7 +147,7 @@ void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc void SwitchTaskToFollowupFunc(u8 taskId) { - u8 taskNum = NUM_TASKS - 2; // Should be const + u8 taskNum = NUM_TASK_DATA - 2; // Should be const gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[taskNum]) | (gTasks[taskId].data[taskNum + 1] << 16)); } @@ -188,7 +188,7 @@ u8 GetTaskCount(void) void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value) { - if (dataElem < NUM_TASKS - 1) + if (dataElem < NUM_TASK_DATA - 1) { gTasks[taskId].data[dataElem] = value; gTasks[taskId].data[dataElem + 1] = value >> 16; @@ -197,7 +197,7 @@ void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value) u32 GetWordTaskArg(u8 taskId, u8 dataElem) { - if (dataElem < NUM_TASKS - 1) + if (dataElem < NUM_TASK_DATA - 1) return (u16)gTasks[taskId].data[dataElem] | (gTasks[taskId].data[dataElem + 1] << 16); else return 0; -- cgit v1.2.3 From e7436ab4c86ebf4ba7266dbfc88a49a29d1caa2c Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sat, 16 Jan 2021 21:35:40 -0500 Subject: Update task.c --- src/task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index 6c8ccdfb0..512e838b7 100644 --- a/src/task.c +++ b/src/task.c @@ -171,7 +171,7 @@ u8 FindTaskIdByFunc(TaskFunc func) if (gTasks[i].isActive == TRUE && gTasks[i].func == func) return (u8)i; - return TAIL_SENTINEL; // No task found + return 0xFF; // No task found } u8 GetTaskCount(void) -- cgit v1.2.3 From 72e8683975c870707cd45312e727c4b56fa1a939 Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sat, 16 Jan 2021 21:50:59 -0500 Subject: FIxed the comments --- src/task.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index 512e838b7..1736d9abe 100644 --- a/src/task.c +++ b/src/task.c @@ -138,7 +138,7 @@ void TaskDummy(u8 taskId) void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc) { - u8 taskNum = NUM_TASK_DATA - 2; // Should be const + u8 taskNum = NUM_TASK_DATA - 2; // Should be const. gTasks[taskId].data[taskNum] = (s16)((u32)followupFunc); gTasks[taskId].data[taskNum + 1] = (s16)((u32)followupFunc >> 16); @@ -147,7 +147,7 @@ void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc void SwitchTaskToFollowupFunc(u8 taskId) { - u8 taskNum = NUM_TASK_DATA - 2; // Should be const + u8 taskNum = NUM_TASK_DATA - 2; // Should be const. gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[taskNum]) | (gTasks[taskId].data[taskNum + 1] << 16)); } @@ -171,7 +171,7 @@ u8 FindTaskIdByFunc(TaskFunc func) if (gTasks[i].isActive == TRUE && gTasks[i].func == func) return (u8)i; - return 0xFF; // No task found + return TAIL_SENTINEL; // No task found. } u8 GetTaskCount(void) -- cgit v1.2.3 From d3259ebe2c7ae2f4d24ec7521b85f6b31aa64e79 Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sat, 16 Jan 2021 21:56:49 -0500 Subject: renamed taskNum to followupFuncDataIndex --- src/task.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index 1736d9abe..402defbeb 100644 --- a/src/task.c +++ b/src/task.c @@ -138,18 +138,18 @@ void TaskDummy(u8 taskId) void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc) { - u8 taskNum = NUM_TASK_DATA - 2; // Should be const. + u8 followupFuncDataIndex = NUM_TASK_DATA - 2; // Should be const. - gTasks[taskId].data[taskNum] = (s16)((u32)followupFunc); - gTasks[taskId].data[taskNum + 1] = (s16)((u32)followupFunc >> 16); + gTasks[taskId].data[followupFuncDataIndex] = (s16)((u32)followupFunc); + gTasks[taskId].data[followupFuncDataIndex + 1] = (s16)((u32)followupFunc >> 16); gTasks[taskId].func = func; } void SwitchTaskToFollowupFunc(u8 taskId) { - u8 taskNum = NUM_TASK_DATA - 2; // Should be const. + u8 followupFuncDataIndex = NUM_TASK_DATA - 2; // Should be const. - gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[taskNum]) | (gTasks[taskId].data[taskNum + 1] << 16)); + gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[followupFuncDataIndex]) | (gTasks[taskId].data[followupFuncDataIndex + 1] << 16)); } bool8 FuncIsActiveTask(TaskFunc func) -- cgit v1.2.3 From 3b80f3caf1567659830b8685f550dc4ed27da893 Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sun, 17 Jan 2021 12:44:08 -0500 Subject: Make variable name shorter --- src/task.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index 402defbeb..20ce56c38 100644 --- a/src/task.c +++ b/src/task.c @@ -138,18 +138,18 @@ void TaskDummy(u8 taskId) void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc) { - u8 followupFuncDataIndex = NUM_TASK_DATA - 2; // Should be const. + u8 followupFuncIndex = NUM_TASK_DATA - 2; // Should be const. - gTasks[taskId].data[followupFuncDataIndex] = (s16)((u32)followupFunc); - gTasks[taskId].data[followupFuncDataIndex + 1] = (s16)((u32)followupFunc >> 16); + gTasks[taskId].data[followupFuncIndex] = (s16)((u32)followupFunc); + gTasks[taskId].data[followupFuncIndex + 1] = (s16)((u32)followupFunc >> 16); gTasks[taskId].func = func; } void SwitchTaskToFollowupFunc(u8 taskId) { - u8 followupFuncDataIndex = NUM_TASK_DATA - 2; // Should be const. + u8 followupFuncIndex = NUM_TASK_DATA - 2; // Should be const. - gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[followupFuncDataIndex]) | (gTasks[taskId].data[followupFuncDataIndex + 1] << 16)); + gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[followupFuncIndex]) | (gTasks[taskId].data[followupFuncIndex + 1] << 16)); } bool8 FuncIsActiveTask(TaskFunc func) -- cgit v1.2.3 From ad6ab09e30a9c0d8efdf83608966e125046d2dcd Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sun, 17 Jan 2021 12:46:08 -0500 Subject: Update comment --- src/task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index 20ce56c38..f3b696545 100644 --- a/src/task.c +++ b/src/task.c @@ -171,7 +171,7 @@ u8 FindTaskIdByFunc(TaskFunc func) if (gTasks[i].isActive == TRUE && gTasks[i].func == func) return (u8)i; - return TAIL_SENTINEL; // No task found. + return TAIL_SENTINEL; // No task was found. } u8 GetTaskCount(void) -- cgit v1.2.3 From 82970902679a7d14f7d252fc16e51a789eaf64ae Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sun, 17 Jan 2021 12:49:50 -0500 Subject: Update task.c --- src/task.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index f3b696545..e2e905719 100644 --- a/src/task.c +++ b/src/task.c @@ -141,7 +141,7 @@ void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc u8 followupFuncIndex = NUM_TASK_DATA - 2; // Should be const. gTasks[taskId].data[followupFuncIndex] = (s16)((u32)followupFunc); - gTasks[taskId].data[followupFuncIndex + 1] = (s16)((u32)followupFunc >> 16); + gTasks[taskId].data[followupFuncIndex + 1] = (s16)((u32)followupFunc >> 16); // So we can store the followupFunc in two adjacent indexes. gTasks[taskId].func = func; } @@ -198,7 +198,7 @@ void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value) u32 GetWordTaskArg(u8 taskId, u8 dataElem) { if (dataElem < NUM_TASK_DATA - 1) - return (u16)gTasks[taskId].data[dataElem] | (gTasks[taskId].data[dataElem + 1] << 16); + return (u16)gTasks[taskId].data[dataElem] | (gTasks[taskId].data[dataElem + 1] << 16); // Merge the two adjacent indexes back else return 0; } -- cgit v1.2.3 From 7134763b73f3be671f0688750dbef155bdea5eb8 Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Sun, 17 Jan 2021 13:00:53 -0500 Subject: Update task.c --- src/task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index e2e905719..17dac4b18 100644 --- a/src/task.c +++ b/src/task.c @@ -198,7 +198,7 @@ void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value) u32 GetWordTaskArg(u8 taskId, u8 dataElem) { if (dataElem < NUM_TASK_DATA - 1) - return (u16)gTasks[taskId].data[dataElem] | (gTasks[taskId].data[dataElem + 1] << 16); // Merge the two adjacent indexes back + return (u16)gTasks[taskId].data[dataElem] | (gTasks[taskId].data[dataElem + 1] << 16); else return 0; } -- cgit v1.2.3 From b6c483394e11a27e9146a62cfd79a19c7260fe61 Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Tue, 19 Jan 2021 13:43:57 -0500 Subject: Clarified comments Made comments clearer. --- src/task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index 17dac4b18..7787dc786 100644 --- a/src/task.c +++ b/src/task.c @@ -141,7 +141,7 @@ void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc u8 followupFuncIndex = NUM_TASK_DATA - 2; // Should be const. gTasks[taskId].data[followupFuncIndex] = (s16)((u32)followupFunc); - gTasks[taskId].data[followupFuncIndex + 1] = (s16)((u32)followupFunc >> 16); // So we can store the followupFunc in two adjacent indexes. + gTasks[taskId].data[followupFuncIndex + 1] = (s16)((u32)followupFunc >> 16); // So we can store followupFunc as two half-words in the data array. gTasks[taskId].func = func; } -- cgit v1.2.3 From d720520de8cce7acdf2b0abf7d21c5ca94c7f921 Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Tue, 19 Jan 2021 13:47:09 -0500 Subject: Clarified comment again --- src/task.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index 7787dc786..be7eb8bc0 100644 --- a/src/task.c +++ b/src/task.c @@ -35,7 +35,7 @@ u8 CreateTask(TaskFunc func, u8 priority) gTasks[i].func = func; gTasks[i].priority = priority; InsertTask(i); - memset(gTasks[i].data, 0, sizeof(gTasks[i].data)); + gTasks[i].data = { 0 }; gTasks[i].isActive = TRUE; return i; } @@ -141,7 +141,7 @@ void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc u8 followupFuncIndex = NUM_TASK_DATA - 2; // Should be const. gTasks[taskId].data[followupFuncIndex] = (s16)((u32)followupFunc); - gTasks[taskId].data[followupFuncIndex + 1] = (s16)((u32)followupFunc >> 16); // So we can store followupFunc as two half-words in the data array. + gTasks[taskId].data[followupFuncIndex + 1] = (s16)((u32)followupFunc >> 16); // Store followupFunc as two half-words in the data array. gTasks[taskId].func = func; } -- cgit v1.2.3 From e5e390d64bbb99d73f067a335eccdc12ce4bced0 Mon Sep 17 00:00:00 2001 From: N <71219152+PokeCodec@users.noreply.github.com> Date: Tue, 19 Jan 2021 14:33:11 -0500 Subject: Revert zero initialization --- src/task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index be7eb8bc0..3a3ddadfd 100644 --- a/src/task.c +++ b/src/task.c @@ -35,7 +35,7 @@ u8 CreateTask(TaskFunc func, u8 priority) gTasks[i].func = func; gTasks[i].priority = priority; InsertTask(i); - gTasks[i].data = { 0 }; + memset(gTasks[i].data, 0, sizeof(gTasks[i].data)); gTasks[i].isActive = TRUE; return i; } -- cgit v1.2.3 From a5852d57d124c49fd1b80510e968c18404a436a3 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 19 Feb 2021 23:22:26 -0500 Subject: Use TASK_NONE constant --- src/task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/task.c') diff --git a/src/task.c b/src/task.c index 3a3ddadfd..68fb679b3 100644 --- a/src/task.c +++ b/src/task.c @@ -171,7 +171,7 @@ u8 FindTaskIdByFunc(TaskFunc func) if (gTasks[i].isActive == TRUE && gTasks[i].func == func) return (u8)i; - return TAIL_SENTINEL; // No task was found. + return TASK_NONE; // No task was found. } u8 GetTaskCount(void) -- cgit v1.2.3