aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
Commit message (Collapse)AuthorAgeFilesLines
* * string.c (str_sublen): removed.naruse2008-02-231-12/+6
| | | | | | | * string.c (rb_str_reverse, rb_str_reverse_bang): use single_byte_optimizable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_cr_str_copy_for_substr): renamed fromnaruse2008-02-231-22/+37
| | | | | | | | rb_enc_cr_str_copy. * string.c: use rb_enc_cr_str_copy_for_substr and keep coderange. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * fix missing STR_ENC_GET.naruse2008-02-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * add ascii incompatible case.naruse2008-02-221-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_cr_str_copy): check string's coderange is 7bit ornaruse2008-02-221-2/+11
| | | | | | valid. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_mbclen): return minlen instead of 1 whenakr2008-02-221-7/+6
| | | | | | | | | | | | | | a character is not found properly. * string.c (rb_enc_strlen): round up string length with fixed multibyte encoding such as UTF-32. (rb_enc_strlen_cr): ditto. (rb_str_substr): fix substring with fixed multibyte encoding. (rb_str_justify): check number of characters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_inspect): string of ascii incompatible encodingnaruse2008-02-221-0/+1
| | | | | | should be escaped and returned as US-ASCII encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_substr): copy encoding although empty string.naruse2008-02-221-1/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_times): empty string's coderange is CODERANGE_7BIT.naruse2008-02-211-3/+7
| | | | | | | | | * string.c (rb_str_substr): ditto. * encoding.c (rb_enc_compatible): empty string is compatible with not only nonasciicompatible strings. [ruby-dev:33895] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: replace rb_enc_copy by rb_enc_cr_str_copy ornaruse2008-02-211-21/+29
| | | | | | rb_enc_cr_str_exact_copy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_str_copy): added for wrapper for rb_enc_copy.naruse2008-02-201-4/+19
| | | | | | | | | | | | | | this also copy coderange when ptr and len is equal. * string.c (rb_enc_cr_str_copy): added for wrapper for rb_enc_copy. this always copy coderange. * string.c (str_replace_shared): use rb_enc_str_copy. * string.c (str_new3): don't rb_enc_copy because encoding is copied at str_replace_shared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_strlen_cr): get length with coderange scan.naruse2008-02-191-2/+59
| | | | | | * string.c (str_strlen): use rb_enc_strlen_cr. [ruby-dev:33849] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_each_line): fix newline size.akr2008-02-181-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (ENC_CODERANGE_AND): fix broken case. [ruby-dev:33826]naruse2008-02-171-1/+4
| | | | | | * string.c (rb_str_times): fix broken case. [ruby-dev:33826] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (ENC_CODERANGE_AND): added.naruse2008-02-171-2/+3
| | | | | | | | * string.c (rb_str_plus, srb_str_times): keep coderange. * parse.y (STR_NEW0) use rb_usascii_str_new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_strlen): rb_enc_strlen doesn't fail.akr2008-02-171-8/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_sublen): use rb_enc_strlen.akr2008-02-171-11/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_times): reduce loop overhead.akr2008-02-171-4/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/re.h (struct rmatch_offset): new struct for characterakr2008-02-161-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | offsets. (struct rmatch): new struct. (struct RMatch): reference struct rmatch. (RMATCH_REGS): new macro. * re.c (match_alloc): initialize struct rmatch. (pair_byte_cmp): new function. (update_char_offset): update character offsets. (match_init_copy): copy regexp and character offsets. (match_sublen): removed. (match_offset): use update_char_offset. (match_begin): ditto. (match_end): ditto. (rb_reg_search): make character offset updated flag false. (match_size): use RMATCH_REGS. (match_backref_number): ditto. (rb_reg_nth_defined): ditto. (rb_reg_nth_match): ditto. (rb_reg_match_pre): ditto. (rb_reg_match_post): ditto. (rb_reg_match_last): ditto. (match_array): ditto. (match_aref): ditto. (match_values_at): ditto. (match_inspect): ditto. * string.c (rb_str_subpat_set): use RMATCH_REGS. (rb_str_sub_bang): ditto. (str_gsub): ditto. (rb_str_split_m): ditto. (scan_once): ditto. * gc.c (obj_free): free character offsets. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_substr): optimized for UTF-8.naruse2008-02-161-0/+59
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_strlen): revert r15507. [ruby-dev:33810]naruse2008-02-161-3/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_strlen): little more optimize.naruse2008-02-161-9/+11
| | | | | | (rb_enc_nth): remove needless variable 'c'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_compatible): empty strings are always compatible.akr2008-02-161-1/+7
| | | | | | | * string.c (rb_enc_cr_str_buf_cat): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_strlen): UTF-8 character count moved to str_strlen.akr2008-02-161-29/+32
| | | | | | | | (str_strlen): UTF-8 character count is only applicable for valid UTF-8 string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_sub_bang): stringize replacing hash values.akr2008-02-161-14/+20
| | | | | | | (str_gsub): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_strlen): add search_nonascii like characternaruse2008-02-161-0/+29
| | | | | | counter for UTF-8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_strlen): moved to string.c.akr2008-02-161-9/+33
| | | | | | | | | * string.c (rb_enc_strlen): use search_nonascii. (str_strlen): don't use search_nonascii. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (single_byte_optimizable): rb_enc_mbminlen must be 1naruse2008-02-151-1/+1
| | | | | | | when rb_enc_mbmaxlen is 1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_nth): moved to string.c.akr2008-02-151-8/+45
| | | | | | | | | | | * string.c (rb_enc_nth): moved from string.c. use search_nonascii for ASCII compatible string. (str_nth): wrong optimization removed to fix "a".force_encoding("EUC-JP").slice!(0,10) returns "a\x00\x00\x00\x00\x00\x00\x00\x00\x00" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_sub_bang, str_gsub): allows hash for replacement.nobu2008-02-151-4/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_strlen): use search_nonascii() for performance.matz2008-02-151-9/+26
| | | | | | * string.c (str_nth): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_getbyte): new method.akr2008-02-151-0/+45
| | | | | | | (rb_str_setbyte): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_hash_cmp): lighter version of rb_str_cmp() formatz2008-02-121-1/+14
| | | | | | | | | | | hash comparison function. * hash.c (rb_any_cmp): use rb_str_hash_cmp(). * string.c (rb_str_casecmp): should return nil for incompatible comparison. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * range.c (range_include): specialize single character stringmatz2008-02-111-9/+22
| | | | | | | | | | | | | | | | | | | | | | case (e.g. (?a ..?z).include(?x)) for performance. [ruby-core:15481] * string.c (rb_str_upto): specialize single character case. * string.c (rb_str_hash): omit coderange scan for performance. * object.c (rb_check_to_integer): check Fixnum first. * object.c (rb_to_integer): ditto. * string.c (rb_str_equal): inline memcmp to avoid unnecessary rb_str_comparable(). * parse.y (rb_intern2): use US-ASCII encoding. * parse.y (rb_intern_str): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_new4): copy encoding from orig, instead of sharedakr2008-02-091-0/+1
| | | | | | | one. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_replace): makes frozen shared string beforenobu2008-02-071-1/+1
| | | | | | | sharing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_dup): reverted unneeded change. [ruby-dev:33634]nobu2008-02-071-1/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_replace_shared): replaces string with sharing.nobu2008-02-071-31/+51
| | | | | | | | | | | * string.c (rb_str_new4, rb_str_associate, rb_str_associated): allows associated strings shared. * string.c (rb_str_dup, rb_str_substr, rb_str_replace): shares memory. [ruby-core:15400] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_end_with): compares with the suffix.nobu2008-02-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_succ): use wrapped character as a carry forakr2008-01-301-0/+4
| | | | | | | ASCII incompatible encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c, parse.y, re.c: use rb_ascii8bit_encoding.naruse2008-01-281-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/oniguruma.h: precise mbclen API redesigned to avoidakr2008-01-271-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | inline functions. (onigenc_mbclen_charfound): removed. (onigenc_mbclen_needmore): removed. (onigenc_mbclen_recover): removed. (ONIGENC_MBCLEN_CHARFOUND): removed. (ONIGENC_MBCLEN_CHARFOUND_P): defined. (ONIGENC_MBCLEN_CHARFOUND_LEN): defined. (ONIGENC_MBCLEN_INVALID): removed. (ONIGENC_MBCLEN_INVALID_P): defined. (ONIGENC_MBCLEN_NEEDMORE): removed. (ONIGENC_MBCLEN_NEEDMORE_P): defined. (ONIGENC_MBCLEN_NEEDMORE_LEN): defined. (ONIGENC_MBC_ENC_LEN): use onigenc_mbclen_approximate. * regenc.c (onigenc_mbclen_approximate): defined. * include/ruby/encoding.h (MBCLEN_CHARFOUND): removed. (MBCLEN_INVALID): removed. (MBCLEN_NEEDMORE): removed. (MBCLEN_CHARFOUND_P): defined. (MBCLEN_INVALID_P): defined. (MBCLEN_NEEDMORE_P): defined. (MBCLEN_CHARFOUND_LEN): defined. (MBCLEN_NEEDMORE_LEN): defined. * encoding.c: use new API. * re.c: ditto. * string.c: ditto. * parse.y: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_inspect): avoid exception byakr2008-01-271-3/+5
| | | | | | | "\#\xa1".force_encoding("euc-jp").inspect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_succ): warning suppressed.akr2008-01-271-34/+18
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_succ): don't increment/decrement codepoint.akr2008-01-271-86/+159
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT whennaruse2008-01-261-1/+1
| | | | | | | empty string (len == 0). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_usascii_new{,2}: defined.naruse2008-01-251-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when empty string. * encoding.c (rb_usascii_encoding, rb_usascii_encindex): defined. (rb_enc_inspect, enc_name, rb_locale_charmap, rb_enc_name_list_i): use rb_str_ascii_new. * array.c (recursive_join, inspect_ary): ditto. * object.c (nil_to_s, nil_inspect, true_to_s, false_to_s, rb_mod_to_s): ditto. * hash.c (inspect_hash, rb_hash_inspect, rb_f_getenv, env_fetch, env_clear, env_to_s, env_inspect): ditto. * numeric.c (flo_to_s, int_chr, rb_fix2str): ditto. * bignum.c (rb_big2str): ditto. * file.c (rb_file_ftype, rb_file_s_dirname, rb_file_s_extname, file_inspect_join, Init_file): ditto. * test/ruby/test_ruby_m17n.rb: add checks for encoding of string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_buf_cat_ascii): use rb_enc_cr_str_buf_cat.akr2008-01-251-20/+24
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_str_buf_cat_ascii): declared.akr2008-01-251-0/+20
| | | | | | | | | | * string.c (rb_str_buf_cat_ascii): defined. * re.c (rb_reg_s_union): use rb_str_buf_cat_ascii to support ASCII incompatible encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_cr_str_buf_cat): ASCII incompatible encoding isakr2008-01-241-1/+7
| | | | | | | not compatible with any other encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e