aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
Commit message (Collapse)AuthorAgeFilesLines
* string.c: Symbol#matchnobu2016-02-181-2/+14
| | | | | | | * string.c (sym_match_m): delegate to String#match but not String#=~. [ruby-core:72864] [Bug #11991] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: fix rb_str_initnobu2016-02-171-19/+29
| | | | | | | * string.c (rb_str_init): fix segfault and memory leak, consider wide char encoding terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Additional fix and tests for r53851naruse2016-02-171-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove unnecessary declaration so that rdoc worksnobu2016-02-171-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix rubyspec error from r53850naruse2016-02-171-0/+4
| | | | | | http://rubyci.s3.amazonaws.com/tk2-243-31075/ruby-trunk/log/20160217T061402Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_init): introduce String.new(capacity: size)naruse2016-02-171-6/+45
| | | | | | [Feature #12024] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c, enc/unicode.c: Disassociating ONIGENC_CASE_FOLD flag fromduerst2016-02-081-1/+1
| | | | | | | | ONIGENC_CASE_DOWNCASE. (with Kimihito Matsui) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: remove magic numbernobu2016-02-081-2/+3
| | | | | | | * string.c (rb_str_dump): share same string literal instead of a magic number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: use encoding indexnobu2016-02-081-8/+10
| | | | | | | * string.c (rb_external_str_with_enc, rb_str_concat, rb_str_dump): use encoding index as shortcut without rb_encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fstring_enc_newnobu2016-02-041-0/+14
| | | | | | | | * 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
* * string.c (str_new_frozen): if the given string is embeddedablenaruse2016-02-031-0/+7
| | | | | | but not embedded, embed a new copied string. [Bug #11946] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c: Introduce RREGEXP_PTR.naruse2016-02-021-1/+1
| | | | | | | | | | | | | | | | | 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
* RUBY_ASSERTnobu2016-01-221-1/+1
| | | | | | | * error.c (rb_assert_failure): assertion with stack dump. * ruby_assert.h (RUBY_ASSERT): new header for the assertion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: fix a typo. [fix GH-1202][ci skip] Patch by @sunboshanhsbt2016-01-181-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: Any kind of option is now taking the new code path forduerst2016-01-171-4/+4
| | | | | | | | | | upcase/downcase/capitalize/swapcase. :lithuanian can be used for testing if no specific option is desired. * test/ruby/enc/test_case_mapping.rb: Adjusted to above. (with Kimihito Matsui) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enc/unicode.c: Removed artificial expansion for Turkic,duerst2016-01-171-15/+27
| | | | | | | | | | | added hand-coded support for Turkic, fixed logic for swapcase. * string.c: Made use of new case mapping code possible from upcase, capitalize, and swapcase (with :lithuanian as a guard). * test/ruby/enc/test_case_mapping.rb: Adjusted for above. (with Kimihito Matsui) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enc/unicode.c: Artificial mapping to test buffer expansion code.duerst2016-01-161-1/+11
| | | | | | | | | * string.c: Fixed buffer expansion logic. * test/ruby/enc/test_case_mapping.rb: Tests for above. (with Kimihito Matsui) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enc/unicode.c: fix implicit conversion error with clang. fixup r53548.hsbt2016-01-161-1/+1
| | | | | | * string.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * remove trailing spaces.svn2016-01-161-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c, enc/unicode.c: New code path as a preparation for Unicode-wideduerst2016-01-161-8/+80
| | | | | | | | | case mapping. The code path is currently guarded by the :lithuanian option to avoid accidental problems in daily use. * test/ruby/enc/test_case_mapping.rb: Test for above. * string.c: function 'check_case_options': fixed logical errors git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: made a variable name more grammatically correctduerst2016-01-121-18/+18
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: minor grammar fix [ci skip]duerst2016-01-121-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * remove trailing spaces.svn2016-01-121-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: Added option parsing/checking for upcase/downcase/duerst2016-01-121-36/+93
| | | | | | capitalize/swapcase (with Kimihito Matsui git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix rdoc for String#rstrip!, lstrip! [ci skip]nobu2015-12-271-2/+4
| | | | | | | | * string.c (rb_str_lstrip_bang, rb_str_rstrip_bang): [DOC] Fix ruby-doc comments for String#rstrip! and lstrip!. It looks like dropped bang. [Fix GH-1175] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: Fix document. Default value of the firstyui-knk2015-12-231-3/+3
| | | | | | | | argument of `String#split` is not `$;` but `nil`. When `nil` is passed as first argument, `$;` is used. [ci skip] [Bug #11729] [ruby-dev:49378] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: no exception on dummy encodingnobu2015-12-221-10/+3
| | | | | | | * string.c (str_compat_and_valid): as scrub does nothing for dummy encoding string now, incompatible encoding is not a matter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: infectionnobu2015-12-171-10/+13
| | | | | | | * string.c (rb_str_scrub): the result should be infected by the original string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: radix indicators [ci skip]nobu2015-12-151-0/+3
| | | | | | | * string.c (rb_str_oct): [DOC] mention radix indicators. [ruby-core:71310] [Bug #11648] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: fix a typo in documentation.hsbt2015-12-141-1/+1
| | | | | | | | | | | | [ci skip][fix GH-1140] Patch by @jutaz * io.c: ditto. * iseq.c: ditto. * numeric.c: ditto. * process.c: ditto. * string.c: ditto. * vm_trace.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * object.c (rb_inspect): dump inspected result with rb_str_escape()naruse2015-12-101-0/+64
| | | | | | | | | | instead of raising Encoding::CompatibilityError. [Feature #11801] * string.c (rb_str_escape): added to dump given string like rb_str_inspect without quotes and always dump in US-ASCII like rb_str_dump. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: use rb_id_encodingnobu2015-12-081-1/+1
| | | | | | | * string.c (rb_str_init): rb_id_encoding() returns same ID with caching. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_init): now accepts new option parameter `encoding'.usa2015-12-081-2/+19
| | | | | | | [Feature #11785] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: removed unused variableduerst2015-12-081-5/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: introduce String#+@ and String#-@ to controlko12015-12-071-0/+42
| | | | | | | | | | String mutability. [Feature #11782] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: should not taint fstringnobu2015-12-041-1/+3
| | | | | | | | * string.c (rb_obj_as_string): fstring should not be infected. re-apply r52872 and fix a typo. TODO: other frozen strings also may not be. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert r52872 "string.c: should not taint fstring"naruse2015-12-041-3/+1
| | | | | | This reverts commit b887c7c20ab81b50ed7cb8c7db3218c443985d6b. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: should not taint fstringnobu2015-12-031-1/+3
| | | | | | | * string.c (rb_obj_as_string): fstring should not be infected. TODO: other frozen strings also may not be. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: adjust argument qualifiernobu2015-12-021-1/+1
| | | | | | | * string.c (str_make_independent_expand): adjust argument qualifier to get rid of a VC bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: no frozen error at cstrnobu2015-12-011-30/+47
| | | | | | | * string.c (rb_string_value_cstr): should not raise on frozen string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: use predefined IDs for minor bloat reductionnormal2015-11-071-10/+7
| | | | | | | | | | | | | | | | | | | * string.c (id_to_s): remove redundant variable (rb_obj_as_string): trade id_to_s for idTo_s (rb_str_equal): replace rb_intern(...) with pre-defined ID (rb_str_cmp_m): ditto (rb_str_match): ditto (str_upto_each): ditto (rb_str_sum): ditto (Init_String): remove id_to_s initialization This leads to a minor size reduction on my x86 (32-bit) system: text data bss dec hex filename 129373 8 32 129413 1f985 string.o-orig 129082 8 8 129098 1f84a string.o git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_check_str): add for performance.ko12015-10-291-2/+2
| | | | | | | | | | | | | | | | | | | | | This function only accept T_STRING (and T_REGEXP). This patch improves performance of a tiny_segmenter benchmark (num=2) 2.54sec -> 2.42sec on my machine. https://github.com/chezou/TinySegmenter.jl/blob/master/benchmark/benchmark.rb * encoding.c: add ENC_DEBUG and ENC_ASSERT() macros. * internal.h: add a decl. of rb_enc_check_str(). * string.c (rb_str_plus): use rb_enc_check_str(). * string.c (rb_str_subpat_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* RUBY_DTRACE_CREATE_HOOKnobu2015-10-291-13/+4
| | | | | | | | | | * internal.h (RUBY_DTRACE_CREATE_HOOK): macro to call hook at object creation. * vm.c (rb_source_location, rb_source_loc): retrieve source path and line number at once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert r52336 (commit miss)ko12015-10-291-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_mark_ptr): remove debug code for #11244.ko12015-10-291-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: Added method signature to include hash. It's inconsistencyhsbt2015-10-231-0/+1
| | | | | | | with `gsub` method signature. [ci skip][fix GH-1023] Patch by @danielevans git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix backslash [ci skip]nobu2015-10-221-1/+1
| | | | | | | * string.c (rb_str_tr): [DOC] Escape backslash in String#tr documentation. [Fix GH-1063] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: rb_str_cat_conv_enc_optsnobu2015-10-171-14/+54
| | | | | | | | | | * file.c (rb_file_expand_path_internal): concatenate converted string to the result instead of making converted string and append it. * string.c (rb_str_cat_conv_enc_opts): from rb_str_conv_enc_opts, separate function to concatenate with transcoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: proc without envnobu2015-10-151-27/+2
| | | | | | | * proc.c (rb_sym_to_proc): move from string.c and create a Proc with no environments. [ruby-core:71088] [Bug #11594] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * import a github pull requestko12015-10-101-1/+1
| | | | | | | | | | | | | | | | | https://github.com/ruby/ruby/pull/1050 by Kazuho Oku <kazuho@natadeco.co>. This pull request has the following commits. * gc.c: reduce # of args to 6 (max. of register args on x86-64) so that the `newobj_of_slowpass` can be called via TCO. * gc.c (newobj_of), string.c (str_duplicate): for performance, the hot functions must be inlined. * gc.c: for performance, preceding arguments of `.*newobj_of.*` must be same, so that the arg registers can be reused in case of TCO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e