提交 7c5b1675 编写于 作者: R René Scharfe 提交者: Junio C Hamano

git-name-rev: don't use printf without format

printf() without an explicit format string is not a good coding practise,
unless the printed string is guaranteed to not contain percent signs.  While
fixing this, we might as well combine the calls to fwrite() and printf().
Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b003c00b
......@@ -189,6 +189,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)
unsigned char sha1[40];
const char *name = NULL;
char c = *(p+1);
int p_len = p - p_start + 1;
forty = 0;
......@@ -204,13 +205,10 @@ static void name_rev_line(char *p, struct name_ref_data *data)
if (!name)
continue;
if (data->name_only) {
fwrite(p_start, p - p_start + 1 - 40, 1, stdout);
printf(name);
} else {
fwrite(p_start, p - p_start + 1, 1, stdout);
printf(" (%s)", name);
}
if (data->name_only)
printf("%.*s%s", p_len - 40, p_start, name);
else
printf("%.*s (%s)", p_len, p_start, name);
p_start = p + 1;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册