Re: [PATCH 27/31] builtin/difftool: use parse_oid_hex

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

 



On Mon, Feb 11, 2019 at 8:24 PM brian m. carlson
<sandals@xxxxxxxxxxxxxxxxxxxx> wrote:
> Instead of using get_oid_hex and adding constants to the result, use
> parse_oid_hex to make this code independent of the hash size.
>
> Signed-off-by: brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx>
> ---
> diff --git a/builtin/difftool.c b/builtin/difftool.c
> @@ -65,14 +65,12 @@ static int parse_index_info(char *p, int *mode1, int *mode2,
>         if (*p != ' ')
>                 return error("expected ' ', got '%c'", *p);
> -       if (get_oid_hex(++p, oid1))
> +       if (parse_oid_hex(++p, oid1, (const char **)&p))
>                 return error("expected object ID, got '%s'", p + 1);

Not a problem introduced by this patch, but is the 'p + 1' in the
error message correct? 'p' has already been incremented via '++p' in
the call to parse_oid_hex() to point at what _should_ be the start of
OID, so one would think that the error message would want to print out
whatever was found there rather than what was found one character
after the start of OID.

> -       if (get_oid_hex(++p, oid2))
> +       if (parse_oid_hex(++p, oid2, (const char **)&p))
>                 return error("expected object ID, got '%s'", p + 1);

Ditto.



[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]

  Powered by Linux