mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
774fd169ad
commit
569fe2922f
1 changed files with 5 additions and 2 deletions
7
string.c
7
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(®_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;
|
||||
|
|
Loading…
Reference in a new issue