summaryrefslogtreecommitdiffstats
path: root/string.c
Commit message (Collapse)AuthorAgeFilesLines
* Use rb_isspace for ASCII-incompatible strings.naruse2009-09-151-4/+4
| | | | | | | | | * string.c (rb_str_split_m): use rb_isspace when the string may be ASCII-incompatible. (rb_str_lstrip_bang): ditto. (rb_str_rstrip_bang): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_lstrip_bang): use ascii_isspace(). [ruby-dev:39322]matz2009-09-141-5/+5
| | | | | | | | * string.c (rb_str_rstrip_bang): ditto. * string.c (rb_str_split_m): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_inspect): use rb_enc_mbc_to_codepointnaruse2009-09-141-2/+1
| | | | | | because we already knew char is found and got length. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/st.h (st_hash_func): use st_index_t.nobu2009-09-081-15/+15
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_upto): generate numerical sequence whenmatz2009-08-161-3/+45
| | | | | | characters in both edges are all digits. [ruby-talk:343186] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h: checkko12009-08-121-0/+2
| | | | | | | | | | | | definition of (classes)#=== for case/when optimization. Fix Bug #1376 [ruby-core:23190]. * string.c (Init_String), bignum.c (Init_Bignum), numeric.c (Init_Numeric): define String#===, Symbol#===, Bignum#===, Fixnum#===, Float#=== as same as (classes)#==. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_new_frozen): must not change encoding of frozennobu2009-08-121-3/+4
| | | | | | | shared string. [ruby-dev:39068] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (tr_trans): change condition of singlebyte optimization.naruse2009-08-011-2/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Can't use singlebyte optimization when the replacement is multibyte. ↵naruse2009-07-311-1/+2
| | | | | | | | | [ruby-core:24612] * string.c (tr_trans): can't use singlebyte optimization when the replacement is multibyte. [ruby-core:24612] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_hash_cmp): got rid of overflow.nobu2009-07-181-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Check pos and strlen on Regexp#index(str, pos) [ruby-core:23660]naruse2009-07-141-0/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_hash): documentation fix. a patch frommatz2009-07-011-8/+13
| | | | | | | | | | | | | | Marc-Andre Lafortune. [ruby-core:23943] * object.c (rb_mod_cmp): ditto. * range.c (range_eq): ditto. * string.c (rb_str_partition, rb_str_rpartition): ditto. * struct.c (rb_struct_s_def): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (reg_match_pos): adjust offset based on characters, notmatz2009-06-301-3/+8
| | | | | | | | | | bytes. [ruby-dev:38722] * string.c (rb_str_offset): new function. * string.c (rb_str_index_m): no call to rb_reg_adjust_startpos(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_memsize): added.ko12009-06-161-0/+11
| | | | | | | | | | | | * io.c (rb_io_memsize): added. * regcomp.c (onig_memsize): added. * string.c (rb_str_memsize): added. * transcode.c (rb_transcoding_memsize, rb_econv_memsize): added. * variable.c (rb_geneic_ivar_memsize): added. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_replace_shared): shared target must be frozen.nobu2009-06-111-2/+9
| | | | | | | [ruby-core:23727] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_gsub_bang): modify check at the beginning.matz2009-06-021-6/+10
| | | | | | | | | | | | | | [ruby-core:23662] ref [ruby-core:23657] * string.c (rb_str_rstrip_bang): ditto. [ruby-core:23657] * string.c (rb_str_chop_bang): ditto. * string.c (rb_str_chomp_bang): ditto. * string.c (rb_str_reverse_bang): modify check added. [ruby-core:23671] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_each_char, rb_str_each_codepoint): stringnobu2009-05-251-2/+3
| | | | | | | length must be long. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_hash): avoid calling rb_enc_str_asciionly_p().matz2009-05-251-24/+31
| | | | | | | | | | * string.c (rb_str_replace): avoid redundant calling rb_str_new4(). * string.c (str_replace): factor out replacement from rb_str_replace() without type check nor discarding the destination contents. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_rpartition): ditto.nobu2009-05-241-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_partition): should use the converted result. anobu2009-05-241-0/+1
| | | | | | | patch from Marc-Andre Lafortune at [ruby-core:23540]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_each_char): return original string.matz2009-05-231-2/+5
| | | | | | | | | [ruby-core:23499] * string.c (rb_str_each_codepoint): protect string from modification. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_count): optimized for 1byte string count bymatz2009-05-211-6/+18
| | | | | | avoiding tr_setup_table(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_fast_mbclen): faster mbclen for strings knownmatz2009-05-201-25/+68
| | | | | | | | | | | | | | | to be valid. * string.c (enc_strlen): coderange specified version of rb_enc_strlen(). use rb_enc_fast_mbclen() if coderange is 7bit or valid. * string.c (str_gsub): use rb_enc_fast_mbclen(). * string.c (rb_str_reverse, rb_str_split_m, rb_str_each_char, scan_once): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_codepoint_len): combine rb_enc_codepoint()matz2009-05-191-40/+42
| | | | | | | | | | | | | | | | | | | and rb_enc_codelen() in one function to reduce calls. * encoding.c (rb_enc_codepoint): compatibility function. * sprintf.c (rb_str_format): use rb_enc_codepoint_len(). * string.c (rb_str_inspect, rb_str_upcase_bang, rb_str_downcase_bang, rb_str_capitalize_bang, rb_str_swapcase_bang, trnext, tr_trans, rb_str_delete_bang, rb_str_squeeze_bang, rb_str_count, rb_str_split_m, rb_str_each_line, rb_str_each_codepoint, rb_str_lstrip_bang, sym_printable): ditto. * transcode.c (make_econv_exception): use rb_enc_mbc_to_codepoint() git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2009-05-091-2/+11
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c, include/ruby/encoding.h: fixed types.nobu2009-05-071-21/+22
| | | | | | | * include/ruby/encoding.h (rb_enc_nth): long is used for index. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_split_m): faster processing on 7bit strings.matz2009-04-201-9/+53
| | | | | | * string.c (ascii_isspace): faster isspace() for 7bit strings. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_dump): buffer length plus one byte for nullmame2009-04-081-1/+1
| | | | | | | | | terminator. [ruby-dev:38294] * test/ruby/test_m17n.rb (test_str_dump): add a test for above. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_rstrip_bang): should not sign-expand non-ascii.nobu2009-04-081-1/+2
| | | | | | | [ruby-core:23158] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_chop_bang): reset coderange. [ruby-core:23155]naruse2009-04-081-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,nobu2009-03-171-3/+3
| | | | | | | | string.c, util.c, variable.c: use strlcpy, memcpy and snprintf instead of strcpy, strncpy and sprintf. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_hash_uint, rb_hash_start, rb_hash_end): use VALUEnobu2009-03-151-24/+36
| | | | | | | rather than unsigned int. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_subpat): accept capture name.akr2009-03-141-9/+15
| | | | | | | | | | | | | | | | | | | (rb_str_aref): follow above change. (rb_str_aref_m): pass the 2nd argument to rb_str_subpat. (rb_str_subpat_set): accept capture name. (rb_str_aset): follow above change. (rb_str_partition): ditto. (rb_str_aset_m): pass the 2nd argument to rb_str_subpat_set. * include/ruby/intern.h (rb_reg_backref_number): declared. * re.c (rb_reg_backref_number): defined. [ruby-core:21057] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,nobu2009-03-121-7/+7
| | | | | | | | | | numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c, transcode_data.h, util.c, variable.c, vm_dump.c, include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c: suppress VC type warnings. [ruby-core:22726] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,nobu2009-03-101-1/+1
| | | | | | | missing/crypt.c, missing/vsnprintf.c, : suppress warnings. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_eql): extracted from rb_str_equal and rb_str_eql.nobu2009-03-051-17/+14
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_chomp_bang): keeps 7bit coderange.nobu2009-03-051-1/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_each_line): constified.nobu2009-02-251-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_force_encoding): should clear coderange at changingnobu2009-02-251-0/+1
| | | | | | | encoding. [ruby-core:22437] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_chomp_bang): coderange may change.nobu2009-02-241-1/+1
| | | | | | | [ruby-core:22414] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_delete_bang): should recalculate coderange.nobu2009-02-241-2/+10
| | | | | | | [ruby-talk:329267] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* stripped trailing spaces.nobu2009-02-221-202/+202
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (tr_trans): should recalculate coderange.nobu2009-02-221-2/+13
| | | | | | | [ruby-core:22326] (reopened at [ruby-core:22328]) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (tr_trans): should not be affected by the encoding ofnobu2009-02-221-6/+19
| | | | | | | replacement unless actually modified. [ruby-talk:328967] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_resurrect), string.c (rb_str_resurrect): newnobu2009-02-181-0/+5
| | | | | | | | | | | functions based on [ruby-dev:37983] * insns.def (putstring, duparray): use rb_{ary,str}_resurrect(). * iseq.c (iseq_data_to_ary): needs to result TS_VALUE. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_shared_replace): no need fornobu2009-02-171-11/+16
| | | | | | | str_make_independent. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),mame2009-02-141-3/+55
| | | | | | | | | | | | include/ruby/intern.h: add Murmurhash API. [ruby-dev:37784] * complex.c (nucomp_hash), array.c (rb_ary_hash), time.c (time_hash), string.c (rb_str_hsah), object.c (rb_obj_hash), range.c (range_hash), struct.c (rb_struct_hash), hash.c (rb_any_hash), rational.c (nurat_hash): use Murmurhash. [ruby-dev:37784] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_external_str_new_with_enc): change evaluatioin ordernaruse2009-02-131-2/+2
| | | | | | for speed. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (compile_array_, defined_expr, iseq_compile_each): hidenobu2009-02-121-8/+10
| | | | | | | | | | | | | | and freeze internal literal objects, to prevent from modifying. [ruby-dev:37959] * iseq.c (insn_operand_intern): copy internal literal objects. * insns.def (putstring, duparray): ditto. * string.c (rb_str_replace): exported. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_each_codepoint): update RDoc formatz2009-02-051-1/+1
| | | | | | | String#codepoints. a patch from Radoslaw Bulat in [ruby-core:21835] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e