summaryrefslogtreecommitdiffstats
path: root/string.c
Commit message (Collapse)AuthorAgeFilesLines
* * string.c (rb_str_dump): preserve the encoding of source stringmatz2008-01-181-1/+10
| | | | | | | | if it is ASCII compatible. otherwise, add '.force_encoding()' for ugly work around. maybe we should implement some other way to keep non ASCII encoding in dumped string. [ruby-dev:33142] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (string.c): call rb_str_buf_append to update encoding ofakr2008-01-111-19/+15
| | | | | | | str1, even if str2 is empty. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_append): performance improvement.nobu2008-01-111-7/+7
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update rdoc: force_encoding doesn't accept nil.akr2008-01-111-2/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_cr_str_buf_cat): fix self appending.akr2008-01-091-3/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_cr_str_buf_cat, rb_str_buf_append): deal with selfnobu2008-01-091-5/+7
| | | | | | | appending. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_cr_str_buf_cat): do not recalculate coderangematz2008-01-091-2/+4
| | | | | | value if it's given from outside. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_gsub): avoid appending empty pre-match substr.akr2008-01-081-1/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_buf_append): fix append itself.akr2008-01-071-1/+7
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (STR_ENC_GET): defined. same as rb_enc_get withoutakr2008-01-071-99/+76
| | | | | | | | | | | | | | | | enc_capable. (coderange_scan): ASCII-8BIT test refined. (rb_enc_cr_str_buf_cat): new internal function to accumulate strings with encoding. (rb_enc_str_buf_cat): use rb_enc_cr_str_buf_cat. (rb_str_buf_append): ditto (str_gsub): use rb_str_buf_append. (rb_str_hash): use ENCODING_GET. (rb_str_comparable): ditto. (rb_str_cmp): compare encoding index, not rb_encoding address. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (Init_String): sym_match arity spec was wrong. a patchmatz2008-01-071-1/+1
| | | | | | from Hiroyuki Iwatsuki <don at na.rim.or.jp> in [ruby-dev:32957]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_gsub): move rb_enc_get(str) to out of loop.akr2008-01-071-4/+6
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_internal_get_index): extracted fromakr2008-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | rb_enc_get_index. (rb_enc_internal_set_index): extracted from rb_enc_associate_index * include/ruby/encoding.h (ENCODING_SET): work over ENCODING_INLINE_MAX. (ENCODING_GET): ditto. (ENCODING_IS_ASCII8BIT): defined. (ENCODING_CODERANGE_SET): defined. * re.c (rb_reg_fixed_encoding_p): use ENCODING_IS_ASCII8BIT. * string.c (rb_enc_str_buf_cat): use ENCODING_IS_ASCII8BIT. * parse.y (reg_fragment_setenc_gen): use ENCODING_IS_ASCII8BIT. * marshal.c (has_ivars): use ENCODING_IS_ASCII8BIT. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (coderange_scan): avoid rb_enc_to_index.akr2008-01-061-6/+6
| | | | | | | | | (rb_enc_str_buf_cat): ditto. (str_cat_char): use rb_enc_str_buf_cat. (rb_str_inspect): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (coderange_scan): optimize ASCII-8BIT string.akr2008-01-061-5/+26
| | | | | | | (rb_enc_str_buf_cat): don't call coderange_scan if possible. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_enc_str_buf_cat): declared.akr2008-01-061-79/+153
| | | | | | | | | | | | | | | | * string.c (coderange_scan): extracted from rb_enc_str_coderange. (rb_enc_str_coderange): use coderange_scan. (rb_str_shared_replace): copy encoding and coderange. (rb_enc_str_buf_cat): new function for linear complexity string accumulation with encoding. (rb_str_sub_bang): don't conflict substituted part and replacement. (str_gsub): use rb_enc_str_buf_cat. (rb_str_clear): clear coderange. * re.c (rb_reg_regsub): use rb_enc_str_buf_cat. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_resize): copy if old data is not emptynobu2008-01-051-1/+1
| | | | | | | [ruby-core:14785] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_resize): copy at old length but not new length.nobu2008-01-051-1/+1
| | | | | | | [ruby-core:14785] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update rdoc.akr2008-01-051-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (trnext): should enable backslash escape.matz2008-01-041-0/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_substr): offset movement bug. a patch frommatz2008-01-011-2/+2
| | | | | | | Vincent Isambart <vincent.isambart at gmail.com> in [ruby-core:14647]. [ruby-core:14644] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_resize): embeds if ptr is null. [ruby-dev:32819]nobu2007-12-311-4/+16
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (IS_7BIT): removed.akr2007-12-311-19/+35
| | | | | | | | | | | | | | | | | (single_byte_optimizable): new function to test optimizationability using single byte string. (str_strlen): use single_byte_optimizable instead of is_ascii_string. (str_nth): rename argument: asc -> singlebyte. (str_offset): ditto. (rb_str_substr): use single_byte_optimizable instead of IS_7BIT. (rb_str_index): ditto. (rb_str_rindex): ditto. (rb_str_splice): ditto. (rb_str_justify): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typos.akr2007-12-311-4/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update force_encoding document.akr2007-12-301-0/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_regsub): returns the given string itself if nothingnobu2007-12-291-2/+13
| | | | | | | | | | | changed. * string.c (rb_str_sub_bang): keeps code-range as possible. * string.c (str_gsub): adjusts code-range. [ruby-core:14566] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_codelen): show codepoint in error message.akr2007-12-271-3/+0
| | | | | | | | | | * include/ruby/encoding.h (rb_enc_codelen): comment it returns positive integer. * string.c (rb_str_concat): rb_enc_codelen doesn't return 0. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_casecmp): fixed using a wrong variable.nobu2007-12-271-1/+1
| | | | | | | [ruby-list:44402] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (Init_String): defines chars method.nobu2007-12-261-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.h (rb_enc_mbc_to_codepoint): wrapper fornobu2007-12-251-2/+4
| | | | | | | | | ONIGENC_MBC_TO_CODE(). * string.c (rb_str_succ): deal with invalid sequence as binary. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_each_line): don't call rb_enc_codepoint with emptyakr2007-12-251-1/+1
| | | | | | | string. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_inspect): don't call rb_enc_codepoint with emptyakr2007-12-251-1/+2
| | | | | | | | | | string. fix '#'.inspect. * encoding.c (rb_enc_codepoint): raise on empty string. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_succ): fix for string with non-alphanumeric chars.nobu2007-12-251-4/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_enc_left_char_head): new utility macro.matz2007-12-241-3/+2
| | | | | | | | | | | | | * include/ruby/encoding.h (rb_enc_right_char_head): ditto. * io.c (appendline): does multibyte RS search in the function. * io.c (prepare_getline_args): RS may be nil. * io.c (rb_io_getc): should process character based on external encoding, when transcoding required. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_comparable): fixed to keep transitivity.matz2007-12-241-4/+14
| | | | | | [ruby-dev:32693] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (tr_trans): should associate new encoding if modified.matz2007-12-231-2/+5
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_new_shared): was setting embedding flag of wrongmatz2007-12-231-1/+1
| | | | | | string object. [ruby-dev:32685] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_comparable): comparison including brokenmatz2007-12-231-6/+8
| | | | | | coderange strings do not consider encoding. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (sym_call): use exact argument array interface.nobu2007-12-231-6/+4
| | | | | | | [ruby-core:14279] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add rdoc.akr2007-12-221-2/+22
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_buf_append): improvement for non-broken codednobu2007-12-211-0/+12
| | | | | | | strings. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_succ): retry increasing until valid char is found.nobu2007-12-211-3/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_chomp_bang): avoid unnecessary loop usingmatz2007-12-211-6/+2
| | | | | | rb_enc_prev_char(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_is_ascii_only_p): new method ascii_only?.akr2007-12-211-0/+9
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * regerror.c, string.c, io.c, lib/getoptlong.rb, lib/net/imap.rb,akr2007-12-211-1/+1
| | | | | | | | | | | compile.c, sprintf.c, parse.y, ext/win32ole/win32ole.c, ext/tk/sample/demos-en/entry3.rb, ext/tk/lib/tcltk.rb, ext/openssl/ossl_bn.c, numeric.c, vm.c, benchmark/bm_so_meteor_contest.rb, bignum.c, ruby.c: don't "illegal" for non law violation context. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (tr_trans): wrong encoding check for tree strings.matz2007-12-201-4/+8
| | | | | | | * test/ruby/test_m17n.rb (TestM17N::test_tr_s): "invalid mbstring sequence" is not an error to be tested. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_index): wrong starting position.matz2007-12-201-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_each_line): should consider rslen.matz2007-12-191-1/+6
| | | | | | | | | | | | | | * string.c (rb_str_buf_append): should propagate encoding. * string.c (rb_str_each_line): ditto. * test/ruby/test_m17n.rb (TestM17N::test_str_each_line): should check encoding as well. * test/ruby/test_m17n.rb (TestM17N::test_str_each_line): empty array can not propagate encoding; should not check. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_rindex_m): too much adjustment.matz2007-12-191-1/+0
| | | | | | | | | | * re.c (reg_match_pos): pos adjustment should be based on characters. * test/ruby/test_m17n.rb (TestM17N::test_str_insert): test updated to check negative offset behavior. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e