X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=parse-options.c;h=71a7acf4e22bd12c0919f277410d6ec52dd5efc8;hb=65ac5530abcc3699ebc27126d8389f35baa8cafe;hp=ae88885d4da573c85dbfbeea3061f3b026223710;hpb=abce32b5ba5cf91c85b032d2dbb2702679a5608e;p=git.git diff --git a/parse-options.c b/parse-options.c index ae88885d4..71a7acf4e 100644 --- a/parse-options.c +++ b/parse-options.c @@ -5,12 +5,6 @@ #define OPT_SHORT 1 #define OPT_UNSET 2 -static inline const char *skip_prefix(const char *str, const char *prefix) -{ - size_t len = strlen(prefix); - return strncmp(str, prefix, len) ? NULL : str + len; -} - static int opterror(const struct option *opt, const char *reason, int flags) { if (flags & OPT_SHORT) @@ -28,7 +22,7 @@ static int get_arg(struct parse_opt_ctx_t *p, const struct option *opt, p->opt = NULL; } else if (p->argc == 1 && (opt->flags & PARSE_OPT_LASTARG_DEFAULT)) { *arg = (const char *)opt->defval; - } else if (p->argc) { + } else if (p->argc > 1) { p->argc--; *arg = *++p->argv; } else @@ -220,7 +214,7 @@ is_abbreviated: return -2; } -void check_typos(const char *arg, const struct option *options) +static void check_typos(const char *arg, const struct option *options) { if (strlen(arg) < 3) return;