aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-16 09:11:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-16 09:11:12 +0000
commitb5a6e431b95362edec6d1e3eb4b4d36bd05736e3 (patch)
tree033bf20f247ad3a3918dca02cd9263c91fe83d20
parent37c3befe34d88fc92022cbab2044a3aac893c332 (diff)
downloadruby-b5a6e431b95362edec6d1e3eb4b4d36bd05736e3.tar.gz
string.c: grapheme cluster regexp failure
* string.c (get_reg_grapheme_cluster): show error info and relax to rb_fatal from rb_bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--string.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/string.c b/string.c
index 691e99eca9..5fb2d2bdb7 100644
--- a/string.c
+++ b/string.c
@@ -8428,10 +8428,13 @@ get_reg_grapheme_cluster(rb_encoding *enc)
}
if (!reg_grapheme_cluster) {
const OnigUChar source[] = "\\X";
+ OnigErrorInfo einfo;
int r = onig_new(&reg_grapheme_cluster, source, source + sizeof(source) - 1,
- ONIG_OPTION_DEFAULT, enc, OnigDefaultSyntax, NULL);
+ ONIG_OPTION_DEFAULT, enc, OnigDefaultSyntax, &einfo);
if (r) {
- rb_bug("cannot compile grapheme cluster regexp");
+ UChar message[ONIG_MAX_ERROR_MESSAGE_LEN];
+ onig_error_code_to_str(message, r, &einfo);
+ rb_fatal("cannot compile grapheme cluster regexp: %s", (char *)message);
}
if (encidx == rb_utf8_encindex()) {
reg_grapheme_cluster_utf8 = reg_grapheme_cluster;