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

Function build_cmdmode_list

parse-options.c:348–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346};
347
348static void build_cmdmode_list(struct parse_opt_ctx_t *ctx,
349 const struct option *opts)
350{
351 ctx->cmdmode_list = NULL;
352
353 for (; opts->type != OPTION_END; opts++) {
354 struct parse_opt_cmdmode_list *elem = ctx->cmdmode_list;
355 void *value_ptr = opts->value;
356
357 if (!(opts->flags & PARSE_OPT_CMDMODE) || !value_ptr)
358 continue;
359
360 while (elem && elem->value_ptr != value_ptr)
361 elem = elem->next;
362 if (elem)
363 continue;
364
365 CALLOC_ARRAY(elem, 1);
366 elem->value_ptr = value_ptr;
367 elem->precision = opts->precision;
368 if (do_get_int_value(value_ptr, opts->precision, &elem->value))
369 optbug(opts, "has invalid precision");
370 elem->next = ctx->cmdmode_list;
371 ctx->cmdmode_list = elem;
372 }
373 BUG_if_bug("invalid 'struct option'");
374}
375
376static char *optnamearg(const struct option *opt, const char *arg,
377 enum opt_parsed flags)

Callers 1

parse_options_start_1Function · 0.85

Calls 2

do_get_int_valueFunction · 0.85
optbugFunction · 0.85

Tested by

no test coverage detected