config: use error() instead of fprintf(stderr, ...)

The die() / error() / warning() helpers put a fatal: / error: / warning: prefix in front of the error message they print describing the message's severity, which users are likely to be accustomed to seeing these days. This change will also be useful when marking the message for translation: the argument to error() includes no newline at the end, so it is less fussy for translators to translate without lines running together in the translated output. While we're here, start the error messages with a lowercase letter to match the usual typography of error messages. A quick web search and a code search at codesearch.debian.net finds no scripts trying to parse these error messages, so this change should be safe. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed May 4, 2015 at 14:18 UTC 95d621217a386b821d606168f986c89254584a87
1 file changed +2 -2
builtin/config.c
+2 -2
@@ -193,7 +193,7 @@ static int get_value(const char *key_, const char *regex_)
193
194 key_regexp = (regex_t*)xmalloc(sizeof(regex_t));
195 if (regcomp(key_regexp, key, REG_EXTENDED)) {
196 - fprintf(stderr, "Invalid key pattern: %s\n", key_);
196 + error("invalid key pattern: %s", key_);
197 free(key_regexp);
198 key_regexp = NULL;
199 ret = CONFIG_INVALID_PATTERN;
@@ -214,7 +214,7 @@ static int get_value(const char *key_, const char *regex_)
214
215 regexp = (regex_t*)xmalloc(sizeof(regex_t));
216 if (regcomp(regexp, regex_, REG_EXTENDED)) {
217 - fprintf(stderr, "Invalid pattern: %s\n", regex_);
217 + error("invalid pattern: %s", regex_);
218 free(regexp);
219 regexp = NULL;
220 ret = CONFIG_INVALID_PATTERN;