summaryrefslogtreecommitdiff
path: root/string.c
AgeCommit message (Collapse)Author
2012-06-02merge revision(s) 35863,35864:naruse
* string.c (rb_enc_cr_str_buf_cat): don't reset coderange as unknown. the condition 'ptr_a8 && str_cr != ENC_CODERANGE_7BIT' means not unknown, str is also ASCII-8BIT because str_encindex == ptr_encindex, and nont (str_cr == ENC_CODERANGE_UNKNOWN) and str_cr != ENC_CODERANGE_7BIT means str_cr is valid because ASCII-8BIT can't be broken. [ruby-dev:45688] [Bug #6509] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-30merge revision(s) 35146:naruse
* string.c (str_new_empty): should copy also the encoding as an empty substring. [ruby-dev:45441][Bug #6206] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-06merge revision(s) 34927:marcandre
* string.c (rb_str_aref): Improve rdoc, as per [bug #6106] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-08merge revision(s) 34236: [Backport #5890]naruse
* numeric.c (rb_enc_uint_char): raise RangeError when added codepoint is invalid. [Feature #5855] [Bug #5863] [Bug #5864] * string.c (rb_str_concat): ditto. * string.c (rb_str_concat): set encoding as ASCII-8BIT when the string is US-ASCII and the argument is an integer greater than 127. * regenc.c (onigenc_mb2_code_to_mbclen): rearrange error code. * enc/euc_jp.c (code_to_mbclen): ditto. * enc/shift_jis.c (code_to_mbclen): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-08* string.c (rb_str_modify_expand): fix memory leak.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07* removed trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-01* string.c (tr_trans): free heap ptr when the str is not embeded.naruse
patched by Eric Wong. [Bug #4956] [ruby-core:37708] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17* internal.h: declare internal functions here.akr
* node.h: declare NODE dependent internal functions here. * iseq.h: declare rb_iseq_t dependent internal functions here. * vm_core.h: declare rb_thread_t dependent internal functions here. * bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c, enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c, iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y, proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c, thread.c, time.c, transcode.c, variable.c, vm.c, tool/compile_prelude.rb: don't declare internal functions declared in above headers. include above headers if required. Note that rb_thread_mark() was declared as void rb_thread_mark(rb_thread_t *th) in cont.c but defined as void rb_thread_mark(void *ptr) in vm.c. Now it is declared as the later in internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09* string.c: Fix the ambiguous description of the behavior ofmrkn
rb_str_aref_m with a range. It returns nil when the beginning of the range is greater than the end of the string rather than the range. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-01Clarified String#tr rdoc. (RickHull)ryan
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-27* string.c (rb_str_bytesize): rb_str_bytesize() should use LONG2NUM().kosaki
Patch by Nikolai Weibull. [Bug #4789] [ruby-core:36511] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-09* string.c: Improve documentation for String#start_with? andnaruse
String#end_with?. fixes #4652 patched by Andrew Grimm <andrew.j.grimm at gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-24* string.c (rb_to_id): remove unused variable.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-20* string.c (rb_str_each_line): check string's length when comparenaruse
separator and string. [ruby-core:35815] fixes #4586 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07cancel subversion backfire. sorrymatz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07* gc.c (rb_gc_set_params): allow GC parameter configuration bymatz
environment variables. based on a patch from funny-falcon at https://gist.github.com/856296, but honors safe level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07* string.c (tr_trans): suppress signedness/unsignedness warnings.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-03* string.c (rb_str_slice_bang): raise error when the string is frozen.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-02* string.c (str_byte_substr): return nil for negative length.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-02* string.c (rb_str_slice_bang): move treatments which is only needednaruse
when the result is not nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-01* string.c (rb_str_byteslice): the resulted encoding should keepnaruse
original encoding. this also fixes the encoding when the result shares internal string. [ruby-core:35376] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-01Fix rdoc of String#byteslice. Feature #4447naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-01* string.c (rb_str_byteslice): Add String#byteslice. [ruby-core:35376]naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-28* string.c (tr_trans): when the hash for multibyte repl is empty,naruse
tr is inverse mode, and a character doesn't much the table, the character should be replaced by last replacement. Bug #4449 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-15* string.c (rb_enc_cr_str_buf_cat): remove special treatment ofnaruse
ASCII-8BIT receivers. * string.c (str_gsub): set initial encoding of the buffer as the same of the receiver. [ruby-core:35141] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-06Ensure result encoding is the same as input encoding for String#gsub. [Bug ↵drbrain
#4340]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-04 * string.c (str_utf8_nth): fixed a conditon of optimized leadkosaki
byte counting. [Bug #4366][ruby-dev:43170] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-03 * string.c (count_utf8_lead_bytes_with_word): wrote functionkosaki
comments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30* string.c (rb_str_ellipsize): new function to ellipsize a string.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-26* include/ruby/ruby.h (ALLOCV): new API for exception-safenobu
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
2011-01-26* string.c (=~): documentation fix; the return value is nil whennaruse
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
2011-01-24* string.c (rb_str_resize): get rid of out-of-bound access.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24* string.c (rb_string_value_cstr): rb_str_modify can changenobu
RSTRING_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-22* string.c (str_nth_len, str_utf8_nth): return the rest length together.nobu
* 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
2011-01-08fix spaces.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-06* string.c: parenthesize macro arguments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05* string.c: fix rdoc typo.shyouhei
https://github.com/shyouhei/ruby/pull/3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-11* string.c (rb_str_inspect): fix: extra back slash is added whennaruse
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
2010-12-01* string.c (rb_memhash): zero-filled strings should returnnobu
different values. [ruby-core:33500] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-01* string.c (rb_str_inspect): fix typo (not 0xFD but 0xFE).naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-30* string.c (rb_str_inspect): inspect as a dummy encoding stringnaruse
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
2010-11-24* string.c (rb_str_inspect): treat UTF-16 and UTF-32 as BE or LE.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22* string.c (rb_str_inspect): fix for ascii-compatible externalnobu
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
2010-11-22* string.c (rb_str_inspect): append for each chars instead of bulknobu
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
2010-11-22* string.c (rb_str_concat): set ENC_CODERANGE_VALID when thenaruse
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
2010-11-03* string.c (rb_enc_cr_str_buf_cat): concatenation of validnobu
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
2010-10-28* string.c (rb_str_dump): fix expected length. [ruby-core:32935]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24* array.c, gc.c, hash.c, object.c, string.c, struct.c,nobu
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
2010-10-19Commit miss.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19* test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e