summaryrefslogtreecommitdiff
path: root/builtin/clean.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2014-10-04 20:54:50 +0200
committerJunio C Hamano <gitster@pobox.com>2014-10-07 11:09:16 -0700
commite3f1da982e4f14e7146964cb25a5011a3f41e84a (patch)
tree0b225c25e7b86a7a49b58f4fa4af500c5c36b40a /builtin/clean.c
parent565301e41670825ceedf75220f2918ae76831240 (diff)
downloadgit-e3f1da982e4f14e7146964cb25a5011a3f41e84a.tar.gz
use skip_prefix() to avoid more magic numbersrs/more-uses-of-skip-prefix
Continue where ae021d87 (use skip_prefix to avoid magic numbers) left off and use skip_prefix() in more places for determining the lengths of prefix strings to avoid using dependent constants and other indirect methods. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/clean.c')
-rw-r--r--builtin/clean.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/clean.c b/builtin/clean.c
index 3beeea6ec0..c35505ee6b 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -100,6 +100,8 @@ static int parse_clean_color_slot(const char *var)
static int git_clean_config(const char *var, const char *value, void *cb)
{
+ const char *slot_name;
+
if (starts_with(var, "column."))
return git_column_config(var, value, "clean", &colopts);
@@ -109,9 +111,8 @@ static int git_clean_config(const char *var, const char *value, void *cb)
clean_use_color = git_config_colorbool(var, value);
return 0;
}
- if (starts_with(var, "color.interactive.")) {
- int slot = parse_clean_color_slot(var +
- strlen("color.interactive."));
+ if (skip_prefix(var, "color.interactive.", &slot_name)) {
+ int slot = parse_clean_color_slot(slot_name);
if (slot < 0)
return 0;
if (!value)