pass config slots as pointers instead of offsets
[gitweb.git] / builtin / commit.c
index 5ed60364ce5eb1f458e1f5155d76abd7341d24ea..5a8a29e07534237aee822cdee26f7c7f6a612c02 100644 (file)
@@ -1238,22 +1238,21 @@ static int dry_run_commit(int argc, const char **argv, const char *prefix,
        return commitable ? 0 : 1;
 }
 
-static int parse_status_slot(const char *var, int offset)
+static int parse_status_slot(const char *slot)
 {
-       if (!strcasecmp(var+offset, "header"))
+       if (!strcasecmp(slot, "header"))
                return WT_STATUS_HEADER;
-       if (!strcasecmp(var+offset, "branch"))
+       if (!strcasecmp(slot, "branch"))
                return WT_STATUS_ONBRANCH;
-       if (!strcasecmp(var+offset, "updated")
-               || !strcasecmp(var+offset, "added"))
+       if (!strcasecmp(slot, "updated") || !strcasecmp(slot, "added"))
                return WT_STATUS_UPDATED;
-       if (!strcasecmp(var+offset, "changed"))
+       if (!strcasecmp(slot, "changed"))
                return WT_STATUS_CHANGED;
-       if (!strcasecmp(var+offset, "untracked"))
+       if (!strcasecmp(slot, "untracked"))
                return WT_STATUS_UNTRACKED;
-       if (!strcasecmp(var+offset, "nobranch"))
+       if (!strcasecmp(slot, "nobranch"))
                return WT_STATUS_NOBRANCH;
-       if (!strcasecmp(var+offset, "unmerged"))
+       if (!strcasecmp(slot, "unmerged"))
                return WT_STATUS_UNMERGED;
        return -1;
 }
@@ -1291,7 +1290,7 @@ static int git_status_config(const char *k, const char *v, void *cb)
                return 0;
        }
        if (starts_with(k, "status.color.") || starts_with(k, "color.status.")) {
-               int slot = parse_status_slot(k, 13);
+               int slot = parse_status_slot(k + 13);
                if (slot < 0)
                        return 0;
                if (!v)