summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-06 14:57:57 -0800
committerJunio C Hamano <gitster@pobox.com>2015-03-06 14:57:57 -0800
commitf56a5f4fed296647ae8978645f9c627410717398 (patch)
tree693afac09ae1fd40b7ab39ae8b8122cde6050b7f /builtin
parentd86679fa061e22e33596814630513b6a7b4d4767 (diff)
parent2ce63e9fac242a70cd6d9e1325063bbb2e5091f8 (diff)
downloadgit-f56a5f4fed296647ae8978645f9c627410717398.tar.gz
Merge branch 'rs/simple-cleanups' into maint
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.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index a0123f6146..008513c2f1 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;
}