cleanup: Consolidate countof macros.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 20m32s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 20m32s
This commit is contained in:
12
src/task.c
12
src/task.c
@ -43,10 +43,6 @@
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_countof)
|
||||
#define _countof(a) ((int)(sizeof((a)) / sizeof(*(a))))
|
||||
#endif
|
||||
|
||||
static JSClassID _import_class_id;
|
||||
static int _count;
|
||||
|
||||
@ -919,7 +915,7 @@ char* tf_task_get_hitches(tf_task_t* task)
|
||||
JSContext* context = task->_context;
|
||||
tf_trace_begin(task->_trace, __func__);
|
||||
JSValue object = JS_NewObject(context);
|
||||
for (int i = 0; i < (int)_countof(task->hitches); i++)
|
||||
for (int i = 0; i < tf_countof(task->hitches); i++)
|
||||
{
|
||||
if (*task->hitches[i].name)
|
||||
{
|
||||
@ -1658,13 +1654,13 @@ static void _tf_task_trace_to_parent(tf_trace_t* trace, const char* buffer, size
|
||||
static void _tf_task_record_hitch(const char* name, uint64_t duration_ns, void* user_data)
|
||||
{
|
||||
tf_task_t* task = user_data;
|
||||
for (int i = 0; i < (int)_countof(task->hitches); i++)
|
||||
for (int i = 0; i < tf_countof(task->hitches); i++)
|
||||
{
|
||||
if (duration_ns > task->hitches[i].duration_ns)
|
||||
{
|
||||
if (i + 1 < (int)_countof(task->hitches))
|
||||
if (i + 1 < tf_countof(task->hitches))
|
||||
{
|
||||
memmove(task->hitches + i + 1, task->hitches + i, sizeof(hitch_t) * ((int)_countof(task->hitches) - i - 1));
|
||||
memmove(task->hitches + i + 1, task->hitches + i, sizeof(hitch_t) * (tf_countof(task->hitches) - i - 1));
|
||||
}
|
||||
snprintf(task->hitches[i].name, sizeof(task->hitches[i].name), "%s", name);
|
||||
task->hitches[i].duration_ns = duration_ns;
|
||||
|
Reference in New Issue
Block a user