Vasco Almeida <vascomalme...@sapo.pt> writes:

> +
> +     switch (cf->origin_type) {
> +     case CONFIG_ORIGIN_BLOB:
> +             error_msg = xstrfmt(_("bad config line %d in blob %s"),
> +                                   cf->linenr, cf->name);
> +             break;
> +     case CONFIG_ORIGIN_FILE:
> +             error_msg = xstrfmt(_("bad config line %d in file %s"),
> +                                   cf->linenr, cf->name);
> +             break;

Hmm, if we were to switch the message based on the origin type, then
things like this:

> +     case CONFIG_ORIGIN_STDIN:
> +             error_msg = xstrfmt(_("bad config line %d in standard input 
> %s"),
> +                                   cf->linenr, cf->name);
> +             break;

and this:

> +     case CONFIG_ORIGIN_STDIN:
> +             die(errno == ERANGE
> +                 ? _("bad numeric config value '%s' for '%s' in standard 
> input %s: out of range")
> +                 : _("bad numeric config value '%s' for '%s' in standard 
> input %s: invalid unit"),
> +                 value, name, cf->name);

that does not have any useful cf->name can be improved even more, no?

The only reason why we pass an empty string here:

>  static int git_config_from_stdin(config_fn_t fn, void *data)
>  {
> -     return do_config_from_file(fn, "standard input", "", NULL, stdin, data);
> +     return do_config_from_file(fn, CONFIG_ORIGIN_STDIN, "", NULL, stdin, 
> data);
>  }

is because do_config_from_file() function whose primary purpose is
to read from file was reused, the interface to that function
requires the filename there for reporting, and we do not have
anything useful when reading from the standard input.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to