aboutsummaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-06-18 15:41:50 -0400
committerJunio C Hamano <gitster@pobox.com>2014-06-18 14:56:17 -0700
commit9e1a5ebe52d84c35eee18a896ad1b8bab53cadbf (patch)
treede07f8aa40074aa8235a564e063e4d0b79c94fcb /diff.c
parentcb682f8cfe63ecd0da08a526f404d295e51e3ab1 (diff)
downloadgit-9e1a5ebe52d84c35eee18a896ad1b8bab53cadbf.tar.gz
git-9e1a5ebe52d84c35eee18a896ad1b8bab53cadbf.tar.xz
parse_diff_color_slot: drop ofs parameter
This function originally took a whole config variable name ("var") and an offset ("ofs"). It checked "var+ofs" against each color slot, but reported errors using the whole "var". However, since 8b8e862 (ignore unknown color configuration, 2009-12-12), it returns -1 rather than printing its own error, and therefore only cares about var+ofs. We can drop the ofs parameter and teach its sole caller to derive the pointer itself. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/diff.c b/diff.c
index bba9a558a..77c5eb452 100644
--- a/diff.c
+++ b/diff.c
@@ -52,23 +52,23 @@ static char diff_colors[][COLOR_MAXLEN] = {
GIT_COLOR_NORMAL, /* FUNCINFO */
};
-static int parse_diff_color_slot(const char *var, int ofs)
+static int parse_diff_color_slot(const char *var)
{
- if (!strcasecmp(var+ofs, "plain"))
+ if (!strcasecmp(var, "plain"))
return DIFF_PLAIN;
- if (!strcasecmp(var+ofs, "meta"))
+ if (!strcasecmp(var, "meta"))
return DIFF_METAINFO;
- if (!strcasecmp(var+ofs, "frag"))
+ if (!strcasecmp(var, "frag"))
return DIFF_FRAGINFO;
- if (!strcasecmp(var+ofs, "old"))
+ if (!strcasecmp(var, "old"))
return DIFF_FILE_OLD;
- if (!strcasecmp(var+ofs, "new"))
+ if (!strcasecmp(var, "new"))
return DIFF_FILE_NEW;
- if (!strcasecmp(var+ofs, "commit"))
+ if (!strcasecmp(var, "commit"))
return DIFF_COMMIT;
- if (!strcasecmp(var+ofs, "whitespace"))
+ if (!strcasecmp(var, "whitespace"))
return DIFF_WHITESPACE;
- if (!strcasecmp(var+ofs, "func"))
+ if (!strcasecmp(var, "func"))
return DIFF_FUNCINFO;
return -1;
}
@@ -240,7 +240,7 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
return -1;
if (starts_with(var, "diff.color.") || starts_with(var, "color.diff.")) {
- int slot = parse_diff_color_slot(var, 11);
+ int slot = parse_diff_color_slot(var + 11);
if (slot < 0)
return 0;
if (!value)