Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-05 23:45:42 +0300
committerJunio C Hamano <gitster@pobox.com>2015-03-05 23:45:42 +0300
commit8a6444d50ea73350ae7e6083ecc63393749e5bb0 (patch)
tree949f413a7105dc06326fc3fc5108ebff92397f57 /builtin/for-each-ref.c
parentca704731b1fdf77b8f6d296bcde206c67ed9d73a (diff)
parent2ce63e9fac242a70cd6d9e1325063bbb2e5091f8 (diff)
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/for-each-ref.c')
-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 19be78a943d..83f9cf91633 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;
}