From 033abf97fcbc247eabf915780181d947cfb66205 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 2 May 2018 11:38:39 +0200 Subject: Replace all die("BUG: ...") calls by BUG() ones In d8193743e08 (usage.c: add BUG() function, 2017-05-12), a new macro was introduced to use for reporting bugs instead of die(). It was then subsequently used to convert one single caller in 588a538ae55 (setup_git_env: convert die("BUG") to BUG(), 2017-05-12). The cover letter of the patch series containing this patch (cf 20170513032414.mfrwabt4hovujde2@sigill.intra.peff.net) is not terribly clear why only one call site was converted, or what the plan is for other, similar calls to die() to report bugs. Let's just convert all remaining ones in one fell swoop. This trick was performed by this invocation: sed -i 's/die("BUG: /BUG("/g' $(git grep -l 'die("BUG' \*.c) Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- config.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index 62c56099bf..cface6ab8a 100644 --- a/config.c +++ b/config.c @@ -102,7 +102,7 @@ static int config_buf_ungetc(int c, struct config_source *conf) if (conf->u.buf.pos > 0) { conf->u.buf.pos--; if (conf->u.buf.buf[conf->u.buf.pos] != c) - die("BUG: config_buf can only ungetc the same character"); + BUG("config_buf can only ungetc the same character"); return c; } @@ -189,7 +189,7 @@ static int prepare_include_condition_pattern(struct strbuf *pat) strbuf_realpath(&path, cf->path, 1); slash = find_last_dir_sep(path.buf); if (!slash) - die("BUG: how is this possible?"); + BUG("how is this possible?"); strbuf_splice(pat, 0, 1, path.buf, slash - path.buf); prefix = slash - path.buf + 1 /* slash */; } else if (!is_absolute_path(pat->buf)) @@ -1717,7 +1717,7 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha l_item->value_index = e->value_list.nr - 1; if (!cf) - die("BUG: configset_add_value has no source"); + BUG("configset_add_value has no source"); if (cf->name) { kv_info->filename = strintern(cf->name); kv_info->linenr = cf->linenr; @@ -3006,7 +3006,7 @@ const char *current_config_origin_type(void) else if(cf) type = cf->origin_type; else - die("BUG: current_config_origin_type called outside config callback"); + BUG("current_config_origin_type called outside config callback"); switch (type) { case CONFIG_ORIGIN_BLOB: @@ -3020,7 +3020,7 @@ const char *current_config_origin_type(void) case CONFIG_ORIGIN_CMDLINE: return "command line"; default: - die("BUG: unknown config origin type"); + BUG("unknown config origin type"); } } @@ -3032,7 +3032,7 @@ const char *current_config_name(void) else if (cf) name = cf->name; else - die("BUG: current_config_name called outside config callback"); + BUG("current_config_name called outside config callback"); return name ? name : ""; } -- cgit v1.2.3