Refactor Libutil/hook.c code to eliminate repetitive if-else blocks.

Description

Some things in hook.c that can be refactored:

if (event & HOOK_EVENT_EXECJOB_ABORT) {
if (ev_ct > 0)
strncat(eventstr, ",", sizeof(eventstr) - strlen(eventstr) - 1);
strncat(eventstr, HOOKSTR_EXECJOB_ABORT, sizeof(eventstr) - strlen(eventstr) - 1);
ev_ct++;
}

@minghui-liu
minghui-liu
This if block is repeated many times and can be refactored using a loop.

---------

} else if (strcmp(val, HOOKSTR_EXECJOB_ABORT) == 0) {
if (phook->event & HOOK_EVENT_PROVISION)
goto err;
delete_link(&phook->hi_execjob_abort_hooks);
phook->event |= HOOK_EVENT_EXECJOB_ABORT;
insert_hook_sort_order(HOOK_EVENT_EXECJOB_ABORT,
&svr_execjob_abort_hooks, phook);
@minghui-liu
minghui-liu
This part can also be refactored using a loop. Only provision hook needs to be handled differently.

Acceptance Criteria

None

Status

Assignee

Unassigned

Reporter

Al Bayucan

Severity

None

OS

None

Start Date

None

Pull Request URL

None

Story Points

1

Components

Priority

Low
Configure