diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-03-05 12:45:42 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-05 12:45:42 -0800 |
commit | 8a6444d50ea73350ae7e6083ecc63393749e5bb0 (patch) | |
tree | 949f413a7105dc06326fc3fc5108ebff92397f57 /builtin | |
parent | Merge branch 'rj/no-xopen-source-for-cygwin' (diff) | |
parent | sha1_name: use strlcpy() to copy strings (diff) | |
download | tgif-8a6444d50ea73350ae7e6083ecc63393749e5bb0.tar.xz |
Merge branch 'rs/simple-cleanups'
Code cleanups.
* rs/simple-cleanups:
sha1_name: use strlcpy() to copy strings
pretty: use starts_with() to check for a prefix
for-each-ref: use skip_prefix() to avoid duplicate string comparison
connect: use strcmp() for string comparison
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/for-each-ref.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 19be78a943..83f9cf9163 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -178,11 +178,10 @@ static const char *find_next(const char *cp) static int verify_format(const char *format) { const char *cp, *sp; - static const char color_reset[] = "color:reset"; need_color_reset_at_eol = 0; for (cp = format; *cp && (sp = find_next(cp)); ) { - const char *ep = strchr(sp, ')'); + const char *color, *ep = strchr(sp, ')'); int at; if (!ep) @@ -191,8 +190,8 @@ static int verify_format(const char *format) at = parse_atom(sp + 2, ep); cp = ep + 1; - if (starts_with(used_atom[at], "color:")) - need_color_reset_at_eol = !!strcmp(used_atom[at], color_reset); + if (skip_prefix(used_atom[at], "color:", &color)) + need_color_reset_at_eol = !!strcmp(color, "reset"); } return 0; } |