summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2018-05-02 09:38:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-06 10:06:13 (GMT)
commit033abf97fcbc247eabf915780181d947cfb66205 (patch)
tree3bc9fcff58ff630c3d94fbd5535f29948b2b0ef0 /grep.c
parentdde74d732fc3c5fa4bc4238aa935c164ff6c2dd5 (diff)
downloadgit-033abf97fcbc247eabf915780181d947cfb66205.zip
git-033abf97fcbc247eabf915780181d947cfb66205.tar.gz
git-033abf97fcbc247eabf915780181d947cfb66205.tar.bz2
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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/grep.c b/grep.c
index 65b90c1..84f8054 100644
--- a/grep.c
+++ b/grep.c
@@ -404,7 +404,7 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt)
die("Couldn't allocate PCRE JIT stack");
pcre_assign_jit_stack(p->pcre1_extra_info, NULL, p->pcre1_jit_stack);
} else if (p->pcre1_jit_on != 0) {
- die("BUG: The pcre1_jit_on variable should be 0 or 1, not %d",
+ BUG("The pcre1_jit_on variable should be 0 or 1, not %d",
p->pcre1_jit_on);
}
#endif
@@ -550,7 +550,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
die("Couldn't allocate PCRE2 match context");
pcre2_jit_stack_assign(p->pcre2_match_context, NULL, p->pcre2_jit_stack);
} else if (p->pcre2_jit_on != 0) {
- die("BUG: The pcre2_jit_on variable should be 0 or 1, not %d",
+ BUG("The pcre2_jit_on variable should be 0 or 1, not %d",
p->pcre1_jit_on);
}
}
@@ -917,10 +917,10 @@ static struct grep_expr *prep_header_patterns(struct grep_opt *opt)
for (p = opt->header_list; p; p = p->next) {
if (p->token != GREP_PATTERN_HEAD)
- die("BUG: a non-header pattern in grep header list.");
+ BUG("a non-header pattern in grep header list.");
if (p->field < GREP_HEADER_FIELD_MIN ||
GREP_HEADER_FIELD_MAX <= p->field)
- die("BUG: unknown header field %d", p->field);
+ BUG("unknown header field %d", p->field);
compile_regexp(p, opt);
}
@@ -933,7 +933,7 @@ static struct grep_expr *prep_header_patterns(struct grep_opt *opt)
h = compile_pattern_atom(&pp);
if (!h || pp != p->next)
- die("BUG: malformed header expr");
+ BUG("malformed header expr");
if (!header_group[p->field]) {
header_group[p->field] = h;
continue;
@@ -1652,7 +1652,7 @@ static int fill_textconv_grep(struct userdiff_driver *driver,
fill_filespec(df, &null_oid, 0, 0100644);
break;
default:
- die("BUG: attempt to textconv something without a path?");
+ BUG("attempt to textconv something without a path?");
}
/*
@@ -1748,7 +1748,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
case GREP_BINARY_TEXT:
break;
default:
- die("BUG: unknown binary handling mode");
+ BUG("unknown binary handling mode");
}
}
@@ -2072,7 +2072,7 @@ static int grep_source_load(struct grep_source *gs)
case GREP_SOURCE_BUF:
return gs->buf ? 0 : -1;
}
- die("BUG: invalid grep_source type to load");
+ BUG("invalid grep_source type to load");
}
void grep_source_load_driver(struct grep_source *gs)