On Mon, Jan 8, 2024 at 3:31 AM Steven Rostedt <rost...@goodmis.org> wrote:
>
> From: "Steven Rostedt (Google)" <rost...@goodmis.org>
>
> The parse_actions() function uses 'len = str_has_prefix()' to test which
> action is in the string being parsed. But then it goes and repeats the
> logic for each different action. This logic can be simplified and
> duplicate code can be removed as 'len' contains the length of the found
> prefix which should be used for all actions.

> Link: https://lore.kernel.org/all/20240107112044.6702c...@gandalf.local.home/
>
> Signed-off-by: Steven Rostedt (Google) <rost...@goodmis.org>

If you want Link to be formally a tag, you should drop the following
blank line.


> +               if ((len = str_has_prefix(str, "onmatch(")))
> +                       hid = HANDLER_ONMATCH;
> +               else if ((len = str_has_prefix(str, "onmax(")))
> +                       hid = HANDLER_ONMAX;
> +               else if ((len = str_has_prefix(str, "onchange(")))
> +                       hid = HANDLER_ONCHANGE;

The repeating check for ( might be moved out as well after this like

  if (str[len] != '(') {
    // not sure if you need data to be assigned here as well
    ret = -EINVAL;
    ...
  }

-- 
With Best Regards,
Andy Shevchenko

Reply via email to