aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* string.c: UTF-8 string functionnobu2014-09-181-0/+17
| | | | | | | * string.c (rb_utf8_str_new, rb_utf8_str_new_cstr): make UTF-8 string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c (Init_frozen_strings): use st_init_table_with_sizenormal2014-09-111-1/+1
| | | | | | | All symbols have an fstring entry, and we initialize symbol tables with 1000 bins. This reduces resizes during startup. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (sym_find): remove Symbol.find because we have Symbol GC now.naruse2014-09-111-15/+0
| | | | | | | | | | https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20140904Japan If you still want this, request again on Redmine. [Feature #7854] https://bugs.ruby-lang.org/issues/7854 * ext/-test-/symbol/init.c (sym_find): moved from string.c for tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: remove vm_core.h dependency [ruby-core:64627]normal2014-08-291-7/+15
| | | | | | | * string.c: revert part of r47311, add rb_vm_fstring_table(), remove vm_core.h dependency. [ruby-core:64627] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: move frozen_strings table to rb_vm_tnormal2014-08-291-9/+13
| | | | | | | | | | | | | | | | | Cleanup in case MVM development proceeds. * string.c: remove static frozen_strings * string.c (Init_frozen_strings): new function * string.c (rb_fstring): remove check for frozen strings, use per-VM table * string.c (rb_str_free): use per-VM table * string.c (Init_String): use per-VM table * vm_core.h (rb_vm_t): add frozen_strings table * internal.h (Init_frozen_strings): new function prototype * eval.c (ruby_setup): call Init_frozen_strings [Feature #10182] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_fstring): fix condition (easy to cause infinite loop!).ko12014-08-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_fstring, fstr_update_callback): simply delete garbageko12014-08-221-5/+10
| | | | | | | | | | | | | | key first. Garbage keys can be swept by lazy sweeping invoked by creating new fstring. So that simply do: (1) delete garbage key and return `fstr_update_callback' immediately (2) try again `fstr_update_callback()' to create a new fstr. This bug can be cause memory corruption, reported by http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20140821T220302Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: rb_setup_fake_strnobu2014-08-161-0/+6
| | | | | | | * string.c (rb_setup_fake_str): setup fake string from C pointer, length, and encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (setup_fake_str): fake strings should not set class byko12014-08-151-1/+1
| | | | | | | | | | | | RBASIC_SET_CLASS() because it insert write barriers to fake (non-RVALUE) structure. It can cause unexpected behaviour. Ruby 2.1 also have a same problem (setup_fake_str() in parse.y). * symbol.c (setup_fake_str): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: rb_to_symbolnobu2014-07-301-8/+23
| | | | | | | * string.c (rb_to_symbol): new function to convert an object to a symbol. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: simplifynobu2014-07-221-8/+15
| | | | | | | * string.c (rb_str_count): move code for the first argument outside loop for the rest, as it is executed only once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: raise at invalid byte sequencenobu2014-07-221-3/+5
| | | | | | | | * string.c (rb_str_count): raise at invalid byte sequence argument even if single-byte optimization is effective. [ruby-dev:48442] [Bug #10078] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: fix wrong single-byte optimizationnobu2014-07-221-2/+4
| | | | | | | | * string.c (rb_str_count): fix wrong single-byte optimization. 7bit ascii can be a trailing byte in Shift_JIS. [ruby-dev:48442] [Bug #10078] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: [DOC] teach rdoc symbol.c.ktsj2014-07-191-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y: change Symbol <-> ID relationship to avoidko12014-07-091-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | exposing IDs from collectable symbols. [Bug #10014] Now, rb_check_id() returns 0 if corresponding symbol is pinned dynamic symbol. There is remaining intern_cstr_without_pindown(), it can return IDs from collectable symbols. We must be careful to use it (only used in parse.y). I think it should be removed if it does not have impact for performance. * parse.y: add: * STATIC_SYM2ID() * STATIC_ID2SYM() rename: * rb_pin_dynamic_symbol() -> dsymbol_pindown() * internal.h: remove: * rb_check_id_without_pindown() * rb_sym2id_without_pindown() add: * rb_check_symbol() * rb_check_symbol_cstr() * load.c: use rb_check_id() or rb_check_id_cstr(). * object.c: ditto. * struct.c: ditto. * thread.c: ditto. * vm_method.c: ditto. * string.c (sym_find): use only rb_check_symbol(). * sprintf.c (rb_str_format): use rb_check_symbol_cstr(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: do not use garbage objectnobu2014-07-061-3/+3
| | | | | | | * string.c (fstr_update_callback): should not access garbage object contents, copy from the argument instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (fstr_update_callback): do not use rb_gc_resurrect()ko12014-07-061-12/+19
| | | | | | | | | | any more. Make new frozen string and replace with garbage frozen string. * common.mk: use gc.h from string.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: rb_fstring_new assumes US-ASCIInobu2014-07-041-3/+4
| | | | | | | * string.c (rb_fstring_new): make US-ASCII string. another function may be used for non-ASCII strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: rb_fstring_newnobu2014-06-301-0/+21
| | | | | | | * string.c (rb_fstring_new): create fstring from pointer and length. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: no copy of interned stringsnobu2014-06-161-5/+5
| | | | | | | * string.c (sym_succ, sym_cmp, sym_casecmp, sym_match, sym_aref): not need to make copy of interned strings, use directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: fix wrong capanobu2014-06-141-2/+4
| | | | | | | | * string.c (rb_str_resize): update capa only when buffer get reallocated. http://d.hatena.ne.jp/nagachika/20140613/ruby_trunk_changes_46413_46420#r46413 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: consider capacitynobu2014-06-121-1/+1
| | | | | | | * string.c (rb_str_resize): should consider the capacity instead of the old length, as pointed out by nagachika. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: shrink before freezingnobu2014-06-121-0/+2
| | | | | | | * string.c (rb_str_freeze): shrink the buffer before freezing, as pointed out by Eric Wong at [ruby-core:63119]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: shrink too big buffernobu2014-06-121-1/+4
| | | | | | | * string.c (rb_str_resize): shrink the buffer even if new length is same but it is enough smaller than the capacity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: update rdoc of rb_str_slice_bang()nobu2014-06-071-1/+1
| | | | | | | * string.c (rb_str_slice_bang): [DOC] update return value against a fixnum, which has changed because of M17N. [fix GH-631] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.h: constify rb_encodingnobu2014-06-021-13/+13
| | | | | | | * 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
* constify rb_encoding and OnigEncodingnobu2014-06-011-13/+13
| | | | | | | * 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
* string.c: reset code rangenobu2014-05-301-1/+1
| | | | | | | | * string.c (rb_str_substr): need to reset code range for shared string too, not only copied string. [ruby-core:62842] [Bug #9882] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: byte offsetnobu2014-05-191-5/+7
| | | | | | | * string.c (rb_pat_search): advance by byte offset but not by char offset. [ruby-core:62669] [Bug #9849] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: constifynobu2014-05-191-2/+2
| | | | | | * string.c (rb_str_index): constify local pointer variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_coderange_scan_restartable): coderange is alwaysnaruse2014-04-211-3/+4
| | | | | | | ENC_CODERANGE_VALID if the string is ASCII-8BIT and already has a non ASCII character. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (coderange_scan): remove useless condtion `p < e` afternaruse2014-04-211-33/+17
| | | | | | | | search_nonascii. * string.c (rb_str_coderange_scan_restartable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (coderange_scan): remove unused logic.naruse2014-04-211-8/+2
| | | | | | * string.c (rb_str_coderange_scan_restartable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: rename rb_str_splice as rb_str_updatenobu2014-04-211-7/+3
| | | | | | | * string.c (rb_str_update): rename rb_str_splice as exported name rb_str_update, and make the former an alias macro of the latter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: SHARABLE_SUBSTRING_Pnobu2014-04-181-3/+9
| | | | | | | | | * string.c (SHARABLE_SUBSTRING_P): predicate if substring can be shared with the original string. true if just at the end of the original string, for the time being. all substring will be able to be shared in the future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: share middle of a stringnobu2014-04-181-11/+15
| | | | | | | | | * string.c (rb_str_new_frozen): consider the shared string at middle. * string.c (rb_str_subseq, rb_str_substr, str_byte_substr): share middle of a string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: revert r45622nobu2014-04-181-4/+1
| | | | | | | * string.c (str_buf_cat): revert r45622. broken data can be added later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: r45621nobu2014-04-181-1/+1
| | | | | | | * string.c (str_buf_cat): revert r45621. this function does not scan appended data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: don't clear coderange at expandingnobu2014-04-181-1/+4
| | | | | | | * string.c (rb_str_modify_expand): like as str_modify_keep_cr, don't clear coderange unless broken. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: keep code rangenobu2014-04-181-1/+1
| | | | | | * string.c (str_buf_cat): keep code range if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: use uintptr_t instead of VALUE because they are not rubynaruse2014-04-181-23/+23
| | | | | | object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: check str_strlen's argument, and add comment ornaruse2014-04-181-24/+21
| | | | | | use NULL if simply it uses str's enc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_strlen): use enc_strlen if the coderange is known.naruse2014-04-181-6/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (enc_strlen): move UTF-8 optimization from str_strlen tonaruse2014-04-181-61/+61
| | | | | | enc_strlen. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: argument checknobu2014-04-171-6/+11
| | | | | | | * string.c (rb_str_cat_cstr): check the argument as other `_cstr` functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: rb_str_cat_cstrnobu2014-04-171-4/+7
| | | | | | | | * string.c (rb_str_cat): make non-buf version main. * string.c (rb_str_cat_cstr): rename from rb_str_cat2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: alias of rb_str_buf_cat and rb_str_buf_cat2nobu2014-04-171-11/+2
| | | | | | | * string.c (rb_str_cat, rb_str_cat2): make aliases of rb_str_buf_cat and rb_str_buf_cat2 respectively. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: reduce duplicated codenobu2014-04-171-5/+1
| | | | | | | * string.c (rb_str_cat, rb_str_cat2): reduce duplicated code, they are same as rb_str_buf_cat and rb_str_buf_cat2 respectively now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: reduce function callsnobu2014-04-141-4/+6
| | | | | | | * string.c (rb_enc_cr_str_buf_cat): reduce invariant function calls of rb_enc_from_index. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e