nobu
86afcfe402
* thread.c (rb_thread_key_p): thread local storage stores ID.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-07 21:27:34 +00:00
matz
60219a0aa3
* string.c (tr_trans): should squeeze properly. [ruby-dev:34587]
...
* 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-07 16:15:45 +00:00
akr
7ef9aba753
* string.c (rb_str_each_line): return original string.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-04 03:59:01 +00:00
shyouhei
322d8dfb0e
* string.c (rb_enc_cr_str_buf_cat): do not use C++ comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22 07:08:41 +00:00
matz
5572494524
* string.c (rb_str_intern): need not to check if tainted.
...
[ruby-dev:34219]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-06 17:19:11 +00:00
naruse
e58adeae0f
* re.c (rb_memsearch_ss): simple shift search.
...
* 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-17 19:04:29 +00:00
matz
2694b2f937
* encoding.c (rb_enc_associate_index): pass unnecessary enc_capable().
...
* 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-15 09:19:38 +00:00
nobu
657429b75b
* include/ruby/ruby.h (inttypes.h): includes always if available.
...
* 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 08:04:45 +00:00
nobu
c0b8e82296
* string.c (UNALIGNED_WORD_ACCESS): IA64 cannot access unaligned word.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-14 01:04:02 +00:00
nobu
fab87736fd
* trunk/configure.in (AC_CHECK_HEADERS): stdint.h is not needed to check.
...
* 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-13 05:14:21 +00:00
nobu
db49143cda
* configure.in (stdint.h): check if presence.
...
* 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-12 16:45:28 +00:00
matz
3e51715596
* string.c (hash): replaced by MurmurHash described in
...
<http://murmurhash.googlepages.com/ >.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-11 01:20:25 +00:00
matz
923a661a7a
* string.c (rb_str_comparable): empty strings in any encoding are
...
compatible each other.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-11 00:55:02 +00:00
naruse
f55b10c001
* string.c (rb_str_index): if t == s + pos, the character beginning
...
from s + pos is valid.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 18:51:46 +00:00
akr
861219ce4a
fix doc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
naruse
a39feece85
* string.c (search_nonascii): Use VALUE instead of unsigned long
...
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
2008-03-08 09:05:34 +00:00
naruse
98cbcf1bd7
* string.c (count_utf8_lead_bytes_with_ulong): fix shift size.
...
[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
2008-03-05 19:34:15 +00:00
naruse
fff981ee6d
* string.c (is_utf8_lead_byte, count_utf8_lead_bytes_with_ulong):
...
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
2008-03-05 13:54:36 +00:00
matz
39787ea14d
* numeric.c (fix_to_s): avoid rb_scan_args() when no argument
...
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
2008-03-05 05:22:17 +00:00
matz
88d9f7aeac
* string.c (sym_inspect): use rb_str_inspect() instead of
...
rb_str_dump(). [ruby-dev:33946]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-01 03:42:06 +00:00
nobu
79f1b9e93b
* string.c (tr_setup_table, rb_str_split_m, rb_str_chomp_bang):
...
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
2008-03-01 01:09:43 +00:00
matz
d5fec27d8e
* string.c (rb_str_coderange_scan_restartable): should not return
...
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
2008-03-01 01:02:30 +00:00
matz
99de7f24f7
* test/ruby/test_m17n_comb.rb (TestM17NComb::test_str_chomp): test
...
updated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-29 14:57:04 +00:00
matz
2d97d3ddac
* string.c (rb_str_chomp_bang): now works on UTF-16.
...
* 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
2008-02-29 13:33:26 +00:00
matz
daa622aed0
* time.c (time_strftime): format should be ascii compatible.
...
* 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
2008-02-29 09:19:15 +00:00
matz
deff2a3e24
* string.c (rb_str_rpartition): calculation was done in byte indexing.
...
* 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
2008-02-29 06:19:21 +00:00
naruse
50a860d006
* string.c (str_new): remove encoding assumption of empty string.
...
* 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
2008-02-28 18:13:45 +00:00
naruse
7bb2b2f431
* string.c (rb_enc_str_copy): removed.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-28 05:38:16 +00:00
nobu
d3545f0d3c
* string.c (rb_str_reverse_bang): removed unsed variables.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-28 02:19:53 +00:00
nobu
c015c6fa8e
* include/ruby/encoding.h (rb_str_coderange_scan_restartable): added
...
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
2008-02-28 02:13:51 +00:00
naruse
4dd9fd71b3
* string.c (rb_str_coderange_scan_restartable): coderange scaning
...
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
2008-02-27 15:19:22 +00:00
naruse
c1d3465081
* string.c (str_sublen): removed.
...
* 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
2008-02-23 11:18:07 +00:00
naruse
386aa4c0a1
* string.c (rb_enc_cr_str_copy_for_substr): renamed from
...
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
2008-02-23 10:29:13 +00:00
naruse
7b218308e0
* fix missing STR_ENC_GET.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-22 15:02:40 +00:00
naruse
70eea8fd26
* add ascii incompatible case.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-22 12:56:21 +00:00
naruse
bdb14b5bb6
* string.c (rb_enc_cr_str_copy): check string's coderange is 7bit or
...
valid.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-22 12:15:56 +00:00
akr
81fc1cf201
* encoding.c (rb_enc_mbclen): return minlen instead of 1 when
...
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
2008-02-22 06:52:54 +00:00
naruse
a532dcafe6
* string.c (rb_str_inspect): string of ascii incompatible encoding
...
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
2008-02-22 03:16:52 +00:00
naruse
7a9cf391cd
* string.c (rb_str_substr): copy encoding although empty string.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-22 02:18:23 +00:00
naruse
b62df564a6
* string.c (rb_str_times): empty string's coderange is CODERANGE_7BIT.
...
* 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
2008-02-21 19:54:48 +00:00
naruse
3ce61d2a63
* string.c: replace rb_enc_copy by rb_enc_cr_str_copy or
...
rb_enc_cr_str_exact_copy.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-21 02:42:51 +00:00
naruse
492f431a46
* string.c (rb_enc_str_copy): added for wrapper for rb_enc_copy.
...
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
2008-02-20 10:20:43 +00:00
naruse
f1c975b87a
* string.c (rb_enc_strlen_cr): get length with coderange scan.
...
* 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
2008-02-19 12:18:03 +00:00
akr
8efc7ea9ad
* string.c (rb_str_each_line): fix newline size.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-18 06:18:31 +00:00
naruse
8dd8dfce21
* encoding.c (ENC_CODERANGE_AND): fix broken case. [ruby-dev:33826]
...
* 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
2008-02-17 13:01:52 +00:00
naruse
7a257b0110
* encoding.c (ENC_CODERANGE_AND): added.
...
* 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
2008-02-17 06:49:11 +00:00
akr
a906fce838
* string.c (str_strlen): rb_enc_strlen doesn't fail.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-17 05:08:43 +00:00
akr
bf2d82b280
* string.c (str_sublen): use rb_enc_strlen.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-17 04:04:14 +00:00
akr
35cb0f807b
* string.c (rb_str_times): reduce loop overhead.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-17 00:18:16 +00:00
akr
71c5e48598
* include/ruby/re.h (struct rmatch_offset): new struct for character
...
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
2008-02-16 20:08:35 +00:00
naruse
66583d9663
* string.c (rb_str_substr): optimized for UTF-8.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 11:53:04 +00:00
naruse
bb831578c5
* string.c (str_strlen): revert r15507. [ruby-dev:33810]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 10:06:15 +00:00
naruse
0ad3d7ce2d
* string.c (str_strlen): little more optimize.
...
(rb_enc_nth): remove needless variable 'c'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 09:30:03 +00:00
akr
7eeba5f440
* encoding.c (rb_enc_compatible): empty strings are always compatible.
...
* 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
2008-02-16 09:02:12 +00:00
akr
a47e8e776c
* string.c (rb_enc_strlen): UTF-8 character count moved to str_strlen.
...
(str_strlen): UTF-8 character count is only applicable for valid
UTF-8 string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 07:16:36 +00:00
akr
9b3ab49b5d
* string.c (rb_str_sub_bang): stringize replacing hash values.
...
(str_gsub): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 04:17:52 +00:00
naruse
327673a43b
* string.c (rb_enc_strlen): add search_nonascii like character
...
counter for UTF-8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 04:05:58 +00:00
akr
af75cc01bc
* encoding.c (rb_enc_strlen): moved to string.c.
...
* string.c (rb_enc_strlen): use search_nonascii.
(str_strlen): don't use search_nonascii.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 02:55:08 +00:00
naruse
132e3f54f2
* string.c (single_byte_optimizable): rb_enc_mbminlen must be 1
...
when rb_enc_mbmaxlen is 1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 20:41:29 +00:00
akr
0831222a91
* encoding.c (rb_enc_nth): moved to string.c.
...
* string.c (rb_enc_nth): moved from string.c. use search_nonascii
for ASCII compatible string.
(str_nth): wrong optimization removed to fix
"a".force_encoding("EUC-JP").slice!(0,10) returns
"a\x00\x00\x00\x00\x00\x00\x00\x00\x00"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 18:48:27 +00:00
nobu
a05337f14d
* string.c (rb_str_sub_bang, str_gsub): allows hash for replacement.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 09:23:55 +00:00
matz
8b09f7015a
* string.c (str_strlen): use search_nonascii() for performance.
...
* string.c (str_nth): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 08:14:40 +00:00
akr
12b1578cab
* string.c (rb_str_getbyte): new method.
...
(rb_str_setbyte): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 06:35:20 +00:00
matz
38694016bc
* string.c (rb_str_hash_cmp): lighter version of rb_str_cmp() for
...
hash comparison function.
* hash.c (rb_any_cmp): use rb_str_hash_cmp().
* string.c (rb_str_casecmp): should return nil for incompatible
comparison.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 03:17:43 +00:00
matz
0472db84c5
* range.c (range_include): specialize single character string
...
case (e.g. (?a ..?z).include(?x)) for performance.
[ruby-core:15481]
* string.c (rb_str_upto): specialize single character case.
* string.c (rb_str_hash): omit coderange scan for performance.
* object.c (rb_check_to_integer): check Fixnum first.
* object.c (rb_to_integer): ditto.
* string.c (rb_str_equal): inline memcmp to avoid unnecessary
rb_str_comparable().
* parse.y (rb_intern2): use US-ASCII encoding.
* parse.y (rb_intern_str): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-11 17:46:52 +00:00
akr
8f9fb1a820
* string.c (rb_str_new4): copy encoding from orig, instead of shared
...
one.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-09 01:04:29 +00:00
nobu
1809782c3e
* string.c (rb_str_replace): makes frozen shared string before
...
sharing.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-07 10:11:40 +00:00
nobu
fb506c3000
* string.c (rb_str_dup): reverted unneeded change. [ruby-dev:33634]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-07 09:57:06 +00:00
nobu
89941dffb5
* string.c (str_replace_shared): replaces string with sharing.
...
* string.c (rb_str_new4, rb_str_associate, rb_str_associated): allows
associated strings shared.
* string.c (rb_str_dup, rb_str_substr, rb_str_replace): shares memory.
[ruby-core:15400]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-07 07:33:50 +00:00
nobu
6c6ae98663
* string.c (rb_str_end_with): compares with the suffix.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-07 06:42:44 +00:00
akr
84fe384383
* string.c (rb_str_succ): use wrapped character as a carry for
...
ASCII incompatible encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-30 05:29:37 +00:00
naruse
3c6969ec11
* string.c, parse.y, re.c: use rb_ascii8bit_encoding.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-28 09:03:09 +00:00
akr
fc208c1bd5
* include/ruby/oniguruma.h: precise mbclen API redesigned to avoid
...
inline functions.
(onigenc_mbclen_charfound): removed.
(onigenc_mbclen_needmore): removed.
(onigenc_mbclen_recover): removed.
(ONIGENC_MBCLEN_CHARFOUND): removed.
(ONIGENC_MBCLEN_CHARFOUND_P): defined.
(ONIGENC_MBCLEN_CHARFOUND_LEN): defined.
(ONIGENC_MBCLEN_INVALID): removed.
(ONIGENC_MBCLEN_INVALID_P): defined.
(ONIGENC_MBCLEN_NEEDMORE): removed.
(ONIGENC_MBCLEN_NEEDMORE_P): defined.
(ONIGENC_MBCLEN_NEEDMORE_LEN): defined.
(ONIGENC_MBC_ENC_LEN): use onigenc_mbclen_approximate.
* regenc.c (onigenc_mbclen_approximate): defined.
* include/ruby/encoding.h (MBCLEN_CHARFOUND): removed.
(MBCLEN_INVALID): removed.
(MBCLEN_NEEDMORE): removed.
(MBCLEN_CHARFOUND_P): defined.
(MBCLEN_INVALID_P): defined.
(MBCLEN_NEEDMORE_P): defined.
(MBCLEN_CHARFOUND_LEN): defined.
(MBCLEN_NEEDMORE_LEN): defined.
* encoding.c: use new API.
* re.c: ditto.
* string.c: ditto.
* parse.y: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 14:27:07 +00:00
akr
b8b0f6fd46
* string.c (rb_str_inspect): avoid exception by
...
"\#\xa1".force_encoding("euc-jp").inspect.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 11:09:41 +00:00
akr
36b4d1a1dc
* string.c (rb_str_succ): warning suppressed.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 10:08:58 +00:00
akr
b1e6c052cd
* string.c (rb_str_succ): don't increment/decrement codepoint.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 08:21:24 +00:00
naruse
df17bd4313
* string.c (rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when
...
empty string (len == 0).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-26 00:18:50 +00:00
naruse
42dcda08ae
* string.c (rb_str_usascii_new{,2}: defined.
...
(rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when empty
string.
* encoding.c (rb_usascii_encoding, rb_usascii_encindex): defined.
(rb_enc_inspect, enc_name, rb_locale_charmap, rb_enc_name_list_i):
use rb_str_ascii_new.
* array.c (recursive_join, inspect_ary): ditto.
* object.c (nil_to_s, nil_inspect, true_to_s, false_to_s,
rb_mod_to_s): ditto.
* hash.c (inspect_hash, rb_hash_inspect, rb_f_getenv, env_fetch,
env_clear, env_to_s, env_inspect): ditto.
* numeric.c (flo_to_s, int_chr, rb_fix2str): ditto.
* bignum.c (rb_big2str): ditto.
* file.c (rb_file_ftype, rb_file_s_dirname, rb_file_s_extname,
file_inspect_join, Init_file): ditto.
* test/ruby/test_ruby_m17n.rb: add checks for encoding of string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 16:40:02 +00:00
akr
3a783ba707
* string.c (rb_str_buf_cat_ascii): use rb_enc_cr_str_buf_cat.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 12:50:12 +00:00
akr
1e41069754
* include/ruby/intern.h (rb_str_buf_cat_ascii): declared.
...
* string.c (rb_str_buf_cat_ascii): defined.
* re.c (rb_reg_s_union): use rb_str_buf_cat_ascii to support ASCII
incompatible encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 07:35:27 +00:00
akr
968e404220
* string.c (rb_enc_cr_str_buf_cat): ASCII incompatible encoding is
...
not compatible with any other encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24 02:17:26 +00:00
matz
9580a9ca91
* string.c (rb_str_each_line): use memchr(3) for faster newline
...
search.
* io.c (appendline): remove unused arguments
* io.c (rb_io_getline_fast): make much simpler (and faster).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 18:43:51 +00:00
nobu
e94ece76d8
* string.c (str_make_independent): should set length.
...
* string.c (rb_str_associate): hide associated array from ObjectSpace.
* string.c (rb_str_associated): return associated array with freezing
instead of false. [ruby-dev:33282]
* string.c (rb_str_freeze): freeze associated array together.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 06:04:13 +00:00
nobu
0c8106ded6
* string.c (str_mod_check, str_nth, str_offset): consitfied.
...
* string.c (rb_str_dump): dump in ASCII-8BIT always.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 02:53:28 +00:00
matz
65a8185eb2
* configure.in (MINIRUBY): remove -I$(EXTOUT)/$(arch) from
...
MINIRUBY since miniruby might not be able to load DLL.
* test/ruby/test_m17n.rb: move tests from bootstrap test.
* encoding.c (enc_find): should check name if ASCII compatible.
* string.c (rb_str_end_with): should check character boundary.
* encoding.c (rb_enc_compatible): encoding must be ASCII
compatible before checking ENC_CODERANGE_7BIT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-22 03:59:53 +00:00
nobu
157664b9f3
* string.c (rb_str_each_char): iterates over a shadow.
...
[ruby-dev:33243]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-22 00:26:49 +00:00
matz
56be84e293
* parse.y (rb_intern3): do not call rb_enc_mbclen() if *m is
...
ASCII. [ruby-talk:287225]
* string.c (rb_str_each_line): use rb_enc_is_newline() to gain
performance if the record separator ($/) is not modified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-21 19:47:26 +00:00
nobu
76e19bc534
* string.c (rb_str_each_char): move forward. [ruby-dev:33231]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-21 02:59:02 +00:00
nobu
ea64014c56
* string.c (rb_str_each_char): advance offset before get next char
...
length. [ruby-dev:33211]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-20 18:45:51 +00:00
nobu
00190701e0
* string.c (rb_str_each_char): performance improvement, and stop if
...
shortened in the block. [ruby-dev:33189]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-20 04:06:03 +00:00
akr
35a4fb5ef6
* string.c (coderange_scan): don't call mbclen functions for ASCII
...
characters with ASCII compatible encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-19 13:42:50 +00:00
matz
c58736dbdc
* string.c (rb_str_dump): preserve the encoding of source string
...
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@15108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 04:49:14 +00:00
akr
e350fe247a
* string.c (string.c): call rb_str_buf_append to update encoding of
...
str1, even if str2 is empty.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 14:26:26 +00:00
nobu
1267156698
* string.c (rb_str_append): performance improvement.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 07:55:23 +00:00
akr
0ada40e2b1
update rdoc: force_encoding doesn't accept nil.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 06:03:51 +00:00
akr
8786b8a282
* string.c (rb_enc_cr_str_buf_cat): fix self appending.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 08:00:26 +00:00
nobu
9874fdbc86
* string.c (rb_enc_cr_str_buf_cat, rb_str_buf_append): deal with self
...
appending.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 05:52:20 +00:00
matz
251dec5cf1
* string.c (rb_enc_cr_str_buf_cat): do not recalculate coderange
...
value if it's given from outside.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 04:07:11 +00:00
akr
389abf1b3b
* string.c (str_gsub): avoid appending empty pre-match substr.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-08 06:04:26 +00:00
akr
fc5a26c2d4
* string.c (rb_str_buf_append): fix append itself.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 22:57:00 +00:00