aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* string.c: str_duplicatenobu2015-10-071-22/+18
| | | | | | | * string.c (str_duplicate): move from rb_str_resurrect to short circuit initialization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: fix non-embedded stringnobu2015-10-071-9/+18
| | | | | | | * string.c (rb_str_resurrect): fix resurrection of short enough to be embedded but not embedded string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: optimize String#timesnobu2015-10-071-0/+9
| | | | | | * string.c (rb_str_times): optimize for the argument 0 and 1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: use raw macronobu2015-10-071-1/+1
| | | | | | * string.c (str_new_frozen): use raw macro for RString object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_sym_to_proc): renamenobu2015-10-061-3/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_args.c: wrap symbol ifuncnobu2015-10-061-1/+2
| | | | | | | * vm_args.c (args_setup_block_parameter): wrap a symbol in ifunc by a proc as a block parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: optimize rb_str_resurrectnobu2015-10-051-1/+20
| | | | | | | * string.c (rb_str_resurrect): optimize by short circuit to copy hidden string without checking length, encoding and so on. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_sym_proc_call): constifynobu2015-10-011-2/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c: include symbol namenobu2015-09-301-3/+3
| | | | | | | * proc.c (proc_to_s): include the original symbol name in string form. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: fix performance of strconcatnobu2015-09-291-0/+12
| | | | | | | | | | * compile.c (compile_dstr_fragments): fix performance by omitting the first empty string only for keeping literal encoding if other literals are too. [ruby-core:70930] [Bug #11556] * string.c (rb_str_append_literal): append but keep encoding non US-ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: separate resetting code rangenobu2015-09-201-25/+17
| | | | | | | * string.c (rb_str_setbyte): separate resetting code range by each code range, and remove unnecessary branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: keep coderangenobu2015-09-161-2/+43
| | | | | | * string.c (rb_str_setbyte): keep the code range as possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encindex.h: ENCINDEXnobu2015-09-151-0/+1
| | | | | | * 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
* string.c: move common statementnobu2015-08-221-9/+6
| | | | | | | * string.c (sym_inspect): move common statement and change variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: Fix documentation for String#slicehsbt2015-08-111-1/+1
| | | | | | [ruby-core:70298][Bug #11427] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: [DOC] Make #end_with? example doc symmetryhsbt2015-08-111-0/+6
| | | | | | with #start_with? [fix GH-992][ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: frozen_strings in rb_vm_tnobu2015-08-091-16/+4
| | | | | | | * vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings table in rb_vm_t. [ruby-core:70274] [Bug #11423] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.c: NODE_ALLOCA for ALLOCVnobu2015-08-051-16/+0
| | | | | | | * node.c (rb_alloc_tmp_buffer): use NODE_ALLOCA to mark locations like as builtin alloca. [ruby-core:70251] [Bug #11418] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c: fix for wide character encodingsnobu2015-08-031-6/+1
| | | | | | | * 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
* hash.c: move rb_obj_hashnobu2015-07-291-3/+0
| | | | | | * hash.c (rb_obj_hash): move in order to share with rb_any_hash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e