MCPcopy Index your code
hub / github.com/git/git / get_value

Function get_value

parse-options.c:385–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
386 const struct option *opt,
387 enum opt_parsed flags)
388{
389 const char *arg = NULL;
390 enum parse_opt_result result = do_get_value(p, opt, flags, &arg);
391 struct parse_opt_cmdmode_list *elem = p->cmdmode_list;
392 char *opt_name, *other_opt_name;
393
394 for (; elem; elem = elem->next) {
395 intmax_t new_value;
396
397 if (do_get_int_value(elem->value_ptr, elem->precision,
398 &new_value))
399 BUG("impossible: invalid precision");
400
401 if (new_value == elem->value)
402 continue;
403
404 if (elem->opt &&
405 (elem->opt->flags | opt->flags) & PARSE_OPT_CMDMODE)
406 break;
407
408 elem->opt = opt;
409 elem->arg = arg;
410 elem->flags = flags;
411 elem->value = new_value;
412 }
413
414 if (result || !elem)
415 return result;
416
417 opt_name = optnamearg(opt, arg, flags);
418 other_opt_name = optnamearg(elem->opt, elem->arg, elem->flags);
419 error(_("options '%s' and '%s' cannot be used together"),
420 opt_name, other_opt_name);
421 free(opt_name);
422 free(other_opt_name);
423 return -1;
424}
425
426static enum parse_opt_result parse_short_opt(struct parse_opt_ctx_t *p,
427 const struct option *options)

Callers 3

parse_short_optFunction · 0.70
parse_long_optFunction · 0.70
parse_nodash_optFunction · 0.70

Calls 4

do_get_valueFunction · 0.85
do_get_int_valueFunction · 0.85
optnameargFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected