On Tue, 2 Oct 2018 at 20:04, Phillip Wood <phillip.w...@talktalk.net> wrote:
>         const struct emitted_diff_symbol *longer =  a->len > b->len ? a : b;
>         const struct emitted_diff_symbol *shorter = a->len > b->len ? b : a;
>         int d = longer->len - shorter->len;
> +       int ret = !strncmp(longer->line + d, shorter->line, shorter->len);
> +
> +       if (!ret)
> +               return ret;
>
>         out->string = xmemdupz(longer->line, d);
>         out->current_longer = (a == longer);
>
> -       return !strncmp(longer->line + d, shorter->line, shorter->len);
> +       return ret;
>  }

The caller only cares about 0 vs non-0, so this would also work:

   if (strncmp(...))
           return 0;

   ...

   return 1;

Just a thought, to avoid some "!"s and the new variable `ret`.

Martin

Reply via email to