Граф коммитов

70 Коммитов

Автор SHA1 Сообщение Дата
nobu 893949167b Fix issues detected by code analysis tool (mainly Coverity).
* Fix leaked storage in addr2line.c.
* Fix for "top_root" leaking the resource.

[Fix GH-1956]

From: Jun Aruga <jaruga@redhat.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-15 09:59:14 +00:00
hsbt ef9bc609db Fix typos.
* rememberd -> remembered
  * refered -> referred

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-18 11:44:10 +00:00
naruse 6b1c6e0e55 Merge Onigmo 6.1.1
* Support absent operator https://github.com/k-takata/Onigmo/issues/82
* https://github.com/k-takata/Onigmo/blob/Onigmo-6.1.1/HISTORY

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-11 15:08:33 +00:00
nobu 7db9fbdfe6 regcomp.c: debug function [ci skip]
* regcomp.c (print_indent_tree): make a function for debug static.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-25 06:08:16 +00:00
ngoto 9022401809 regcomp.c: Fix compile error with old version of fcc on Solaris
* regcomp.c (get_min_match_length): Fix compile error with old version
  of fcc (Fujitsu C Compiler) on Solaris 10. [Bug #13059][ruby-dev:49909]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-21 15:21:19 +00:00
naruse 2873edeafb Merge Onigmo 6.0.0
* https://github.com/k-takata/Onigmo/blob/Onigmo-6.0.0/HISTORY
* fix for ruby 2.4: https://github.com/k-takata/Onigmo/pull/78
* suppress warning: https://github.com/k-takata/Onigmo/pull/79
* include/ruby/oniguruma.h: include onigmo.h.
* template/encdb.h.tmpl: ignore duplicated definition of EUC-CN in
  enc/euc_kr.c. It is defined in enc/gb2313.c with CRuby macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10 17:47:04 +00:00
naruse c11e648799 Regexp supports Unicoe 9.0.0's \X
* meta character \X matches Unicode 9.0.0 characters with some workarounds
  for UTR #51 Unicode Emoji, Version 4.0 emoji zwj sequences.
  [Feature #12831] [ruby-core:77586]

The term "character" can have many meanings bytes, codepoints, combined
characters, and so on. "grapheme cluster" is highest one of such words,
which means user-perceived characters.
Unicode Standard Annex #29 UNICODE TEXT SEGMENTATION specifies how to
handle grapheme clusters (extended grapheme cluster).
But some specs aren't updated to current situation because Unicode Emoji
is rapidly extended without well definition.
It breaks the precondition of UTR#29 "Grapheme cluster boundaries can be
easily tested by looking at immediately adjacent characters". (the
sentence will be removed in the next version)
Though some of its detail are described in Unicode Technical Report #51
UNICODE EMOJI but it is not merged into UTR#29 yet.

http://unicode.org/reports/tr29/
http://unicode.org/reports/tr51/
http://unicode.org/Public/emoji/4.0/

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-30 17:29:19 +00:00
naruse 5d9b95a5c7 * regcomp.c (onig_print_compiled_byte_code): make the shown address
look relative.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-03 21:06:50 +00:00
naruse 1e3fc7dcfa * regcomp.c (noname_disable_map): don't optimize out group 0
Ruby's Regexp doesn't allow normal numbered groups if the regexp
  has named groups. On such case it optimizes out related NT_ENCLOSE.
  But even on the case it can use \g<0>.
  This fix not to remove NT_ENCLOSE whose regnum is 0.
  [ruby-core:75828] [Bug #12454]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-01 19:37:43 +00:00
nobu 4c68173079 regcomp.c: fix debug conditionals
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 06:05:48 +00:00
naruse 599f054fe6 * regcomp.c: remove condition for debug output because prelude
doesn't use regexp now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 04:21:32 +00:00
naruse 8c2ddab57a * regcomp.c (compile_length_tree): return error code immediately
if compile_length_tree raised error [Bug #12418]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 04:21:31 +00:00
nobu b3377eaa13 Revert r52995
revert slow atomic operations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 07:30:44 +00:00
nobu 0599d7de58 use atomic operations
* regcomp.c (onig_chain_link_add): use atomic operation instead of
  mutex.
* regint.h (ONIG_STATE_{INC,DEC}_THREAD): ditto.
* regparse.c (PopFreeNode, node_recycle): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 06:48:15 +00:00
naruse 9ed1d63f41 * regcomp.c, regenc.c, regexec.c, regint.h, enc/unicode.c:
Merge Onigmo 58fa099ed1a34367de67fb3d06dd48d076839692
  + https://github.com/k-takata/Onigmo/pull/52

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-26 08:31:27 +00:00
naruse d2a5354255 * reg*.c: Merge Onigmo 5.15.0 38a870960aa7370051a3544
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-15 16:18:41 +00:00
naruse 64c81e40d4 * regcomp.c: Merge Onigmo 5.14.1 25a8a69fc05ae3b56a09.
this includes Support for Unicode 7.0 [Bug #9092].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-16 03:27:25 +00:00
naruse d39f196401 * regcomp.c (): Merge Onigmo 5.13.5 23b523076d6f1161.
https://bugs.ruby-lang.org/issues/8583

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-04 01:16:22 +00:00
naruse 536a3274c9 * Merge Onigmo 5.13.4 f22cf2e566712cace60d17f84d63119d7c5764ee.
[bug] fix problem with optimization of \z (Issue #16) [Bug #8210]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-13 11:30:35 +00:00
naruse 78dbaa1648 * Merge Onigmo 0fe387da2fee089254f6b04990541c731a26757f
v5.13.3 [Bug#7972] [Bug#7974]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-01 16:36:37 +00:00
naruse bfba60f8fe Remove unused variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-05 07:40:51 +00:00
nobu 0ffc74dece * regcomp.c, regexec.c: fix-up warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-18 15:41:59 +00:00
naruse 0424e152c6 * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
https://github.com/k-takata/Onigmo
  cp reg{comp,enc,error,exec,parse,syntax}.c reg{enc,int,parse}.h
  cp oniguruma.h
  cp tool/enc-unicode.rb
  cp -r enc/

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-17 07:42:23 +00:00
nobu 84dcc38273 * regcomp.c (onig_region_memsize): implemented for memsize_of().
* ext/objspace/objspace.c (memsize_of): use it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15 04:15:54 +00:00
nobu 8baffe6ef6 * class.c (rb_obj_methods), compile.c (iseq_compile_each),
iseq.c(iseq_load, rb_iseq_parameters), pack.c (pack_pack),
  regcomp.c (is_not_included, update_string_node_case_fold),
  transcode.c (rb_econv_open0, make_replacement),
  vm_eval.c (raise_method_missing): remove unused variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05 09:50:12 +00:00
naruse 16b663db57 * regcomp.c (print_indent_tree): fix double printing of ENCLOSE_OPTION
children bug. patched by Suraj Kurapati. [ruby-core:40964]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-15 00:51:46 +00:00
naruse d78e45e08d Show encoding of compiling regexp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-23 00:04:51 +00:00
naruse 48de1e292a * addr2line.c: suppressed shorten-64-to-32 warnings.
* regcomp.c: ditto.
* regexec.c: ditto.
* regint.h: ditto.
* regparse.c: ditto.
* regparse.h: ditto.
* time.c: ditto.
* variable.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-31 03:44:57 +00:00
naruse f8f3585416 * regcomp.c (setup_tree): restart setup_tree() for a node whose
AnchorNode's type is ANCHOR_PREC_BEHIND or ANCHOR_PREC_BEHIND_NOT
  and divide_look_behind_alternatives() divided it to NT_ALT or
  NT_LIST. [ruby-core:33370]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-26 03:28:48 +00:00
naruse 2578743199 * regcomp.c (onig_is_prelude): added to check whether ruby is still
in prelude (or other boot processes) or not.

* regcomp.c (optimize_node_left): use onig_is_prelude for printing.

* regcomp.c (set_optimize_info_from_tree): ditto.

* regcomp.c (onig_compile): ditto.

* regcomp.c (print_compiled_byte_code_list): print its address.

* regcomp.c (print_indent_tree): print its contents tree of
    ANCHOR_PREC_READ(_NOT) and ANCHOR_PREC_BEHIND(_NOT).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-26 00:24:28 +00:00
naruse bd98301784 * regcomp.c (print_distance_range): use PRIuSIZE.
* regcomp.c (print_optimize_info): use %ld because the type of
  calcutated value of integers is long.

* regexec.c (onig_print_compiled_byte_code): add prototype.

* regexec.c (match_at): add 2nd argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-25 14:14:44 +00:00
naruse 8e2a1cba36 * regint.h (OnigOpInfoType): constify name.
* regcomp.c (op2name): constify return value.

* regcomp.c (onig_print_compiled_byte_code): use PRIuPTR and
  uintptr_t to clean warnings.

* regcomp.c (print_indent_tree): use PRIxPTR and intptr_t.

* regexec.c (match_at): use PRIdPTR and intptr_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-17 06:21:11 +00:00
naruse ce5827c6fb * regcomp.c: revert r26701; it introduces Bug #3681.
[ruby-core:31677]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-17 16:53:25 +00:00
nobu a979eb4548 * regcomp.c (onig_memsize): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 06:17:38 +00:00
naruse 76a5c00be6 * regcomp.c (noname_disable_map): add NT_ANCHOR case.
Without this change, captured groups in anchors (look-ahead,
  look-behind, and so on) are not removed and
  unintended invalid backref error occur. [ruby-core:28235]

* regcomp.c (renumber_by_map): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-02 09:40:27 +00:00
matz db37773e13 * 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-01 21:54:59 +00:00
mame 457c2c4a55 * regcomp.c (setup_tree, onig_compile): optimize .* at last by
converting into (?>.*), which does not backtrack.  [ruby-core:27791]

* test/ruby/test_regexp.rb: add a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-17 12:36:41 +00:00
naruse 62f8c207b2 * regcomp.c (onig_compile): initialize ScanEnv.
mainly to initialize env->warnings_flag [ruby-dev:40196]

* regparse.c (scan_env_clear): clear warnings_flag.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-28 00:50:17 +00:00
naruse ebc6950631 * regcomp.c (optimize_node_left): include equal on the condition of for-loop.
This bug also affects original Oniguruma. [ruby-core:27247]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-21 09:13:28 +00:00
naruse de341005c8 * regcomp.c (print_enc_string): follow enclen's change.
* regcomp.c (onig_print_compiled_byte_code): ditto.

* regcomp.c (onig_print_compiled_byte_code): change prototype.

* regint.c (onig_print_compiled_byte_code): comment out.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-21 01:11:15 +00:00
naruse 6ab36c6e19 *regparse.c (CC_DUP_WARN): use rb_compile_warn if ScanEnv has source
information. [ruby-dev:39105]

*re.c (rb_reg_compile): add sourcefile and sourceline to the arguments.

*re.c (make_regexp): ditto.

*re.c (rb_reg_initialize): ditto.

*re.c (rb_reg_initialize_str): ditto.

*re.c (rb_reg_compile): ditto.

*regcomp.c (onig_compile): ditto.

*regint.h (onig_compile): ditto.

*re.c (reg_compile_gen): follow above.

*re.c (rb_reg_to_s): ditto.

*re.c (make_regexp): ditto.

*re.c (rb_reg_initialize): ditto.

*re.c (rb_reg_initialize_str): ditto.

*re.c (rb_reg_new_str): ditto.

*re.c (rb_enc_reg_new): ditto.

*re.c (rb_reg_initialize_m): ditto.

*re.c (rb_reg_init_copy): ditto.

*regcomp.c (onig_new): ditto.

*regcomp.c (onig_compile): set sourcefile and sourceline to scan_env.

*regparse.h (ScanEnv): add sourcefile and sourceline.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 08:00:31 +00:00
nobu 23a32d6444 * include/ruby/oniguruma.h, include/ruby/re.h, re.c, regcomp.c,
regenc.c, regerror.c, regexec.c, regint.h, regparse.c: use long.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-30 02:08:54 +00:00
ko1 3caa4ee5e5 * array.c (rb_ary_memsize): added.
* io.c (rb_io_memsize): added.
* regcomp.c (onig_memsize): added.
* string.c (rb_str_memsize): added.
* transcode.c (rb_transcoding_memsize, rb_econv_memsize): added.
* variable.c (rb_geneic_ivar_memsize): added.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 22:36:27 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
nobu 4f572663c8 * regexec.c (stack_double): use MatchStackLimitSize atomically.
* regparse.c (onig_free_shared_cclass_table): OnigTypeCClassTable
  needs atomicity

* regsyntax.c: constified all predefined OnigSyntaxTypes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 08:21:44 +00:00
matz 52ed8c4edd * include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 15:55:04 +00:00
matz edd7c787ad * array.c (rb_ary_cycle): typo in rdoc. a patch from Yugui
<yugui@yugui.sakura.ne.jp>.  [ruby-dev:31748]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-06 12:33:45 +00:00
matz e1def8a987 * include/ruby/oniguruma.h: upgrade to Oniguruma 5.9.0. fixes
some memory violation.  [ruby-dev:31070]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-23 09:39:30 +00:00
matz 6ee2e54239 * oniguruma.h: updated to Oniguruma 5.7.0.
* regsyntax.c, unicode.c: new files along with Oniguruma 5.x.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-23 01:32:08 +00:00
matz 33163ad123 * regparse.c, etc.: K&R to ANSI code cleanup patch from Stefan
Huehner <stefan at huehner.org>.  [ruby-core:10543]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-19 03:58:57 +00:00