Re: [PATCH 2/2] Small code readability improvement in show_reference() in builtin-tag.c
- From
Mike Hommey <mh@glandium.org>
- Date
- Nov 7, 2007, 21:51 UTC
- Message-ID
- <20071107215121.GA30248@glandium.org>
- In-Reply-To
- <1194095285-18651-2-git-send-email-mh@glandium.org>
I think this patch got lost with my bad behaviour of sending another series of patch not including this one.
Cheers,
Mike
On Sat, Nov 03, 2007 at 02:08:05PM +0100, Mike Hommey wrote:
Show 36 quoted lines
>
> Signed-off-by: Mike Hommey <mh@glandium.org>
> ---
> builtin-tag.c | 9 ++++-----
> 1 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/builtin-tag.c b/builtin-tag.c
> index e57f57f..3ed5759 100644
> --- a/builtin-tag.c
> +++ b/builtin-tag.c
> @@ -84,14 +84,13 @@ static int show_reference(const char *refname, const unsigned char *sha1,
> sp = buf = read_sha1_file(sha1, &type, &size);
> if (!buf)
> return 0;
> - if (!size) {
> + /* skip header */
> + sp = strstr(buf, "\n\n");
> +
> + if (!sp || !size) {
> free(buf);
> return 0;
> }
> - /* skip header */
> - while (sp + 1 < buf + size &&
> - !(sp[0] == '\n' && sp[1] == '\n'))
> - sp++;
> /* only take up to "lines" lines, and strip the signature */
> for (i = 0, sp += 2;
> i < filter->lines && sp < buf + size &&
> --
> 1.5.3.5
>
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html