Uploaded image for project: 'PBS Pro'
  1. PP-1334

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

    Details

    • Type: Bug
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: None
    • Components: Hooks
    • Labels:
      None
    • Sprint:
    • Story Points:
      1

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bayucan Al Bayucan
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: