Small code readability improvement in show_reference() in builtin-tag.c
Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Mike Hommey committed
Nov 3, 2007 at 14:08 UTC
e1f14cce694602ca879bea03d143add1c18dff52
1 file changed
+6
-7
builtin-tag.c
+6
-7
@@ -81,17 +81,16 @@ static int show_reference(const char *refname, const unsigned char *sha1,
81
}
82
printf("%-15s ", refname);
83
84
- sp = buf = read_sha1_file(sha1, &type, &size);
85
- if (!buf)
84
+ buf = read_sha1_file(sha1, &type, &size);
85
+ if (!buf || !size)
86
return 0;
87
- if (!size) {
87
+
88
+ /* skip header */
89
+ sp = strstr(buf, "\n\n");
90
+ if (!sp) {
91
free(buf);
92
return 0;
93
}
91
- /* skip header */
92
- while (sp + 1 < buf + size &&
93
- !(sp[0] == '\n' && sp[1] == '\n'))
94
- sp++;
94
/* only take up to "lines" lines, and strip the signature */
95
for (i = 0, sp += 2;
96
i < filter->lines && sp < buf + size &&