summaryrefslogtreecommitdiff
path: root/re.c
AgeCommit message (Collapse)Author
2016-04-28* re.c (rb_reg_prepare_enc): use rb_enc_asciicompat(enc) instead ofnaruse
rb_enc_str_asciicompat_p(str) to avoid useless rb_enc_get(str) call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-18* re.c: Add MatchData#named_capturessorah
[Feature #11999] [ruby-core:72897] * test/ruby/test_regexp.rb(test_match_data_named_captures): Test for above. * NEWS: News about MatchData#named_captures. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-12Update re.c [ci skip]nobu
* re.c (rb_reg_initialize_m): [DOC] fix missing right bracket. [Fix GH-1243] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-09* re.c: Remove deprecated kcode argument from Regexp.new and compilezzak
patch provided by Dylan Pulliam [Bug #11495] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-04fstring without copynobu
* re.c (reg_set_source): make source string frozen without copying. * re.c (rb_reg_initialize_m): refactor initialization with encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-04revert re.c in r53736nobu
* re.c (rb_reg_initialize): must copy the source string content, it is not a static literal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-04return shared stringnobu
* re.c (rb_reg_source): return shared string without copying. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-04fstring_enc_newnobu
* string.c (rb_fstring_enc_new, rb_fstring_enc_cstr): functions to make fstring with encoding. * re.c (rb_reg_initialize): make fstring without copying. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-02* re.c (rb_reg_prepare_enc): use already compiled US-ASCII regexpnaruse
if given string is ASCII only. 121.2s to 113.9s on my x86_64-freebsd10.2 Intel Core i5 661 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-02* re.c: Introduce RREGEXP_PTR.naruse
patch by dbussink. partially merge https://github.com/ruby/ruby/pull/497 * include/ruby/ruby.h: ditto. * gc.c: ditto. * ext/strscan/strscan.c: ditto. * parse.y: ditto. * string.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-14variable.c: matched backrefs onlynobu
* variable.c (rb_f_global_variables): add matched back references only, as well as defiend? operator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-17re.c: names encodingnobu
* re.c (reg_names_iter): should consider encoding of regexp. [ruby-core:72185] [Bug #11825] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-07re.c: indent [ci skip]nobu
* re.c (onig_new_with_source, rb_reg_search0): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-15encindex.h: ENCINDEXnobu
* encindex.h: separate encoding index constants from internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-26re.c: fix wchar match at EOSnobu
* re.c (rb_memsearch_wchar, rb_memsearch_qchar): test matching till the end of string. [ruby-core:70592] [Bug #11488] * test/ruby/test_m17n.rb (test_include?, tet_index): add tests by Tom Stuart. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-03re.c: fix for wide character encodingsnobu
* re.c (rb_memsearch): should match only char boundaries in wide character encodings. [ruby-core:70220] [Bug #11413] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-17encoding.h: ENC_CODERANGE_CLEAN_Pnobu
* include/ruby/encoding.h (ENC_CODERANGE_CLEAN_P): predicate that tells if the coderange is clean, that is 7bit or valid, and no needs to scrub. * re.c (rb_reg_expr_str): use ENC_CODERANGE_CLEAN_P. * string.c (enc_strlen, rb_enc_cr_str_buf_cat, rb_str_scrub): ditto. * string.c (rb_str_enumerate_chars): ditto, and suppress a warning by gcc6. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-24* re.c: Update documentation for Regexp class.hsbt
[fix GH-937][ci skip] Patch by @davydovanton git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-17* include/ruby/ruby.h: $SAFE=3 is now obsolete.hsbt
* ext/socket/init.c, ext/socket/socket.c, ext/socket/tcpsocket.c ext/socket/udpsocket.c, gc.c, object.c, re.c, safe.c: removed code for $SAFE=3 * bootstraptest/test_method.rb, test/erb/test_erb.rb, test/ruby/test_dir.rb test/ruby/test_file.rb, test/ruby/test_method.rb, test/ruby/test_regexp.rb test/ruby/test_thread.rb: remove tests for $SAFE=3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-14use frozen string of symbolsnobu
* range.c (range_step, range_each): String#upto should never modifies the receiver, use frozen strings to enumerate symbols. * re.c (reg_operand): matching target is not modified. * ext/socket/constants.c (constant_arg): str_to_int never modifies argument strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-21re.c: RMatch::regexp can be nilnobu
* re.c (match_aref): RMatch::regexp is Qnil after matching by a string since r45451. [ruby-core:68209] [Bug #10877] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-29re.c: append excape sequence as-isnobu
* re.c (unescape_nonascii): append excape sequence as-is not unescaped character, to get rid of unexpected meta-character. [ruby-core:67193] [Bug #10670] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01re.c: rb_reg_region_copynobu
* re.c (rb_reg_region_copy): new function to try with GC if copy failed and return the error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01re.c: check if onig_region_copy failednobu
* re.c (CHECK_REGION_COPIED): onig_region_copy() can fail when memory exhausted but returns nothing, so check by if allocated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-06* re.c (unescape_nonascii): cast -1 for the case char is unsigned char.naruse
If char is signed char, for example gcc for ARM or ppc64, it caused infinite loop. http://kmuto.jp/build-ruby/arm/ruby-trunk/log/20141106T013005Z.fail.html.gz http://rubyci.blob.core.windows.net/f19p8/ruby-trunk/log/20141106T090217Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-17re.c: mak eregexps with binary escapes ASCII-8BITnobu
* re.c (unescape_nonascii): make dynamically compiled US-ASCII regexps ASCII-8BIT encoding if binary (hexadecimal, control, meta) escapes are contained, as well as literal regexps. [ruby-dev:48626] [Bug #10382] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30get rid of function calls in RSTRING_PTRnobu
* process.c (rlimit_resource_type, rlimit_resource_value): get rid of function calls in RSTRING_PTR(), as it evaluates the argument twice. * re.c (match_backref_number): ditto. * signal.c (esignal_init, rb_f_kill, trap_signm): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30* process.c (rlimit_resource_type, rlimit_resource_value):ktsj
get rid of inadvertent dynamic symbol pin-down. * re.c (match_backref_number): ditto. * signal.c (esignal_init, rb_f_kill, trap_signm): ditto. * transcode.c (econv_opts): ditto. * vm_trace.c (symbol2event_flag): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO usenormal
Using calloc where possible reduces code and binary sizes. * include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement (Data_Make_Struct, TypedData_Make_Struct): ZALLOC replaces ALLOC+memset * compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO * cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO * io.c (rb_io_reopen): ditto * iseq.c (prepare_iseq_build): ditto * parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto * re.c (match_alloc): ditto * variable.c (rb_const_set): ditto * ext/socket/raddrinfo.c (get_addrinfo): ditto * ext/strscan/strscan.c (strscan_s_allocate): ditto * gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-04re.c: consider name encodingnobu
* re.c (match_aref, rb_reg_regsub): consider encoding of captured names, encoding-incompatible should not match. [ruby-dev:48278] [Bug #9903] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-04re.c: reduce new stringsnobu
* re.c (match_aref, rb_reg_regsub): reduce new strings creation for exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-04re.c: fix name with NULnobu
* re.c (match_aref): should not ignore name after NUL byte. [ruby-dev:48275] [Bug #9902] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02encoding.h: constify rb_encodingnobu
* include/ruby/encoding.h: constify `rb_encoding` itself, not only arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-01constify rb_encoding and OnigEncodingnobu
* include/ruby/encoding.h: constify `rb_encoding` arguments. * include/ruby/oniguruma.h: constify `OnigEncoding` arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28string.c: infect match resultnobu
* string.c (rb_pat_search): match result should be infected by the pattern. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28string.c: backref substitutionnobu
* re.c (rb_reg_regsub): allow nil regexp for string matching. * string.c (rb_str_sub_bang, str_gsub): make substitution if replacement string has backref escapes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-27string.c: search by rb_str_indexnobu
* re.c (match_regexp): set regexp for MatchData from string. * re.c (rb_backref_set_string): create MatchData from string and set backref. * string.c (rb_pat_search, rb_str_sub, rb_str_sub_bang, str_gsub), (scan_once, rb_str_scan, rb_str_partition): use rb_str_index instead of rb_reg_search() when pattern is a String. based on the patch by Sam Rawlins <sam.rawlins@gmail.com> [Fixes GH-579] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-27re.c: class name encodingnobu
* re.c (match_inspect): preserve class name encoding by PRIsVALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-27re.c: indentnobu
* re.c (rb_reg_search): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25Stop allocating backref strings within gsub's search loopcharliesome
* internal.h: add prototype for rb_reg_search0 * re.c: rename rb_reg_search to rb_reg_search0, add set_backref_str argument to allow callers to indicate that they don't require the backref string to be allocated * string.c: don't allocate backref str if replacement string is provided Closes GH-578. [Bug #9676] [ruby-core:61682] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-14[DOC] add links to `Object#hash`nobu
add links to `Object#hash` to each #`hash` methods rdocs. [Fixes GH-567] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-13re.c (rb_reg_raise): remove volatilenormal
* re.c (rb_reg_raise): remove volatile Unnecessary since r41597 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-13re.c (rb_reg_regcomp): remove volatilenormal
* re.c (rb_reg_regcomp): remove volatile Unnecessary since r13261 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-20* include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN intoko1
RB_OBJ_WRITE and RB_OBJ_WRITTEN. * array.c, class.c, compile.c, hash.c, internal.h, iseq.c, proc.c, process.c, re.c, string.c, variable.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26* compile.c: Use rb_fstring() to de-duplicate string literals in code. ↵tmm1
[ruby-core:58599] [Bug #9159] [ruby-core:54405] * iseq.c (prepare_iseq_build): De-duplicate iseq labels and source locations. * re.c (rb_reg_initialize): Use rb_fstring() for regex string. * string.c (rb_fstring): Handle non-string and already-fstr arguments. * vm_eval.c (eval_string_with_cref): De-duplicate eval source filename. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26* re.c: [DOC] arguments of Regexp::union receive #to_regexp [Bug #8205]zzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-09re.c: suppress warningnobu
* re.c (rb_memsearch): suppress parentheses warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-25* re.c (rb_reg_to_s): convert closing parenthes to the target encodingnaruse
if it is ASCII incompatible encoding. [ruby-core:56063] [Bug #8650] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-02re.c: use built-in encoding indexesnobu
* internal.h: add EUC-JP and Windows-31J. * re.c (rb_char_to_option_kcode): use built-in encoding indexes in internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e