Vasco Almeida <vascomalmeida@xxxxxxx> writes: > Às 17:43 de 01-06-2016, Junio C Hamano escreveu: >> Vasco Almeida <vascomalmeida@xxxxxxx> writes: >> >>> Introduced in 473166b ("config: add 'origin_type' to config_source >>> struct", 2016-02-19), Git can inform the user about the origin of a >>> config error, but the implementation does not allow translators to >>> translate the keywords 'file', 'blob, 'standard input', and >>> 'submodule-blob'. Moreover, for the second message, a reason for the >>> error is appended to the message, not allowing translators to translate >>> that reason either. >> >> Good intentions. >> >>> @@ -417,6 +417,7 @@ static int git_parse_source(config_fn_t fn, void *data) >>> int comment = 0; >>> int baselen = 0; >>> struct strbuf *var = &cf->var; >>> + char error_msg[128]; >>> >>> /* U+FEFF Byte Order Mark in UTF8 */ >>> const char *bomptr = utf8_bom; >>> @@ -471,10 +472,38 @@ static int git_parse_source(config_fn_t fn, void *data) >>> if (get_value(fn, data, var) < 0) >>> break; >>> } >>> + >>> + switch (cf->origin_type) { >>> + case CFG_BLOB: >>> + xsnprintf(error_msg, sizeof(error_msg), >>> + _("bad config line %d in blob %s"), >>> + cf->linenr, cf->name); >> >> Use xstrfmt() intead, perhaps? That would be cleaner. >> > Wouldn't that create a memory leak? Yes, I didn't mean to suggest "use xstrfmt() instead of xsnprintf() without changing anything else". It was merely to suggest that you do not have to have 128-byte limit if you used xstrfmt(); having to free the result was too obvious that I left it unsaid, and as expected, you noticed the need to do so, which is good ;-) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html