Re: [PATCH 65/83] builtin/apply: make gitdiff_verify_name() return -1 on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 24, 2016 at 8:34 PM, Christian Couder
<christian.couder@xxxxxxxxx> wrote:
> Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
> ---
>  builtin/apply.c | 52 ++++++++++++++++++++++++++++++----------------------
>  1 file changed, 30 insertions(+), 22 deletions(-)
>
> diff --git a/builtin/apply.c b/builtin/apply.c
> index 6b8ba2a..268356b 100644
> --- a/builtin/apply.c
> +++ b/builtin/apply.c
> @@ -812,7 +812,7 @@ static int gitdiff_hdrend(struct apply_state *state,
>                           const char *line,
>                           struct patch *patch)
>  {
> -       return -1;
> +       return 1;
>  }

These are in a function group that will be called as p->fn() in
parse_git_header(). Is it possible to isolate them in a separate
patch? This patch can follow after, which covers only
gitdiff_verify_name() returning -1 and its call sites.

>  static int gitdiff_oldmode(struct apply_state *state,
> @@ -1016,7 +1018,7 @@ static int gitdiff_unrecognized(struct apply_state *state,
>                                 const char *line,
>                                 struct patch *patch)
>  {
> -       return -1;
> +       return 1;
>  }
>
>  /*
> @@ -1248,9 +1250,13 @@ static int parse_git_header(struct apply_state *state,
>                 for (i = 0; i < ARRAY_SIZE(optable); i++) {
>                         const struct opentry *p = optable + i;
>                         int oplen = strlen(p->str);
> +                       int res;
>                         if (len < oplen || memcmp(p->str, line, oplen))
>                                 continue;
> -                       if (p->fn(state, line + oplen, patch) < 0)
> +                       res = p->fn(state, line + oplen, patch);
> +                       if (res < 0)
> +                               return -1;
> +                       if (res > 0)
>                                 return offset;
>                         break;
>                 }
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]