Skip to content

Commit

Permalink
remove GNU regex API
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
kosako committed Feb 17, 2005
1 parent 02b8414 commit 1034d14
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 359 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Thu Feb 17 22:15:34 2005 K.Kosako <[email protected]>

* ext/strscan/strscan.c: calls Oniguruma API directly.

Thu Feb 17 21:53:12 2005 K.Kosako <[email protected]>

* common.mk, LEGAL: remove reggnu.c.

Thu Feb 17 21:53:12 2005 Kazuo Saito <[email protected]>

* gc.c, re.c: now ruby calls Oniguruma API directly, bypassing
GNU compatible APIs.

Thu Feb 17 20:09:23 2005 Hirokazu Yamamoto <[email protected]>

* lib/drb/drb.rb (DRbServer.default_safe_level): fix typo.
Expand Down
5 changes: 2 additions & 3 deletions LEGAL
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@ regenc.[ch]:
regerror.c:
regex.c:
regexec.c:
reggnu.c:
regint.h:
regparse.[ch]:
ascii.c:
euc_jp.c:
sjis.c:
utf8.c:

Oniguruma ---- (C) K.Kosako <[email protected].jp>
Oniguruma ---- (C) K.Kosako <sndgk393 AT ybb DOT ne DOT jp>

http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/oniguruma/
http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/oniguruma/
http://www.geocities.jp/kosako1/oniguruma/
http://www.geocities.jp/kosako3/oniguruma/

When this software is partly used or it is distributed with Ruby,
this of Ruby follows the license of Ruby.
Expand Down
4 changes: 0 additions & 4 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ OBJS = array.$(OBJEXT) \
regenc.$(OBJEXT) \
regerror.$(OBJEXT) \
regexec.$(OBJEXT) \
reggnu.$(OBJEXT) \
regparse.$(OBJEXT) \
ruby.$(OBJEXT) \
signal.$(OBJEXT) \
Expand Down Expand Up @@ -260,9 +259,6 @@ regerror.$(OBJEXT): {$(VPATH)}regerror.c {$(VPATH)}regint.h \
{$(VPATH)}regenc.h {$(VPATH)}oniguruma.h config.h
regexec.$(OBJEXT): {$(VPATH)}regexec.c {$(VPATH)}regint.h \
{$(VPATH)}regenc.h {$(VPATH)}oniguruma.h config.h
reggnu.$(OBJEXT): {$(VPATH)}reggnu.c {$(VPATH)}regint.h \
{$(VPATH)}regenc.h {$(VPATH)}oniguruma.h {$(VPATH)}oniggnu.h \
config.h
regparse.$(OBJEXT): {$(VPATH)}regparse.c {$(VPATH)}oniguruma.h \
{$(VPATH)}regint.h {$(VPATH)}regparse.h {$(VPATH)}regenc.h config.h
ruby.$(OBJEXT): {$(VPATH)}ruby.c {$(VPATH)}ruby.h config.h \
Expand Down
18 changes: 8 additions & 10 deletions ext/strscan/strscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static void
strscan_free(p)
struct strscanner *p;
{
re_free_registers(&(p->regs));
onig_region_free(&(p->regs), 0);
memset(p, sizeof(struct strscanner), 0);
free(p);
}
Expand Down Expand Up @@ -440,17 +440,15 @@ strscan_do_scan(self, regex, succptr, getstr, headonly)
}
strscan_prepare_re(regex);
if (headonly) {
ret = re_match(RREGEXP(regex)->ptr,
CURPTR(p), S_RESTLEN(p),
0,
&(p->regs));
ret = onig_match(RREGEXP(regex)->ptr, (UChar* )CURPTR(p),
(UChar* )(CURPTR(p) + S_RESTLEN(p)),
(UChar* )CURPTR(p), &(p->regs), ONIG_OPTION_NONE);
}
else {
ret = re_search(RREGEXP(regex)->ptr,
CURPTR(p), S_RESTLEN(p),
0,
S_RESTLEN(p),
&(p->regs));
ret = onig_search(RREGEXP(regex)->ptr,
(UChar* )CURPTR(p), (UChar* )(CURPTR(p) + S_RESTLEN(p)),
(UChar* )CURPTR(p), (UChar* )(CURPTR(p) + S_RESTLEN(p)),
&(p->regs), ONIG_OPTION_NONE);
}

if (ret == -2) rb_raise(ScanError, "regexp buffer overflow");
Expand Down
5 changes: 2 additions & 3 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ extern unsigned long __libc_ia64_register_backing_store_base;
#include <windows.h>
#endif

void re_free_registers _((struct re_registers*));
int rb_io_fptr_finalize _((struct OpenFile*));

#if !defined(setjmp) && defined(HAVE__SETJMP)
Expand Down Expand Up @@ -1166,7 +1165,7 @@ obj_free(obj)
break;
case T_REGEXP:
if (RANY(obj)->as.regexp.ptr) {
re_free_pattern(RANY(obj)->as.regexp.ptr);
onig_free(RANY(obj)->as.regexp.ptr);
}
if (RANY(obj)->as.regexp.str) {
RUBY_CRITICAL(free(RANY(obj)->as.regexp.str));
Expand All @@ -1184,7 +1183,7 @@ obj_free(obj)
break;
case T_MATCH:
if (RANY(obj)->as.match.regs) {
re_free_registers(RANY(obj)->as.match.regs);
onig_region_free(RANY(obj)->as.match.regs, 0);
RUBY_CRITICAL(free(RANY(obj)->as.match.regs));
}
break;
Expand Down
Loading

0 comments on commit 1034d14

Please sign in to comment.