summaryrefslogtreecommitdiff
path: root/string.c
AgeCommit message (Collapse)Author
2008-08-04* marshal.c (dump_ensure), process.c (run_exec_dup2),nobu
string.c (rb_str_replace), transcode.c (transcode_dispatch): fixed memory leaks. based on patches from shinichiro.h <shinichiro.hamaji AT gmail.com> at [ruby-dev:35751]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-03* string.c (rb_str_shared_replace): fixed memory leak. a patch fromnobu
shinichiro.h <shinichiro.hamaji AT gmail.com> at [ruby-dev:35742] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-30* string.c (sym_inspect): remove dead code.mame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-22* include/ruby/intern.h, sprintf.c (rb_str_catf, rb_str_vcatf): newnobu
functions. [ruby-dev:35597] * string.c (rb_str_capacity): new function to return the capacity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-21* include/ruby/intern.h (rb_str_buf_new2): optimization for literals.nobu
* string.c (str_buf_cat): returns VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-21* include/ruby/intern.h (rb_str_buf_cat2, rb_str_cat2): optimizationnobu
for literals. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-08* string.c (rb_str_succ): alphabets or numerics mutually enclosingnobu
non-alphanumeric characters can carry up. e.g., "1.999".succ should be "2.000". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-07* string.c (rb_str_succ): limit carrying in an alphanumeric region ifnobu
exists. [ruby-dev:35094] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-29* string.c (rb_str_format_m): make tmp volatile to avoid possible GCakr
problem. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-28* include/ruby/ruby.h (struct RRegexp): new field usecnt. replaceakr
str and len by src. * gc.c (gc_mark_children): mark src field of regexp. (obj_free): don't free str field. * re.c (REG_BUSY): removed. (rb_reg_initialize): prohibit re-initialize regexp. (rb_reg_search): use usecnt to prevent freeing regexp currently using. this prevents SEGV by: r = /\A((a.)*(a.)*)*b/ r =~ "ab" + "\xc2\xa1".force_encoding("euc-jp") t = Thread.new { r =~ "ab"*8 + "\xc2\xa1".force_encoding("utf-8")} sleep 0.2 r =~ "ab"*8 + "\xc2\xa1".force_encoding("euc-jp") git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-27* include/ruby/intern.h (rb_str_new2, rb_tainted_str_new2,nobu
rb_usascii_str_new2): use with-length versions with strlen to optimize strlen. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-26* string.c (rb_str_index_m, rb_str_rindex_m, rb_str_include): fixmame
rdoc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-20* array.c (rb_ary_store, rb_ary_splice): not depend on unspecifiednobu
behavior at integer overflow. * string.c (str_buf_cat): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-20* string.c (rb_str_sub_bang): should preserve replacement pointsmatz
since they may be altered in the yielded block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-20* string.c (rb_memhash): randomize hash to avoid algorithmicakr
complexity attacks. (rb_str_hash): use rb_memhash. * include/ruby/intern.h (rb_reset_random_seed): declared. * thread.c (rb_thread_atfork): call rb_reset_random_seed. * inits.c (rb_call_inits): call Init_RandomSeed at first. * random.c (seed_initialized): defined. (fill_random_seed): extracted from random_seed. (make_seed_value): extracted from random_seed. (rb_f_rand): initialize random seed at first. (initial_seed): defined. (Init_RandomSeed): defined. (Init_RandomSeed2): defined. (rb_reset_random_seed): defined. (Init_Random): call Init_RandomSeed2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19* array.c (ary_new, rb_ary_initialize, rb_ary_store,shyouhei
rb_ary_aplice, rb_ary_times): integer overflows should be checked. based on patches from Drew Yao <ayao at apple.com> fixed CVE-2008-2726 * string.c (rb_str_buf_append): fixed unsafe use of alloca, which led memory corruption. based on a patch from Drew Yao <ayao at apple.com> fixed CVE-2008-2726 * sprintf.c (rb_str_format): backported from trunk. * intern.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19* string.c (str_gsub): should preserve last successful matchmatz
data. [ruby-dev:35182] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19* string.c (str_alloc): specify 'inline' modifier.matz
* string.c (str_alloc): remove cSymbol hack that no longer necessary. * string.c (scan_once): avoid retrieving encoding info unless necessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19* string.c (rb_str_scan): String#scan should preserve lastmatz
successful match data. [ruby-dev:35106] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-11* io.c (read_all): should use io_read_encoding(), notmatz
io_input_encoding(). * io.c (rb_io_getline_1): reduce calling of io_read_encoding(). * string.c (rb_str_scan): need not to restore $~ value, so avoid pinning match object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09* include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.nobu
* *.c: no cache in init functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08* array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko1
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c, io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c, string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c, vm.c, gc.c: allocated memory objects by xmalloc (ruby_xmalloc) should be freed by xfree (ruby_xfree). * ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c, ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c, ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c, ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-04* string.c (hash): should be "static".ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31* suppress warnings with -Wwrite-string.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-20* string.c (rb_usascii_str_new): use rb_str_new.naruse
* string.c (rb_enc_str_new): ditto. * string.c (rb_usascii_str_new2): use rb_str_new2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-20* string.c (rb_enc_strlen_cr): need to set ENC_CODERANGE_7BIT ifmatz
search_nonascii() fails. [ruby-dev:34751] * string.c (rb_str_reverse): preserve coderange info if the receiver is 7bit string. * string.c (rb_str_reverse_bang): ditto. * string.c (rb_str_reverse_bang): should have called single_byte_optimizable before rb_str_modify() that clears coderange info. * string.c (tr_trans): handle single bytes more eagerly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-19* regparse.c (PINC): use optimized enclen() instead ofmatz
ONIGENC_MBC_ENC_LEN(). * regparse.c (PFETCH): ditto. * regparse.c (PFETCH): small optimization. * regexec.c (slow_search): single byte encoding optimization. * regenc.h (enclen): avoid calling function when encoding's min_len == max_len. * re.c (rb_reg_regsub): rb_enc_ascget() optimization for single byte encoding. * re.c (rb_reg_search): avoid allocating new re_registers if we already have MatchData. * re.c (match_init_copy): avoid unnecessary onig_region_free() before onig_region_copy. * encoding.c (rb_enc_get_index): remove implicit enc_capable check each time. * encoding.c (rb_enc_set_index): ditto. * encoding.c (enc_compatible_p): small refactoring. * include/ruby/encoding.h (rb_enc_dummy_p): inline rb_enc_dummy_p() and export related code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-15* string.c (tr_find): String#delete returned wrong result when multiplemame
utf-8 arguments are passed. * test/ruby/test_m17n.rb (test_delete): add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-13* string.c (rb_str_cat): fixed buffer overrun reported bymatz
Christopher Thompson <cthompson at nexopia.com> in [ruby-core:16746] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12* string.c (sym_to_i): really removed. [ruby-dev:34641]matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-10* string.c (tr_trans): should not turn on modify flag if nomatz
modification happens. [ruby-dev:34631] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-10* string.c (tr_trans): should check src size, not str size.matz
[ruby-dev:34637] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-10* string.c (tr_trans): single '^' does not mean negation.matz
[ruby-dev:34632] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-10* string.c (rb_str_each_line): zero length record separator shouldmatz
split a string into paragraphs. [ruby-dev:34586] * string.c (rb_str_each_line): RDoc updated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-07* thread.c (rb_thread_key_p): thread local storage stores ID.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-07* string.c (tr_trans): should squeeze properly. [ruby-dev:34587]matz
* string.c (tr_trans): had a bug in treating multi-byte character replacement. * string.c (rb_str_delete_bang): need not to do anything for empty strings. * test/ruby/test_m17n_comb.rb (TestM17NComb::test_str_delete): add test for empty receiver. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-04* string.c (rb_str_each_line): return original string.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22* string.c (rb_enc_cr_str_buf_cat): do not use C++ comment.shyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-06* string.c (rb_str_intern): need not to check if tainted.matz
[ruby-dev:34219] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-17* re.c (rb_memsearch_ss): simple shift search.naruse
* re.c (rb_memsearch_qs): quick search. * re.c (rb_memsearch_qs_utf8): quick search for UTF-8 string. * re.c (rb_memsearch_qs_utf8_hash): hash functions for above. * re.c (rb_memsearch): use above functions. * string.c (rb_str_index): give enc to rb_memsearch. * include/ruby/intern.h (rb_memsearch): move to encoding.h. * include/ruby/encoding.h (rb_memsearch): move from intern.h. * common.mk (PREP): add dependency. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-15* encoding.c (rb_enc_associate_index): pass unnecessary enc_capable().matz
* string.c (rb_str_cmp): reduce invocation of rb_enc_compatible(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-14* include/ruby/ruby.h (inttypes.h): includes always if available.nobu
* string.c, ext/digest/defs.h: moved inttypes.h to ruby.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-14* string.c (UNALIGNED_WORD_ACCESS): IA64 cannot access unaligned word.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-13* trunk/configure.in (AC_CHECK_HEADERS): stdint.h is not needed to check.nobu
* trunk/configure.in (rb_cv_type_uint32_t): unqouted. [ruby-dev:34030] * trunk/string.c (hash): use inttypes.h instead of stdint.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-12* configure.in (stdint.h): check if presence.nobu
* configure.in (uint32_t): check if defined. * string.c (hash): fix for portability. [ruby-dev:34020] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-11* string.c (hash): replaced by MurmurHash described inmatz
<http://murmurhash.googlepages.com/>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-11* string.c (rb_str_comparable): empty strings in any encoding arematz
compatible each other. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09* string.c (rb_str_index): if t == s + pos, the character beginningnaruse
from s + pos is valid. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09fix doc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-08* string.c (search_nonascii): Use VALUE instead of unsigned longnaruse
because VALUE can be the fastest unsigned integer type. On LLP64 unsigned long isn't the fastest. * string.c (str_strlen): ditto. * string.c (str_utf8_nth): ditto. * string.c (count_utf8_lead_bytes_with_ulong): ditto. * string.c (count_utf8_lead_bytes_with_word): renamed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e