git-diff-tree: simplify header output with '-z'

No need to make them multiple lines, in fact we explicitly don't want that.

This also fixes a 64-bit problem pointed out by Markus F.X.J. Oberhumer,
where we gave "%.*s" a "ptrdiff_t" length argument instead of an "int".
This commit is contained in:
Linus Torvalds 2005-05-27 10:22:09 -07:00
parent a9c9cef161
commit 84c1afd7e7

View File

@ -269,18 +269,11 @@ static int call_diff_flush(void)
return 0; return 0;
} }
if (header) { if (header) {
if (diff_output_format == DIFF_FORMAT_MACHINE) { const char *fmt = "%s";
const char *ep, *cp; if (diff_output_format == DIFF_FORMAT_MACHINE)
for (cp = header; *cp; cp = ep) { fmt = "%s%c";
ep = strchr(cp, '\n');
if (ep == 0) ep = cp + strlen(cp); printf(fmt, header, 0);
printf("%.*s%c", ep-cp, cp, 0);
if (*ep) ep++;
}
}
else {
printf("%s", header);
}
header = NULL; header = NULL;
} }
diff_flush(diff_output_format, 1); diff_flush(diff_output_format, 1);