aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
Commit message (Collapse)AuthorAgeFilesLines
* * string.c (rb_str_intern): need not to check if tainted.matz2008-04-061-3/+0
| | | | | | [ruby-dev:34219] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_memsearch_ss): simple shift search.naruse2008-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | * 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
* * encoding.c (rb_enc_associate_index): pass unnecessary enc_capable().matz2008-03-151-5/+9
| | | | | | * 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
* * include/ruby/ruby.h (inttypes.h): includes always if available.nobu2008-03-141-4/+0
| | | | | | | * 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
* * string.c (UNALIGNED_WORD_ACCESS): IA64 cannot access unaligned word.nobu2008-03-141-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * trunk/configure.in (AC_CHECK_HEADERS): stdint.h is not needed to check.nobu2008-03-131-4/+4
| | | | | | | | | * 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
* * configure.in (stdint.h): check if presence.nobu2008-03-121-6/+101
| | | | | | | | | * 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
* * string.c (hash): replaced by MurmurHash described inmatz2008-03-111-113/+32
| | | | | | <http://murmurhash.googlepages.com/>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_comparable): empty strings in any encoding arematz2008-03-111-4/+7
| | | | | | compatible each other. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_index): if t == s + pos, the character beginningnaruse2008-03-091-1/+1
| | | | | | from s + pos is valid. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc.akr2008-03-091-11/+13
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (search_nonascii): Use VALUE instead of unsigned longnaruse2008-03-081-35/+33
| | | | | | | | | | | | 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
* * string.c (count_utf8_lead_bytes_with_ulong): fix shift size.naruse2008-03-051-4/+3
| | | | | | | | [ruby-dev:33993] * string.c (str_utf8_nth) fix wrong counting. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (is_utf8_lead_byte, count_utf8_lead_bytes_with_ulong):naruse2008-03-051-35/+35
| | | | | | | | | | | defined for UTF-8 optimization. * string.c (str_strlen): use is_utf8_lead_byte and count_utf8_lead_bytes_with_ulong. * string.c (str_utf8_nth) ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (fix_to_s): avoid rb_scan_args() when no argumentmatz2008-03-051-11/+21
| | | | | | | | | | | | | | | | | | | | | | given. * bignum.c (rb_big_to_s): ditto. * enum.c (enum_first): ditto. * eval_jump.c (rb_f_catch): ditto. * io.c (rb_obj_display): ditto. * class.c (rb_obj_singleton_methods): ditto. * object.c (rb_class_initialize): ditto. * random.c (rb_f_srand): ditto. * range.c (range_step): ditto. * re.c (rb_reg_s_last_match): ditto. * string.c (rb_str_to_i): ditto. * string.c (rb_str_each_line): ditto. * string.c (rb_str_chomp_bang): ditto. * string.c (rb_str_sum): ditto. * string.c (str_modifiable): declare inline. * string.c (str_independent): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (sym_inspect): use rb_str_inspect() instead ofmatz2008-03-011-1/+1
| | | | | | rb_str_dump(). [ruby-dev:33946] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (tr_setup_table, rb_str_split_m, rb_str_chomp_bang):nobu2008-03-011-25/+14
| | | | | | | simplified with rb_enc_ascget(). [ruby-dev:33944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_coderange_scan_restartable): should not returnmatz2008-03-011-3/+3
| | | | | | | | | offset in the middle of a character. * string.c (rb_str_coderange_scan_restartable): should not return invalid cr value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_m17n_comb.rb (TestM17NComb::test_str_chomp): testmatz2008-02-291-1/+1
| | | | | | updated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_chomp_bang): now works on UTF-16.matz2008-02-291-24/+63
| | | | | | | | | | * string.c (tr_setup_table): negation should work on non ASCII compatible strings as well. * string.c (rb_str_split_m): awk split should work on non ASCII compatible strings as well. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (time_strftime): format should be ascii compatible.matz2008-02-291-0/+11
| | | | | | | | | | | | * parse.y (rb_intern3): non ASCII compatible symbols. * re.c (rb_reg_regsub): add encoding check. * string.c (rb_str_chomp_bang): ditto. * test/ruby/test_utf16.rb (TestUTF16::test_chomp): raises exception. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_rpartition): calculation was done in byte indexing.matz2008-02-291-3/+4
| | | | | | | * test/ruby/test_m17n_comb.rb (TestM17NComb::test_str_start_with): allow start_with? matching on broken strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_new): remove encoding assumption of empty string.naruse2008-02-281-3/+0
| | | | | | | | | * hash.c ( rb_f_getenv, env_fetch, env_inspect): result of ENV should be always ASCII-8BIT. * object.c (nil_to_s): nil.to_s should be US-ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_enc_str_copy): removed.naruse2008-02-281-12/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_reverse_bang): removed unsed variables.nobu2008-02-281-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_str_coderange_scan_restartable): addednobu2008-02-281-9/+8
| | | | | | | | | | | | prototype. * string.c (rb_str_coderange_scan_restartable, rb_str_times): removed unsed variables. * string.c (rb_enc_str_copy): unused now. may be used in future? git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_coderange_scan_restartable): coderange scaningnaruse2008-02-271-0/+55
| | | | | | | | for partial read. * io.c (read_all): set coderange when not convert encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 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