1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

don't use onig_recompile()

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kosako 2006-05-15 12:39:25 +00:00
parent 2d80e59b76
commit 8c5f9ef2ea
3 changed files with 18 additions and 10 deletions

View file

@ -1,3 +1,7 @@
Mon May 15 21:37:12 2006 K.Kosako <sndgk393 AT ybb.ne.jp>
* re.c (rb_reg_prepare_re): don't use onig_recompile().
Sat May 13 16:14:05 2006 Tanaka Akira <akr@m17n.org> Sat May 13 16:14:05 2006 Tanaka Akira <akr@m17n.org>
* lib/pp.rb (PP.mcall): new method. * lib/pp.rb (PP.mcall): new method.

18
re.c
View file

@ -906,7 +906,7 @@ rb_reg_prepare_re(VALUE re)
char err[ONIG_MAX_ERROR_MESSAGE_LEN]; char err[ONIG_MAX_ERROR_MESSAGE_LEN];
int r; int r;
OnigErrorInfo einfo; OnigErrorInfo einfo;
regex_t *reg; regex_t *reg, *reg2;
UChar *pattern; UChar *pattern;
if (FL_TEST(re, KCODE_FIXED)) if (FL_TEST(re, KCODE_FIXED))
@ -914,14 +914,18 @@ rb_reg_prepare_re(VALUE re)
rb_reg_check(re); rb_reg_check(re);
reg = RREGEXP(re)->ptr; reg = RREGEXP(re)->ptr;
pattern = ((UChar*)RREGEXP(re)->str); pattern = ((UChar*)RREGEXP(re)->str);
r = onig_recompile(reg, pattern, pattern + RREGEXP(re)->len,
reg->options, onigenc_get_default_encoding(),
OnigDefaultSyntax, &einfo);
if (r != 0) { r = onig_new(&reg2, (UChar* )pattern,
(void )onig_error_code_to_str((UChar*)err, r, &einfo); (UChar* )(pattern + RREGEXP(re)->len),
rb_reg_raise(pattern, RREGEXP(re)->len, err, re, Qfalse); reg->options, onigenc_get_default_encoding(),
OnigDefaultSyntax, &einfo);
if (r) {
onig_error_code_to_str((UChar*)err, r, &einfo);
rb_reg_raise((char* )pattern, RREGEXP(re)->len, err, re, Qfalse);
} }
RREGEXP(re)->ptr = reg2;
onig_free(reg);
} }
} }

View file

@ -1,14 +1,14 @@
#define RUBY_VERSION "1.9.0" #define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2006-05-13" #define RUBY_RELEASE_DATE "2006-05-15"
#define RUBY_VERSION_CODE 190 #define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20060513 #define RUBY_RELEASE_CODE 20060515
#define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 0 #define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2006 #define RUBY_RELEASE_YEAR 2006
#define RUBY_RELEASE_MONTH 5 #define RUBY_RELEASE_MONTH 5
#define RUBY_RELEASE_DAY 13 #define RUBY_RELEASE_DAY 15
RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_version[];
RUBY_EXTERN const char ruby_release_date[]; RUBY_EXTERN const char ruby_release_date[];