aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
Commit message (Collapse)AuthorAgeFilesLines
* string.c: check before modifynobu2015-04-041-4/+5
| | | | | | | | * string.c (rb_str_setbyte): check the argument first not to discard shared string and code range unnecessarily until actually changing the contents. pointed out by headius. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: add a comment about RSTRING_FSTR.ko12015-03-181-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: introduce STR_FAKESTR to show string is FAKESTR or not.ko12015-03-171-3/+18
| | | | | | | | | * string.c (STR_SET_SHARED): ignore FAKESTR because only Ruby objects can use write barrier. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: smart chompnobu2015-02-241-5/+7
| | | | | | | | * string.c (chompped_length): enable smart chomp for all non-dummy encoding strings, not only default_rs. [ruby-core:68258] [Bug #10893] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: raise a RegexpErrornobu2015-02-231-1/+1
| | | | | | | * string.c (get_pat_quoted): simply raise a RegexpError, TypeError is never raised. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: proper exceptionnobu2015-02-231-2/+2
| | | | | | | | * string.c (rb_str_split_m): raise ArgumentError at broken string not RegexpError, as Regexp is not involved in. [ruby-core:68229] [Bug #10886] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use rb_funcallvnobu2015-02-161-3/+3
| | | | | | | * use rb_funcallv() for no arguments call instead of variadic rb_funcall(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_discard): does not free for STR_NOFREE string.mame2015-02-131-1/+1
| | | | | | | | [Bug #10853][ruby-core:68110] * bootstraptest/test_string.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: [DOC] Specify to_s on subclasses [ci skip]marcandre2015-01-291-1/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2015-01-261-2/+6
| | | | | | * string.c (str_buf_cat): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: use local variablesnobu2015-01-261-7/+14
| | | | | | | * string.c (str_buf_cat): use local variables instead of repeating macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: consider widecharnobu2015-01-261-2/+2
| | | | | | | * string.c (str_make_independent_expand): consider wide char encoding. [Fix GH-821] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: terminate when embeddednobu2015-01-261-0/+1
| | | | | | | * string.c (str_make_independent_expand): terminate String when moved from heap to embedded. [Fix GH-821]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: improve docs for String#<=>. [ruby-core:65399][Feature #10322]ayumin2015-01-041-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: improve docs for String#strip and variations. ↵ayumin2015-01-041-0/+14
| | | | | | [ruby-core:66081][Bug #10476] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: fix coderange for non-endianness stringnobu2014-12-151-2/+9
| | | | | | | | * string.c (rb_enc_str_coderange): dummy wchar, non-endianness encoding string cannot be ascii only. [ruby-core:66835] [Bug #10598] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: reduce intermediate stringnobu2014-12-121-7/+15
| | | | | | | * string.c (rb_str_succ_bang): get rid of making intermediate string object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-121-1/+1
| | | | | | * string.c (rb_str_succ): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: use local variablesnobu2014-12-121-8/+11
| | | | | | | * string.c (rb_str_succ): extract local variables from constant RSTRING_PTR and RSTRING_LEN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: check arguments for cryptnobu2014-12-121-1/+15
| | | | | | | | * string.c (rb_str_crypt): check arguments more strictly. * crypt() is not for wide char strings * salt bytes should not be NUL git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-121-1/+1
| | | | | | * string.c (rb_str_justify): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-121-2/+2
| | | | | | * string.c (tr_trans): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-111-1/+1
| | | | | | * string.c (rb_str_squeeze_bang): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-101-1/+1
| | | | | | * string.c (rb_str_delete_bang): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-101-1/+1
| | | | | | * string.c (rb_str_sub_bang): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-101-2/+2
| | | | | | * string.c (rb_str_splice_0): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-101-1/+1
| | | | | | * string.c (rb_str_chop_bang): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-101-1/+1
| | | | | | * string.c (rb_str_chomp_bang): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-101-2/+6
| | | | | | * string.c (rb_str_times): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: term fillnobu2014-12-101-1/+1
| | | | | | * string.c (rb_str_plus): fill wchar terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: local variablesnobu2014-12-101-20/+30
| | | | | | | * string.c (rb_str_plus, rb_str_splice_0): extract local variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: chompped_length chomp_rsnobu2014-12-101-81/+113
| | | | | | | * string.c (chompped_length, chomp_rs): extract from rb_str_chomp_bang to share with rb_str_chomp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: [DOC] Add missing documentation around String#chomp.hsbt2014-12-091-9/+12
| | | | | | Patchby @stderr [ci skip][fix GH-780] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: fake string is not sharingnobu2014-12-031-1/+1
| | | | | | | * string.c (setup_fake_str): fake string does not share another string, but just should not free. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* intern.h: SIZED_ENUMERATORnobu2014-12-031-1/+1
| | | | | | | | | | * include/ruby/intern.h (SIZED_ENUMERATOR): separate from RETURN_SIZED_ENUMERATOR. * string.c (rb_str_enumerate_chars): get rid of calling rb_block_given_p() twice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: preserve encoding of global variablenobu2014-11-231-1/+1
| | | | | | | * string.c (rb_str_setter): preserve encoding of global variable name in error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Gather declarations in non-header files.akr2014-11-181-3/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: escape a backslash [ci skip]nobu2014-11-161-1/+1
| | | | | | | * string.c (rb_str_count): [DOC] add a backslash to escape a backslash itself. [ruby-core:66321] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Include ruby.h and ruby/encoding.h to beakr2014-11-151-3/+1
| | | | | | | | includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (sym_equal): use rb_obj_equal().ko12014-11-111-7/+1
| | | | | | | | | | | rb_obj_equal() is specially optimized in opt_eq_func()@vm_insnhelper.c. This fix is made from this discussion: https://www.omniref.com/ruby/2.1.4/symbols/Symbol/%3D%3D#line=8361. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: no exception in QUOTEnobu2014-11-061-1/+4
| | | | | | | * string.c (sym_printable): QUOTE() should not raise an exception even on invalid byte sequence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: no terminatornobu2014-11-051-1/+10
| | | | | | | | * string.c (rb_str_{,l,r}strip_bang): rb_str_subseq() will not NUL-terminate the result string, in the future, so it will not be needed in other cases. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: reduce memory copynobu2014-11-051-50/+101
| | | | | | | | * string.c (rb_str_lstrip, rb_str_strip): reduce memory copy by copying necessary part only. * string.c (rb_str_strip_bang, rb_str_strip): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: wchar terminatornobu2014-11-051-9/+10
| | | | | | | * string.c (rb_str_lstrip_bang, rb_str_rstrip_bang): terminate wchar strings with wchar 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: improved comment.duerst2014-10-261-6/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * Avoid undefined behaviors found by gcc -fsanitize=undefined.akr2014-10-171-1/+3
| | | | | | | | | | gcc (Debian 4.9.1-16) 4.9.1 * string.c (rb_str_sum): Avoid undefined behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.c: rename rb_str_dynamic_internnobu2014-10-141-18/+8
| | | | | | | | * iseq.c, marshal.c, string.c: use rb_str_intern instead of rb_str_dynamic_intern. * symbol.c (rb_str_intern): rename rb_str_dynamic_intern. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c (rb_str_intern): remove unnecessary RB_GC_GUARDnormal2014-10-111-2/+1
| | | | | | Incorrectly placed, and no longer needed since r25351 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: fix NOFREEnobu2014-09-291-1/+1
| | | | | | | | * string.c (str_make_independent_expand): drop NOFREE flag after reallocation, static buffer is not pointed anymore. [ruby-core:65317] [Bug #10304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: rb_str_new_staticnobu2014-09-191-5/+72
| | | | | | | | | | * string.c (rb_str_new_static): create string object with static buffer. incorporated from mruby. * string.c (rb_{usascii,utf8,enc}_str_new_static): ditto with encodings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e