Skip to content

Commit f353d89

Browse files
author
ksaito
committed
* oniggnu.h: imported from Oniguruma library.
* oniguruma.h: ditto. * regcomp.c: ditto. * regenc.c: ditto. * regenc.h: ditto. * regerror.c: ditto. * regex.c: ditto. * regexec.c: ditto. * reggnu.c: ditto. * regint.h: ditto. * regparse.c: ditto. * regparse.h: ditto. * ascii.c: ditto. * euc_jp.c: ditto. * sjis.c: ditto. * utf8.c: ditto. * MANIFEST: added Oniguruma files listed above. * LEGAL: added Oniguruma license. * regex.h: now includes oniggnu.h. * re.c: applied Oniguruma patch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 5770336 commit f353d89

File tree

6 files changed

+110
-4890
lines changed

6 files changed

+110
-4890
lines changed

ChangeLog

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
Fri Mar 6 00:39:21 2004 Kazuo Saito <ksaito@uranus.dti.ne.jp>
2+
3+
* oniggnu.h: imported from Oniguruma library.
4+
* oniguruma.h: ditto.
5+
* regcomp.c: ditto.
6+
* regenc.c: ditto.
7+
* regenc.h: ditto.
8+
* regerror.c: ditto.
9+
* regex.c: ditto.
10+
* regexec.c: ditto.
11+
* reggnu.c: ditto.
12+
* regint.h: ditto.
13+
* regparse.c: ditto.
14+
* regparse.h: ditto.
15+
* ascii.c: ditto.
16+
* euc_jp.c: ditto.
17+
* sjis.c: ditto.
18+
* utf8.c: ditto.
19+
20+
* MANIFEST: added Oniguruma files listed above.
21+
22+
* LEGAL: added Oniguruma license.
23+
24+
* regex.h: now includes oniggnu.h.
25+
26+
* re.c: applied Oniguruma patch.
27+
128
Fri Mar 5 23:13:08 2004 Minero Aoki <aamine@loveruby.net>
229

330
* lib/net/http.rb: support WebDAV methods, PROPPATCH, LOCK,

LEGAL

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,29 @@ All the files in this distribution are covered under either the Ruby's
55
license (see the file COPYING) or public-domain except some files
66
mentioned below.
77

8-
regex.[ch]:
9-
10-
These files are under LGPL. Treat them as LGPL says. (See the file
11-
LGPL for details)
12-
13-
Extended regular expression matching and search library.
14-
Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
15-
16-
The GNU C Library is free software; you can redistribute it and/or
17-
modify it under the terms of the GNU Library General Public License as
18-
published by the Free Software Foundation; either version 2 of the
19-
License, or (at your option) any later version.
20-
21-
The GNU C Library is distributed in the hope that it will be useful,
22-
but WITHOUT ANY WARRANTY; without even the implied warranty of
23-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24-
Library General Public License for more details.
25-
26-
You should have received a copy of the GNU Library General Public
27-
License along with the GNU C Library; see the file LGPL. If not,
28-
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
29-
Boston, MA 02111-1307, USA. */
30-
31-
Multi-byte extension added May, 1993 by t^2 (Takahiro Tanimoto)
32-
Last change: May 21, 1993 by t^2
33-
removed gapped buffer support, multiple syntax support by matz <matz@nts.co.jp>
34-
Perl5 extension added by matz <matz@caelum.co.jp>
35-
UTF-8 extension added Jan 16 1999 by Yoshida Masato <yoshidam@tau.bekkoame.ne.jp>
8+
oniggnu.h:
9+
oniguruma.h:
10+
regcomp.c:
11+
regenc.[ch]:
12+
regerror.c:
13+
regex.c:
14+
regexec.c:
15+
reggnu.c:
16+
regint.h:
17+
regparse.[ch]:
18+
ascii.c:
19+
euc_jp.c:
20+
sjis.c:
21+
utf8.c:
22+
23+
Oniguruma ---- (C) K.Kosako <kosako@sofnec.co.jp>
24+
25+
http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/oniguruma/
26+
http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/oniguruma/
27+
http://www.geocities.jp/kosako1/oniguruma/
28+
29+
When this software is partly used or it is distributed with Ruby,
30+
this of Ruby follows the license of Ruby.
3631

3732
configure:
3833

MANIFEST

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ README.EXT.ja
1313
README.ja
1414
ToDo
1515
array.c
16+
ascii.c
1617
bignum.c
1718
class.c
1819
compar.c
@@ -28,6 +29,7 @@ dmyext.c
2829
enum.c
2930
env.h
3031
error.c
32+
euc_jp.c
3133
eval.c
3234
file.c
3335
gc.c
@@ -48,6 +50,8 @@ mkconfig.rb
4850
node.h
4951
numeric.c
5052
object.c
53+
oniggnu.h
54+
oniguruma.h
5155
pack.c
5256
parse.c
5357
parse.y
@@ -57,8 +61,17 @@ random.c
5761
range.c
5862
re.c
5963
re.h
64+
regcomp.c
65+
regenc.c
66+
regenc.h
67+
regerror.c
6068
regex.c
6169
regex.h
70+
regexec.c
71+
reggnu.c
72+
regint.h
73+
regparse.c
74+
regparse.h
6275
ruby.1
6376
ruby.c
6477
ruby.h
@@ -67,12 +80,14 @@ rubysig.h
6780
rubytest.rb
6881
runruby.rb
6982
signal.c
83+
sjis.c
7084
sprintf.c
7185
st.c
7286
st.h
7387
string.c
7488
struct.c
7589
time.c
90+
utf8.c
7691
util.c
7792
util.h
7893
variable.c

re.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,13 @@ rb_reg_to_s(re)
483483
goto again;
484484
}
485485
if (*ptr == ':' && ptr[len-1] == ')') {
486+
int r;
486487
Regexp *rp;
487488
kcode_set_option(re);
488-
rp = ALLOC(Regexp);
489-
MEMZERO((char *)rp, Regexp, 1);
490-
err = re_compile_pattern(++ptr, len -= 2, rp) != 0;
489+
r = re_alloc_pattern(&rp);
490+
if (r == 0) {
491+
err = (re_compile_pattern(++ptr, len -= 2, rp, NULL) != 0);
492+
}
491493
kcode_reset_option();
492494
re_free_pattern(rp);
493495
}
@@ -621,7 +623,8 @@ make_regexp(s, len, flags)
621623
int flags;
622624
{
623625
Regexp *rp;
624-
char *err;
626+
char err[ONIG_MAX_ERROR_MESSAGE_LEN];
627+
int r;
625628

626629
/* Handle escaped characters first. */
627630

@@ -630,17 +633,18 @@ make_regexp(s, len, flags)
630633
from that.
631634
*/
632635

633-
rp = ALLOC(Regexp);
634-
MEMZERO((char *)rp, Regexp, 1);
635-
rp->buffer = ALLOC_N(char, 16);
636-
rp->allocated = 16;
637-
rp->fastmap = ALLOC_N(char, 256);
636+
r = re_alloc_pattern(&rp);
637+
if (r) {
638+
re_error_code_to_str((UChar* )err, r);
639+
rb_reg_raise(s, len, err, 0);
640+
}
641+
638642
if (flags) {
639643
rp->options = flags;
640644
}
641-
err = re_compile_pattern(s, len, rp);
645+
r = re_compile_pattern(s, len, rp, err);
642646

643-
if (err != NULL) {
647+
if (r != 0) {
644648
rb_reg_raise(s, len, err, 0);
645649
}
646650
return rp;
@@ -842,14 +846,14 @@ rb_reg_prepare_re(re)
842846
}
843847

844848
if (need_recompile) {
845-
char *err;
849+
char err[ONIG_MAX_ERROR_MESSAGE_LEN];
850+
int r;
846851

847852
if (FL_TEST(re, KCODE_FIXED))
848853
kcode_set_option(re);
849854
rb_reg_check(re);
850-
RREGEXP(re)->ptr->fastmap_accurate = 0;
851-
err = re_compile_pattern(RREGEXP(re)->str, RREGEXP(re)->len, RREGEXP(re)->ptr);
852-
if (err != NULL) {
855+
r = re_recompile_pattern(RREGEXP(re)->str, RREGEXP(re)->len, RREGEXP(re)->ptr, err);
856+
if (r != 0) {
853857
rb_reg_raise(RREGEXP(re)->str, RREGEXP(re)->len, err, re);
854858
}
855859
}

0 commit comments

Comments
 (0)