Skip to content

Commit

Permalink
* include/ruby/oniguruma.h: updated to follow Oniguruma 5.9.2.
Browse files Browse the repository at this point in the history
* re.c (make_regexp): use onig_new() instead of onig_alloc_init().

* re.c (rb_reg_to_s): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Mar 1, 2010
1 parent e1c3316 commit db37773
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 173 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ Mon Mar 1 17:42:45 2010 wanabe <[email protected]>

* configure.in (mingw): do not detect snprintf/vsnprintf.

Mon Mar 1 16:54:21 2010 Yukihiro Matsumoto <[email protected]>

* include/ruby/oniguruma.h: updated to follow Oniguruma 5.9.2.

* re.c (make_regexp): use onig_new() instead of onig_alloc_init().

* re.c (rb_reg_to_s): ditto.
Sun Feb 28 21:32:36 2010 Nobuyoshi Nakada <[email protected]>

* ext/pty/pty.c (get_device_once): raise on error when fail is
Expand Down
11 changes: 1 addition & 10 deletions enc/euc_tw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
euc_tw.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -169,15 +169,6 @@ euctw_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end,
pp, end, lower);
}

#if 0
static int
euctw_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end, OnigEncoding enc)
{
return onigenc_mbn_is_mbc_ambiguous(enc, flag, pp, end);
}
#endif

static int
euctw_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
{
Expand Down
2 changes: 1 addition & 1 deletion enc/iso_8859_5.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
iso8859_5.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion enc/koi8_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
koi8_r.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion enc/koi8_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
koi8_u.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
6 changes: 3 additions & 3 deletions enc/shift_jis.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sjis.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -294,15 +294,15 @@ init_property_list(void)
static int
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{
st_data_t ctype;
hash_data_type ctype;

PROPERTY_LIST_INIT_CHECK;

if (onig_st_lookup_strend(PropertyNameTable, p, end, &ctype) == 0) {
return onigenc_minimum_property_name_to_ctype(enc, p, end);
}

return ctype;
return (int)ctype;
}

static int
Expand Down
2 changes: 1 addition & 1 deletion enc/unicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
unicode.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion enc/utf_16be.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
utf_16be.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion enc/utf_16le.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
utf_16le.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down
10 changes: 8 additions & 2 deletions include/ruby/oniguruma.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
oniguruma.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -39,7 +39,7 @@ extern "C" {
#define ONIGURUMA
#define ONIGURUMA_VERSION_MAJOR 5
#define ONIGURUMA_VERSION_MINOR 9
#define ONIGURUMA_VERSION_TEENY 1
#define ONIGURUMA_VERSION_TEENY 2

#ifdef __cplusplus
# ifndef HAVE_PROTOTYPES
Expand Down Expand Up @@ -693,10 +693,16 @@ void onig_set_verb_warn_func P_((OnigWarnFunc f));
ONIG_EXTERN
int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax, OnigErrorInfo* einfo));
ONIG_EXTERN
int onig_reg_init P_((regex_t* reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType* syntax));
ONIG_EXTERN
int onig_new_without_alloc P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
ONIG_EXTERN
int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
ONIG_EXTERN
void onig_free P_((OnigRegex));
ONIG_EXTERN
void onig_free_body P_((OnigRegex));
ONIG_EXTERN
int onig_recompile P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
ONIG_EXTERN
int onig_recompile_deluxe P_((OnigRegex reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
Expand Down
28 changes: 8 additions & 20 deletions re.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,15 +521,11 @@ rb_reg_to_s(VALUE re)
if (*ptr == ':' && ptr[len-1] == ')') {
int r;
Regexp *rp;
r = onig_alloc_init(&rp, ONIG_OPTION_DEFAULT,
ONIGENC_CASE_FOLD_DEFAULT,
rb_enc_get(re),
OnigDefaultSyntax);
if (r == 0) {
++ptr;
len -= 2;
err = (onig_compile(rp, ptr, ptr + len, NULL, NULL, 0) != 0);
}

++ptr;
len -= 2;
err = onig_new(&rp, ptr, ptr + len, ONIG_OPTION_DEFAULT,
rb_enc_get(re), OnigDefaultSyntax, NULL);
onig_free(rp);
}
if (err) {
Expand Down Expand Up @@ -745,18 +741,10 @@ make_regexp(const char *s, long len, rb_encoding *enc, int flags, onig_errmsg_bu
from that.
*/

r = onig_alloc_init(&rp, flags, ONIGENC_CASE_FOLD_DEFAULT,
enc, OnigDefaultSyntax);
r = onig_new(&rp, (UChar*)s, (UChar*)(s + len), flags,
enc, OnigDefaultSyntax, &einfo);
if (r) {
onig_error_code_to_str((UChar*)err, r);
return 0;
}

r = onig_compile(rp, (UChar*)s, (UChar*)(s + len), &einfo, sourcefile, sourceline);

if (r != 0) {
onig_free(rp);
(void )onig_error_code_to_str((UChar*)err, r, &einfo);
onig_error_code_to_str((UChar*)err, r, &einfo);
return 0;
}
return rp;
Expand Down
Loading

0 comments on commit db37773

Please sign in to comment.