aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
Commit message (Collapse)AuthorAgeFilesLines
* Ensure result encoding is the same as input encoding for String#gsub. [Bug ↵drbrain2011-02-061-0/+1
| | | | | | #4340]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_utf8_nth): fixed a conditon of optimized leadkosaki2011-02-041-1/+1
| | | | | | | | byte counting. [Bug #4366][ruby-dev:43170] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (count_utf8_lead_bytes_with_word): wrote functionkosaki2011-02-031-0/+17
| | | | | | | | comments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_ellipsize): new function to ellipsize a string.nobu2011-01-301-0/+51
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (ALLOCV): new API for exception-safenobu2011-01-261-0/+18
| | | | | | | | temporary buffer. [ruby-core:34844] * string.c (rb_alloc_tmp_buffer, rb_free_tmp_buffer): implementation of the API. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (=~): documentation fix; the return value is nil whennaruse2011-01-261-1/+1
| | | | | | it doesn't match. patched by Andrei Kulakov [ruby-core:34562] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_resize): get rid of out-of-bound access.nobu2011-01-241-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_string_value_cstr): rb_str_modify can changenobu2011-01-241-1/+5
| | | | | | RSTRING_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_nth_len, str_utf8_nth): return the rest length together.nobu2011-01-221-14/+32
| | | | | | | * string.c (rb_str_substr): get rid of measure the length always to improve performance for huge string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix spaces.akr2011-01-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: parenthesize macro arguments.akr2011-01-061-15/+15
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: fix rdoc typo.shyouhei2011-01-051-2/+0
| | | | | | | https://github.com/shyouhei/ruby/pull/3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_inspect): fix: extra back slash is added whennaruse2010-12-111-2/+3
| | | | | | the string is dummy encoding and includes \x22 or \x5C. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_memhash): zero-filled strings should returnnobu2010-12-011-1/+1
| | | | | | different values. [ruby-core:33500] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_inspect): fix typo (not 0xFD but 0xFE).naruse2010-12-011-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_inspect): inspect as a dummy encoding stringnaruse2010-11-301-4/+14
| | | | | | | | | | | | when a UTF-16/32 (not BE/LE) string does not have a BOM. Unicode and some RFCs say that a string labeld as UTF-16/32 doesn't have a BOM, it should be considered big endian. But many Windows programs generates little endian UTF-16 strings without a BOM. So String#inspect treats a string labeled UTF-16/32 withaout a BOM as a dummy encoding string. patched by Martin Duerst. [ruby-core:33461] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_inspect): treat UTF-16 and UTF-32 as BE or LE.naruse2010-11-241-0/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_inspect): fix for ascii-compatible externalnobu2010-11-221-1/+1
| | | | | | | encoding and different encoding string. [ruby-core:33283] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_inspect): append for each chars instead of bulknobu2010-11-221-2/+4
| | | | | | | copy if encoding conversion is needed. [ruby-core:33283] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_concat): set ENC_CODERANGE_VALID when thenaruse2010-11-221-0/+2
| | | | | | receiver is 7BIT and the argument is non ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_cr_str_buf_cat): concatenation of validnobu2010-11-031-1/+4
| | | | | | | encoding string and invalid encoding string should result invalid encoding. [ruby-core:33027] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_dump): fix expected length. [ruby-core:32935]nobu2010-10-281-5/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, gc.c, hash.c, object.c, string.c, struct.c,nobu2010-10-241-11/+3
| | | | | | | | transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c: replace calls to rb_error_frozen() with rb_check_frozen(). a patch from Run Paint Run Run at [ruby-core:32014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Commit miss.nobu2010-10-191-3/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]nobu2010-10-191-11/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (rb_num_to_uint): added to check the range of arguments.naruse2010-10-131-5/+10
| | | | | | | | Mainly for negative value with NUM2UINT on 32bit environment. * string.c (rb_str_concat): use rb_num_to_uint. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_concat): use unsigned int for GB18030.naruse2010-10-121-16/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (sym_call), vm.c (invoke_block_from_c),nobu2010-09-241-1/+3
| | | | | | | | | | vm_insnhelper.c (vm_yield_with_cfunc): pass given block. [ruby-core:32075] * vm_eval.c (rb_funcall_passing_block): new function to call method with passing given block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_to_i): fix rdoc: String#to_i raises annaruse2010-09-241-1/+1
| | | | | | | | exception when base is invalid. [ruby-core:31685] Fri Sep 24 15:28:35 2010 NARUSE, Yui <naruse@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_rindex): use rb_enc_prev_char instead of repeated str_nth.naruse2010-09-241-3/+3
| | | | | | patched by Michael Selig [ruby-core:32498] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_times): mentioned about Hash argument. a patchnobu2010-09-141-3/+4
| | | | | | | | | | from Daniel Bovensiepen at [ruby-core:32386]. * sprintf.c (get_hash): ditto, and fix typo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (tr_setup_table): optimized. don't create hash objectsnaruse2010-09-011-19/+21
| | | | | | | | when given pattern is ASCII only. * string.c (tr_find): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (tr_setup_table): fix bug in r29146.naruse2010-08-301-5/+8
| | | | | | | | | | Initialize table even if cflag is 0; tr_find see whether del is empty or not. * string.c (tr_find): nodel can't be NULL; if NULL, it means it is not specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (tr_setup_table): initialize negating table whennaruse2010-08-301-9/+12
| | | | | | | | | | | negating string is given. [ruby-core:31851] * string.c (tr_find): add a sentence for the time when target characters include negating one. * string.c (rb_str_count): move definition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_prepend): new method by Sora Harakamishyouhei2010-08-271-0/+21
| | | | | | | [Feature #3765] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Tue Aug 17 07:42:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>nobu2010-08-161-5/+6
| | | | | | | * string.c (str_make_independent_expand): set capacity properly. a patch from Peter Weldon at [ruby-core:31734]. [ruby-core:31653] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in, include/ruby/defines.h (RUBY_FUNC_EXPORTED): macronobu2010-08-141-1/+1
| | | | | | | | | | | to declare exported function. * array.c (rb_ary_memsize), string.c (rb_str_memsize), variable.c (rb_objspace_data_type_memsize): used in objspace. [ruby-dev:42022] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_set_len): bail out when buffer overflowednobu2010-08-051-0/+5
| | | | | | | probably. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_set_len): should fail to modify shared string.nobu2010-08-051-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_make_independent_expand): fix buffer overflownobu2010-08-051-1/+2
| | | | | | | while shrinking. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_resize):: fix r28857 that failed to revert r28851.mame2010-08-041-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_resize): reverted r28851. rb_str_resize cannotnobu2010-08-041-1/+1
| | | | | | | work before the length is set. [ruby-core:31615] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_set_len): rb_str_modify cannot work before thenobu2010-08-041-1/+1
| | | | | | | length is set, which is a precondition for rb_str_modify. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_resize): should copy the content properly. anobu2010-08-041-1/+1
| | | | | | | patch from Jeremy Evans at [ruby-core:31615]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_modify_expand, rb_str_resize): get rid ofnobu2010-08-011-19/+38
| | | | | | repeating malloc and realloc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (RSTRING_GETMEM): new macro to get ptr andnobu2010-07-201-7/+13
| | | | | | | | len at once. * string.c (rb_str_cmp, str_eql, rb_str_eql): trivial improvements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_conv_enc_opts): fix infinite loop becausenaruse2010-07-081-1/+1
| | | | | | | of ISO-2022-JP conversion with empty string. patched by Brian Buchanan [ruby-core:31107] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (NONASCII_MASK): NONASCII_MASK must be unsigned.mame2010-07-051-1/+1
| | | | | | [ruby-dev:41782] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_gsub_bang, rb_str_sub_bang, str_gsub): rdoc fixmarcandre2010-06-301-35/+53
| | | | | | based on patch by Run Paint [ruby-core:30938] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_buf_cat_escaped_char): get rid of buffernobu2010-06-061-2/+7
| | | | | | | overflow on platforms int is bigger than 32bit, and warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e