summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-01-18 11:20:08 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-01-18 11:20:08 -0800
commit3ab4c543e30c2c57dd79ea1cb15cb3a6f18cc614 (patch)
tree21d8881b4064aab8ea57f3c401da3ead44e3cb2a /pretty.c
parentMerge branch 'ds/completion-silence-in-tree-path-probe' (diff)
parentpretty: use prefixcmp instead of memcmp on NUL-terminated strings (diff)
downloadtgif-3ab4c543e30c2c57dd79ea1cb15cb3a6f18cc614.tar.xz
Merge branch 'rs/pretty-use-prefixcmp'
* rs/pretty-use-prefixcmp: pretty: use prefixcmp instead of memcmp on NUL-terminated strings
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pretty.c b/pretty.c
index 92c839fe64..01795de687 100644
--- a/pretty.c
+++ b/pretty.c
@@ -966,7 +966,7 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
if (!end)
return 0;
- if (!memcmp(begin, "auto,", 5)) {
+ if (!prefixcmp(begin, "auto,")) {
if (!want_color(c->pretty_ctx->color))
return end - placeholder + 1;
begin += 5;
@@ -1301,7 +1301,7 @@ static void pp_header(const struct pretty_print_context *pp,
continue;
}
- if (!memcmp(line, "parent ", 7)) {
+ if (!prefixcmp(line, "parent ")) {
if (linelen != 48)
die("bad parent line in commit");
continue;
@@ -1325,11 +1325,11 @@ static void pp_header(const struct pretty_print_context *pp,
* FULL shows both authors but not dates.
* FULLER shows both authors and dates.
*/
- if (!memcmp(line, "author ", 7)) {
+ if (!prefixcmp(line, "author ")) {
strbuf_grow(sb, linelen + 80);
pp_user_info(pp, "Author", sb, line + 7, encoding);
}
- if (!memcmp(line, "committer ", 10) &&
+ if (!prefixcmp(line, "committer ") &&
(pp->fmt == CMIT_FMT_FULL || pp->fmt == CMIT_FMT_FULLER)) {
strbuf_grow(sb, linelen + 80);
pp_user_info(pp, "Commit", sb, line + 10, encoding);