naruse
b3d8a4060c
* string.c (rb_str_concat): raise RangeError when the argument is
...
negative value. [ruby-core:27583]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-14 00:39:40 +00:00
akr
f6f3d1bc0e
* string.c (rb_str_set_len): call rb_str_modify.
...
* file.c (realpath_rec): don't call rb_str_modify before
rb_str_set_len.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-12 12:56:15 +00:00
naruse
a3973ab1ba
* string.c (rb_str_strlen): added. [ruby-dev:40028]
...
* include/ruby/intern.h (rb_str_strlen): declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-11 07:58:26 +00:00
naruse
e5dc8988af
* string.c (rb_str_inspect): CHAR_ESC_LEN should be 13.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-10 00:26:41 +00:00
nobu
c9c095fc7b
* string.c (rb_str_justify): fixed the case a fill size is a
...
multiple of the length of the padding. [ruby-dev:39856]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-09 00:50:37 +00:00
yugui
1c2ef61035
* string.c (rb_str_justify): CVE-2009-4124.
...
Fixes a bug reported by
Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;
Patch by nobu.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-07 04:11:26 +00:00
nobu
4d786d21e3
* removed spaces just before tabs.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
nobu
612b74343e
* string.c (str_utf8_nth): no count_utf8_lead_bytes_with_word
...
optimization for short string. [ruby-core:26787]
* string.c (str_utf8_offset): str_utf8_nth never return NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 01:17:11 +00:00
nobu
e43c0bde53
* string.c (str_utf8_nth): fixed overrun. [ruby-core:26787]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-17 23:41:44 +00:00
marcandre
54b5ac5663
* string.c (rb_str_each_line): rdoc fix
...
* ext/bigdecimal/bigdecimal.c (#infinite?, #nonzero?): rdoc fix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-09 06:50:29 +00:00
nobu
f41eaf8431
* random.c (rb_hash_start): moved from string.c.
...
* random.c (Init_RandomSeed2): register global address before set.
* random.c (Init_RandomSeed): initialize hashseed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 23:50:51 +00:00
naruse
a1fc9cd582
* string.c (rb_str_upto): make next object before yield its block.
...
fix: can modify original begin string of String#upto.
[ruby-dev:26384] [ruby-dev:39626] #2327
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 15:16:55 +00:00
matz
104c5f6b55
* string.c (trnext): detect empty range and raise exception.
...
[ruby-dev:39108]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-30 09:58:25 +00:00
nobu
2aa4d69d78
* string.c (rb_str_sub_bang): trivial optimization.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 19:44:58 +00:00
marcandre
705c567194
* string.c: rdoc for <=>, casecmp
...
* bignum.c: rdoc for <=>
* file.c: ditto
* time.c: ditto
* compar.c: rdoc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 04:50:09 +00:00
nobu
121d15ddda
* string.c (chopped_length): get rid of unexpected exception.
...
see [ruby-core:26336].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-27 07:36:54 +00:00
akr
775174bb76
fix a typo.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-17 11:12:05 +00:00
nobu
37531934e6
* parse.y (rb_intern3): check symbol table overflow.
...
[ruby-core:26092]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-15 07:57:40 +00:00
marcandre
499a59d543
* string.c (rb_check_string_type): rdoc fix [ruby-core:26084]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-14 13:41:33 +00:00
nobu
ec0e370eb5
* string.c (rb_str_inspect): copy by chunks.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-07 17:46:34 +00:00
naruse
be9766c37e
* string.c (rb_str_inspect): don't assign -1 to unsigned int.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-07 00:35:24 +00:00
matz
a120569068
* string.c (rb_str_upto): RDoc updated. a patch from Nobuhiro
...
IMAI <nov at yo.rim.or.jp> in [ruby-dev:39440]. [ruby-dev:39439]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-06 15:58:12 +00:00
matz
40229f892c
* array.c (rb_ary_{times, shuffle_bang, sample}): reducing macro
...
calls inside of the loop by keeping pointers in local
variables. a patch from Masahiro Kanai (CanI) in [ruby-dev:39406].
It was found and fixed at Security and Programming camp 2009.
* string.c (rb_str_{times, split_m}): ditto.
* struct.c (rb_struct_{getmember, set, aref_id, aset_id}, {make,
inspect}_struct, recursive_{equal, hash, eql}): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-05 14:35:39 +00:00
naruse
5b2d54be66
Escape as \x{XXXX} other than Unicode chars.
...
* string.c (rb_str_inspect): escape as \x{XXXX} when the encoding is
other than Unicode. [ruby-dev:39388]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-29 15:02:59 +00:00
naruse
3058eec581
* string.c (rb_str_inspect): dump as \uXXXX when the
...
string is in Unicode. [ruby-dev:39388]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-29 00:34:06 +00:00
naruse
e0af046ad0
* hash.c (rb_f_getenv): use rb_filesystem_str_new_cstr
...
instead of rb_str_new2.
ENV['PATH'].encoding should be Filesystem Encoding
because its content is related to filesystem.
see [ruby-dev:39393]
* hash.c (env_fetch): ditto.
* string.c (rb_filesystem_str_new): defined.
* string.c (rb_filesystem_str_new_cstr): ditto.
* include/ruby/intern.h (rb_filesystem_str_new): added.
* include/ruby/intern.h (rb_filesystem_str_new_cstr): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-28 19:24:18 +00:00
nobu
37c552e550
* string.c (str_buf_cat2): optimize since all second arguments are
...
constant literals.
* string.c (str_cat_char): unused now.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-27 03:01:44 +00:00
nobu
fd58dba97f
* string.c (rb_hash_{uint{32,},end}): removed.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-27 02:58:37 +00:00
naruse
036c701bad
String#inspect's encoding should be fixed.
...
* string.c (rb_str_inspect): result's encoding should be fixed.
If default_internal is not nil, the encoding is default_internal.
Else if default_external is not nil, the encoding is default_external.
But the encoding is not ASCII-compatible, the encoding is replaced by
US-ASCII.
Characters in ASCII-incompatible encoding or non ASCII characters
in other than the encoding will be \xXX escaped.
* string.c (str_buf_cat2): defined.
* string.c (prefix_escape): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-26 20:17:52 +00:00
ko1
6ed425d55b
* string.c: use rename-macro instead of RUBY_ALIAS_FUNCTION_TYPE.
...
Because build causes failure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-26 17:02:43 +00:00
nobu
f2103ee4a9
* st.c: moved murmur hash from string.c. [ruby-dev:39376]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-26 14:29:13 +00:00
nobu
bf4ab7f610
* string.c (hash): updated to MurmurHash 2.0 2009-09-19.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-26 07:48:33 +00:00
nobu
8367245839
* string.c (rb_hash_start): fixed shift width on 128bit platform.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-26 07:32:03 +00:00
nobu
1b541acd69
* string.c (rb_str_upto): keep first width. [ruby-dev:39361]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-23 04:14:23 +00:00
nobu
bdde51172c
* string.c: added rdocs for symbol.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-18 15:42:59 +00:00
nobu
ffcd041c7a
* string.c: fixed types.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-18 15:17:17 +00:00
naruse
a8154060ab
Use rb_isspace for ASCII-incompatible strings.
...
* string.c (rb_str_split_m): use rb_isspace when the string
may be ASCII-incompatible.
(rb_str_lstrip_bang): ditto.
(rb_str_rstrip_bang): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-15 05:27:29 +00:00
matz
5860ba548e
* string.c (rb_str_lstrip_bang): use ascii_isspace(). [ruby-dev:39322]
...
* string.c (rb_str_rstrip_bang): ditto.
* string.c (rb_str_split_m): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-14 18:10:00 +00:00
naruse
011776b4a6
* string.c (rb_str_inspect): use rb_enc_mbc_to_codepoint
...
because we already knew char is found and got length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-14 01:11:05 +00:00
nobu
31b7ae00c0
* include/ruby/st.h (st_hash_func): use st_index_t.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
matz
b21088b431
* string.c (rb_str_upto): generate numerical sequence when
...
characters in both edges are all digits. [ruby-talk:343186]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 22:43:48 +00:00
ko1
8e8e34319b
* insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h: check
...
definition of (classes)#=== for case/when optimization.
Fix Bug #1376 [ruby-core:23190].
* string.c (Init_String), bignum.c (Init_Bignum),
numeric.c (Init_Numeric): define String#===, Symbol#===,
Bignum#===, Fixnum#===, Float#=== as same as (classes)#==.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-12 05:55:06 +00:00
nobu
265bd9e661
* string.c (rb_str_new_frozen): must not change encoding of frozen
...
shared string. [ruby-dev:39068]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-12 04:00:03 +00:00
naruse
8cdfbfd844
* string.c (tr_trans): change condition of singlebyte optimization.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-01 10:25:48 +00:00
naruse
c4641d6a00
Can't use singlebyte optimization when the replacement is multibyte. [ruby-core:24612]
...
* string.c (tr_trans): can't use singlebyte optimization when
the replacement is multibyte. [ruby-core:24612]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-31 20:36:04 +00:00
nobu
33151fcfe4
* string.c (rb_str_hash_cmp): got rid of overflow.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:43:30 +00:00
naruse
6a3931e0f6
Check pos and strlen on Regexp#index(str, pos) [ruby-core:23660]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-14 08:30:54 +00:00
matz
a5e227edfe
* hash.c (rb_hash_hash): documentation fix. a patch from
...
Marc-Andre Lafortune. [ruby-core:23943]
* object.c (rb_mod_cmp): ditto.
* range.c (range_eq): ditto.
* string.c (rb_str_partition, rb_str_rpartition): ditto.
* struct.c (rb_struct_s_def): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 21:20:44 +00:00
matz
5d7a215f6e
* re.c (reg_match_pos): adjust offset based on characters, not
...
bytes. [ruby-dev:38722]
* string.c (rb_str_offset): new function.
* string.c (rb_str_index_m): no call to rb_reg_adjust_startpos().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-30 09:06:48 +00:00
ko1
3caa4ee5e5
* array.c (rb_ary_memsize): added.
...
* io.c (rb_io_memsize): added.
* regcomp.c (onig_memsize): added.
* string.c (rb_str_memsize): added.
* transcode.c (rb_transcoding_memsize, rb_econv_memsize): added.
* variable.c (rb_geneic_ivar_memsize): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 22:36:27 +00:00
nobu
7915aed875
* string.c (str_replace_shared): shared target must be frozen.
...
[ruby-core:23727]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-11 17:41:27 +00:00
matz
c5949a0e58
* string.c (rb_str_gsub_bang): modify check at the beginning.
...
[ruby-core:23662] ref [ruby-core:23657]
* string.c (rb_str_rstrip_bang): ditto. [ruby-core:23657]
* string.c (rb_str_chop_bang): ditto.
* string.c (rb_str_chomp_bang): ditto.
* string.c (rb_str_reverse_bang): modify check added. [ruby-core:23671]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-02 15:24:23 +00:00
nobu
5ac1389aea
* string.c (rb_str_each_char, rb_str_each_codepoint): string
...
length must be long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-25 18:38:46 +00:00
matz
970cfee510
* string.c (rb_str_hash): avoid calling rb_enc_str_asciionly_p().
...
* string.c (rb_str_replace): avoid redundant calling rb_str_new4().
* string.c (str_replace): factor out replacement from
rb_str_replace() without type check nor discarding the
destination contents.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-25 00:43:23 +00:00
nobu
d629684bb9
* string.c (rb_str_rpartition): ditto.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-24 23:06:57 +00:00
nobu
7a938f98f9
* string.c (rb_str_partition): should use the converted result. a
...
patch from Marc-Andre Lafortune at [ruby-core:23540].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-24 22:50:11 +00:00
matz
0fd3bdac6a
* string.c (rb_str_each_char): return original string.
...
[ruby-core:23499]
* string.c (rb_str_each_codepoint): protect string from
modification.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-23 15:59:09 +00:00
matz
3ee7fcc763
* string.c (rb_str_count): optimized for 1byte string count by
...
avoiding tr_setup_table().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-21 20:08:03 +00:00
matz
0980fe7903
* encoding.c (rb_enc_fast_mbclen): faster mbclen for strings known
...
to be valid.
* string.c (enc_strlen): coderange specified version of
rb_enc_strlen(). use rb_enc_fast_mbclen() if coderange is 7bit
or valid.
* string.c (str_gsub): use rb_enc_fast_mbclen().
* string.c (rb_str_reverse, rb_str_split_m, rb_str_each_char,
scan_once): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-20 04:44:36 +00:00
matz
91e5ba1cb8
* encoding.c (rb_enc_codepoint_len): combine rb_enc_codepoint()
...
and rb_enc_codelen() in one function to reduce calls.
* encoding.c (rb_enc_codepoint): compatibility function.
* sprintf.c (rb_str_format): use rb_enc_codepoint_len().
* string.c (rb_str_inspect, rb_str_upcase_bang,
rb_str_downcase_bang, rb_str_capitalize_bang,
rb_str_swapcase_bang, trnext, tr_trans, rb_str_delete_bang,
rb_str_squeeze_bang, rb_str_count, rb_str_split_m,
rb_str_each_line, rb_str_each_codepoint, rb_str_lstrip_bang,
sym_printable): ditto.
* transcode.c (make_econv_exception): use rb_enc_mbc_to_codepoint()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-19 16:59:22 +00:00
akr
d3cf82e22a
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-09 11:01:47 +00:00
nobu
013b277316
* string.c, include/ruby/encoding.h: fixed types.
...
* include/ruby/encoding.h (rb_enc_nth): long is used for index.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-07 05:16:26 +00:00
matz
254d12215c
* string.c (rb_str_split_m): faster processing on 7bit strings.
...
* string.c (ascii_isspace): faster isspace() for 7bit strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-20 15:04:18 +00:00
mame
a5596dc6a3
* string.c (rb_str_dump): buffer length plus one byte for null
...
terminator. [ruby-dev:38294]
* test/ruby/test_m17n.rb (test_str_dump): add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-08 13:05:07 +00:00
nobu
6387c5dc8c
* string.c (rb_str_rstrip_bang): should not sign-expand non-ascii.
...
[ruby-core:23158]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-08 11:08:18 +00:00
naruse
8b95a0df1b
* string.c (rb_str_chop_bang): reset coderange. [ruby-core:23155]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-08 08:31:25 +00:00
nobu
22cde7b682
* dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,
...
string.c, util.c, variable.c: use strlcpy, memcpy and snprintf
instead of strcpy, strncpy and sprintf.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17 01:29:17 +00:00
nobu
8c8f85ed4f
* string.c (rb_hash_uint, rb_hash_start, rb_hash_end): use VALUE
...
rather than unsigned int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-15 02:11:45 +00:00
akr
f414bd65ae
* string.c (rb_str_subpat): accept capture name.
...
(rb_str_aref): follow above change.
(rb_str_aref_m): pass the 2nd argument to rb_str_subpat.
(rb_str_subpat_set): accept capture name.
(rb_str_aset): follow above change.
(rb_str_partition): ditto.
(rb_str_aset_m): pass the 2nd argument to rb_str_subpat_set.
* include/ruby/intern.h (rb_reg_backref_number): declared.
* re.c (rb_reg_backref_number): defined.
[ruby-core:21057]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 18:04:21 +00:00
nobu
d1abc53721
* array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
...
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
transcode_data.h, util.c, variable.c, vm_dump.c,
include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
suppress VC type warnings. [ruby-core:22726]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
nobu
2e54fe9d4d
* array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,
...
missing/crypt.c, missing/vsnprintf.c, : suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-10 05:43:14 +00:00
nobu
3dc758d966
* string.c (str_eql): extracted from rb_str_equal and rb_str_eql.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-05 01:29:12 +00:00
nobu
37dd754e97
* string.c (rb_str_chomp_bang): keeps 7bit coderange.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-05 01:24:57 +00:00
nobu
dd43561fd6
* string.c (rb_str_each_line): constified.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-25 03:29:25 +00:00
nobu
43b9684962
* string.c (rb_str_force_encoding): should clear coderange at changing
...
encoding. [ruby-core:22437]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-25 03:28:00 +00:00
nobu
6dd9388545
* string.c (rb_str_chomp_bang): coderange may change.
...
[ruby-core:22414]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-24 17:28:56 +00:00
nobu
42eeb2c1b1
* string.c (rb_str_delete_bang): should recalculate coderange.
...
[ruby-talk:329267]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-24 17:17:35 +00:00
nobu
83930529b2
stripped trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:26:27 +00:00
nobu
624d07b0e4
* string.c (tr_trans): should recalculate coderange.
...
[ruby-core:22326] (reopened at [ruby-core:22328])
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 13:42:22 +00:00
nobu
bc59123dc0
* string.c (tr_trans): should not be affected by the encoding of
...
replacement unless actually modified. [ruby-talk:328967]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 05:33:07 +00:00
nobu
1128e61562
* array.c (rb_ary_resurrect), string.c (rb_str_resurrect): new
...
functions based on [ruby-dev:37983]
* insns.def (putstring, duparray): use rb_{ary,str}_resurrect().
* iseq.c (iseq_data_to_ary): needs to result TS_VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 05:33:36 +00:00
nobu
62dd7a00fc
* string.c (rb_str_shared_replace): no need for
...
str_make_independent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-17 03:50:59 +00:00
mame
e722ad99d5
* string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),
...
include/ruby/intern.h: add Murmurhash API. [ruby-dev:37784]
* complex.c (nucomp_hash), array.c (rb_ary_hash), time.c (time_hash),
string.c (rb_str_hsah), object.c (rb_obj_hash), range.c
(range_hash), struct.c (rb_struct_hash), hash.c (rb_any_hash),
rational.c (nurat_hash): use Murmurhash. [ruby-dev:37784]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 19:55:34 +00:00
naruse
28eb7acf2c
* string.c (rb_external_str_new_with_enc): change evaluatioin order
...
for speed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-13 22:31:46 +00:00
nobu
e52da91987
* compile.c (compile_array_, defined_expr, iseq_compile_each): hide
...
and freeze internal literal objects, to prevent from modifying.
[ruby-dev:37959]
* iseq.c (insn_operand_intern): copy internal literal objects.
* insns.def (putstring, duparray): ditto.
* string.c (rb_str_replace): exported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-12 10:42:36 +00:00
matz
68ac487d19
* string.c (rb_str_each_codepoint): update RDoc for
...
String#codepoints. a patch from Radoslaw Bulat in
[ruby-core:21835]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-05 17:53:26 +00:00
akr
6ae8b15d93
* string.c (rb_str_dump): use MBCLEN_CHARFOUND_P properly.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-04 12:58:30 +00:00
nobu
c5dea4c69d
* string.c (hash): suppress a warning.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-21 06:26:51 +00:00
nobu
e77a0b7b24
* string.c (hash): fixed the tail bytes handling in the aligned
...
access case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-20 04:02:42 +00:00
nobu
d66c0cf368
* string.c (hash): fixed typo. [ruby-dev:37791]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 18:42:46 +00:00
nobu
42d9223a2d
* string.c (hash): defaulted to MurmurHash 2.0.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 08:32:41 +00:00
nobu
768988f918
* string.c (hash): added MurmurHash 2.0.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 07:32:42 +00:00
matz
5e62997245
* string.c (rb_external_str_new_with_enc): set ASCII-8BIT if
...
encoding is US-ASCII and string contains 8bit characters.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 15:13:18 +00:00
matz
f77f9da445
* string.c (rb_str_upto): should return enumerator if called
...
without block. [ruby-dev:37526]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-22 02:12:37 +00:00
nobu
6bcd363ebf
* string.c (rb_str_hash): gets rid of collisions between different
...
encoding strings. [ruby-core:20526]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-17 02:01:37 +00:00
matz
3d28b3bf3b
* string.c (sym_printable): wrong condition for string iteration.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-13 10:35:06 +00:00
matz
0241c6506f
* string.c (sym_inspect): quote if symbol contains non-printable
...
characters. [ruby-dev:37398]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-13 08:09:23 +00:00
matz
d6023d88a2
* string.c (sym_equal): remove documentation error "Otherwise,
...
compares them as strings". [ruby-dev:37398]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-13 08:07:40 +00:00
nobu
dab7d5d8e3
* string.c (rb_string_value_ptr, rb_to_id): do not use a side
...
effect expression in RSTRING_PTR.
* string.c (rb_str_split_m): simplified the argument of
RSTRING_LEN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-12 01:19:23 +00:00
nobu
cc1401e504
* string.c (rb_str_cmp_m): fixed rdoc. pointed out by <Thomas
...
C. Mitchell AT gmail.com> at [ruby-talk:321967]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-05 01:01:53 +00:00
nobu
53e7e2d2a1
* string.c (sym_to_proc): tabified.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-04 16:39:07 +00:00
nobu
c7bd98b7b8
* string.c (sym_to_proc): use hidden object.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-04 16:35:10 +00:00
nobu
f149326740
* string.c (sym_to_proc): caches Symbol procs, based on a patch from
...
Shumpei Akai <admin AT flexfrank.net>. [ruby-dev:37265]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-04 15:17:21 +00:00
nobu
cc7ff9d2f9
* include/ruby/intern.h (rb_{external,locale}_str_new_cstr): optimized
...
versions for literal strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-11 18:31:06 +00:00
matz
80d16e7403
* ext/curses/curses.c: curses encoding should obey locale.
...
* ext/curses/curses.c (curses_getch): 1.9 getch should return one
character string for single byte string. wchar_t support may
follow in the future.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-07 21:42:24 +00:00
matz
1d8b7bc624
* string.c (Init_String): remove Symbol#===. [ruby-dev:37026]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-06 22:18:34 +00:00
matz
f27e4c045f
* string.c (rb_str_check_dummy_enc): new function to check dummy
...
encoding.
* string.c (rb_str_upcase_bang): case conversion functions should
not be applicable to strings in dummy encoding. [ruby-dev:36985]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 16:44:24 +00:00
mame
6bacaabffd
* string.c (rb_str_cmp): fix condition which always returned true
...
because ENCODING_GET returns unsigned long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 16:30:02 +00:00
matz
3896936492
* string.c (rb_str_dump): should have removed commented out
...
unnecessary code. [ruby-cvs:27131]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-24 10:58:33 +00:00
shyouhei
78d2b00893
* string.c (rb_str_dump): do not use C++ comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-24 10:30:09 +00:00
matz
5a8db29b59
* string.c (rb_str_dump): use \u{ff} escape for UTF-8 encoding
...
string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-23 06:53:55 +00:00
matz
38c7a687e1
* string.c (rb_str_conv_enc_opts): new function to convert with
...
specifying ecflags and ecopts.
* ext/zlib/zlib.c (gzfile_newstr): specify ecflags and ecopts for
conversion using above function.
* ext/zlib/zlib.c (gzfile_newstr): use own rb_econv_t for dummy
encoding to handling stateful encoding (e.g. iso-2022-jp).
[ruby-dev:36857]
* ext/zlib/zlib.c (gzfile_getc): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-22 16:53:50 +00:00
matz
4a3f2a7bc5
* string.c (rb_external_str_new_with_enc): no implicit strlen call.
...
[ruby-dev:36854]
* string.c (rb_external_str_new_cstr): new function to create
string from external NUL terminated C string.
* string.c (rb_locale_str_new_cstr): ditto.
* ext/readline/readline.c: now use rb_locale_str_new_cstr().
* test/sdbm/test_sdbm.rb (TestSDBM#test_delete_with_block):
deleted key to the block may be a copy of specified key.
* test/dbm/test_dbm.rb (TestDBM#test_delete_with_block): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-22 05:55:22 +00:00
matz
fa127bbb18
* string.c (rb_external_str_new_with_enc): wrong condition to
...
calculate strlen().
* ext/readline/readline.c: add encoding support.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-21 15:52:07 +00:00
matz
b6ef272d02
* ext/zlib/zlib.c: remove obsolete prototype macros.
...
* ext/zlib/zlib.c (struct gzfile): add encoding field to gzfile
structure.
* ext/zlib/zlib.c (rb_gzreader_getc): now works on characters.
* ext/zlib/zlib.c (rb_gzreader_getbyte): new method to retrieve
single byte.
* ext/zlib/zlib.c (rb_gzreader_readbyte): ditto.
* ext/zlib/zlib.c (rb_gzreader_each_byte): renamed from each_char
* ext/zlib/zlib.c (rb_gzreader_ungetc): allow unget strings.
* ext/zlib/zlib.c (rb_gzreader_ungetbyte): renamed from ungetc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-21 09:18:34 +00:00
matz
6259c87d02
* include/ruby/ruby.h (ExportStringValue): new macro to convert
...
string in internal encoding to external to export.
* string.c (rb_str_export): new function to do conversion to
external encoding.
* ext/sdbm/init.c: encoding conversion support.
* ext/dbm/dbm.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-20 08:05:44 +00:00
matz
52b3e3b97f
* string.c (rb_locale_str_new): new function to convert string
...
from locale to internal encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-20 07:15:19 +00:00
matz
3f0ec8887f
* string.c (rb_external_str_new): a new function to convert from
...
external encoding to internal encoding. if something went
wrong, it returns a string with the external encoding.
* string.c (rb_external_str_new_with_enc): same as above besides
you can specify the source encoding.
* ruby.c (ruby_set_argv): use rb_external_str_new()
* ruby.c (set_arg0, ruby_script): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-18 10:36:20 +00:00
matz
1e8bbf3154
* .gdbinit (rp): REGEXP handling fixed.
...
* string.c (rb_str_rindex_m): need not to call rb_enc_check on
regexp.
* re.c (unescape_escaped_nonascii): try ASCII-8BIT encoding for
broken strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-16 22:21:42 +00:00
matz
f2f2cd5bc6
* string.c (rb_str_comparable): string comparison should be
...
transitive. [ruby-dev:36484]
* test/ruby/test_m17n_comb.rb (TestM17NComb#test_str_eq): test
updated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-06 03:22:56 +00:00
akr
bd421aa2d2
* string.c (rb_str_sub_bang): fix coderange.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-02 11:46:40 +00:00
matz
d370a79c69
* string.c (rb_str_split_m): should use rb_str_subseq() which use
...
offset and length by bytes. [ruby-dev:36641]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-30 16:18:27 +00:00
akr
eace50a9d7
* string.c (rb_str_subseq): don't use rb_str_drop_bytes for short
...
string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-29 14:39:20 +00:00
akr
ebb3ace825
* string.c (rb_str_subseq): use rb_str_drop_bytes if possible.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-29 11:56:43 +00:00
nobu
8d397604bf
* string.c (str_new): sets empty string to coderange 7bit.
...
[ruby-core:18993]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-28 03:04:21 +00:00
usa
00e9e27b69
* string.c (rb_str_rstrip_bang): raise exception when the encoding of
...
the string is dummy.
* string.c (rb_str_rstrip_bang): remove nul characters even if the
encoding of the string is not single byte optimizable.
fixed [ruby-core:18844], reported by Michael Selig.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 14:01:41 +00:00
usa
a69021a699
* string.c (rb_str_strip_bang): workaround for VC++8 x64.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 10:04:20 +00:00
matz
922048adee
* string.c (rb_str_rstrip_bang): removing mixed spaces and nuls at
...
the end of strings. [ruby-dev:36497]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 07:00:43 +00:00
akr
e7e5b731c2
* string.c (rb_str_casecmp): make the ordering consistent with
...
String#<=>.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 12:27:35 +00:00
matz
c3e2e0e53f
* string.c (rb_str_comparable): make ascii8bit string to be
...
compatible with any other encoding.
* string.c (rb_str_cmp): use rb_str_comparable() instead of
rb_enc_compatible() since <=> is a comparison anyway.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-18 13:17:41 +00:00
akr
081c802cb9
* grapheme cluster implementation reverted. [ruby-dev:36375]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-18 12:53:25 +00:00
akr
635b15d662
* string.c (rb_str_casecmp): don't use rb_enc_codepoint.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-17 12:50:52 +00:00
akr
a67d4fa01c
* include/ruby/oniguruma.h (OnigEncodingTypeST): add precise_ret
...
argument for mbc_to_code.
(ONIGENC_MBC_TO_CODE): provide NULL for precise_ret.
(ONIGENC_MBC_PRECISE_CODEPOINT): defined.
* include/ruby/encoding.h (rb_enc_mbc_precise_codepoint): defined.
* regenc.h (onigenc_single_byte_mbc_to_code): precise_ret argument
added.
(onigenc_mbn_mbc_to_code): ditto.
* regenc.c (onigenc_single_byte_mbc_to_code): precise_ret argument
added.
(onigenc_mbn_mbc_to_code): ditto.
* string.c (count_utf8_lead_bytes_with_word): removed.
(str_utf8_nth): removed.
(str_utf8_offset): removed.
(str_strlen): UTF-8 codepoint oriented optimization removed.
(rb_str_substr): ditto.
(enc_succ_char): use rb_enc_mbc_precise_codepoint.
(enc_pred_char): ditto.
(rb_str_succ): ditto.
* encoding.c (rb_enc_ascget): check length with
rb_enc_mbc_precise_codepoint.
(rb_enc_codepoint): use rb_enc_mbc_precise_codepoint.
* regexec.c (string_cmp_ic): add text_end argument.
(match_at): check end of character after exact string matches.
* enc/utf_8.c (graphme_table): defined for extended graphme cluster
boundary.
(grapheme_cmp): defined.
(get_grapheme_properties): defined.
(grapheme_boundary_p): defined.
(MAX_BYTES_LENGTH): defined.
(comb_char_enc_len): defined.
(mbc_to_code0): extracted from mbc_to_code.
(mbc_to_code): use mbc_to_code0.
(left_adjust_combchar_head): defined.
(utf_8): use a extended graphme cluster as a unit.
* enc/unicode.c (onigenc_unicode_mbc_case_fold): use
ONIGENC_MBC_PRECISE_CODEPOINT to extract codepoints.
(onigenc_unicode_get_case_fold_codes_by_str): ditto.
* enc/euc_jp.c (mbc_to_code): follow mbc_to_code field change.
use onigenc_mbn_mbc_to_code.
* enc/shift_jis.c (mbc_to_code): ditto.
* enc/emacs_mule.c (mbc_to_code): ditto.
* enc/gbk.c (gbk_mbc_to_code): follow mbc_to_code field and
onigenc_mbn_mbc_to_code change.
* enc/cp949.c (cp949_mbc_to_code): ditto.
* enc/big5.c (big5_mbc_to_code): ditto.
* enc/euc_tw.c (euctw_mbc_to_code): ditto.
* enc/euc_kr.c (euckr_mbc_to_code): ditto.
* enc/gb18030.c (gb18030_mbc_to_code): ditto.
* enc/utf_32be.c (utf32be_mbc_to_code): follow mbc_to_code field
change.
* enc/utf_16be.c (utf16be_mbc_to_code): ditto.
* enc/utf_32le.c (utf32le_mbc_to_code): ditto.
* enc/utf_16le.c (utf16le_mbc_to_code): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 16:48:05 +00:00
naruse
8b31af74b7
* string.c (rb_str_concat): fix rdoc. (codepoint is integer)
...
* string.c (rb_str_each_codepoint): use UINT2NUM.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 13:23:16 +00:00
nobu
507658bd54
* string.c (rb_str_crypt): orthodox crypt() sees only first two bytes
...
of salt.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 12:33:40 +00:00
matz
0df867f933
* string.c (rb_str_each_codepoint): add new methods, #codepoints
...
and #each_codepoint. a patch from Michael Selig
<michael.selig at fs.com.au> in [ruby-core:18532].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 03:14:41 +00:00
matz
377eb14a9f
* string.c ():
...
* string.c ():
* string.c (single_byte_optimizable): make function inline. based
on a patch from Michael Selig <michael.selig at fs.com.au> in
[ruby-core:18532].
* string.c (str_modify_keep_cr): new function act as
rb_str_modify(), but don't clear coderange
* string.c (rb_str_casecmp): specialized for single byte strings.
* string.c (rb_str_splice): preserve coderange.
* string.c (rb_str_slice_bang, rb_str_reverse_bang,
rb_str_upcase_bang, rb_str_downcase_bang, tr_trans,
rb_str_capitalize_bang, rb_str_swapcase_bang,
rb_str_delete_bang, rb_str_chop_bang, rb_str_chomp_bang,
rb_str_lstrip_bang, rb_str_rstrip_bang): ditto.
* string.c (rb_str_clear): preset coderange.
* string.c (rb_str_split_m): specialized for splitting with a
string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 00:47:20 +00:00
naruse
b0c70a8856
* string.c (rb_str_buf_cat_ascii): codepoint is unsigned int.
...
* string.c (rb_str_concat): ditto.
* string.c (str_cat_char): ditto.
* string.c (prefix_escape): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 17:05:00 +00:00
matz
b121e47b44
* string.c (rb_str_squeeze_bang): specialized for 7bit characters in
...
ASCII compatible strings.
* string.c (rb_str_count): ditto.
* string.c (tr_trans): preserve 7bit/valid coderange flag.
* string.c (rb_str_squeeze_bang): preserve previous coderange value.
* string.c (rb_str_lstrip_bang): ditto.
* string.c (rb_str_rstrip_bang): ditto.
* encoding.c (rb_default_external_encoding): preserve
default_external_encoding in a static variable.
* string.c (single_byte_optimizable): check coderange first, to
reduce number of calling rb_enc_from_index().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 14:40:00 +00:00
naruse
0791d297dd
* encoding.c (RUBY_MAX_CHAR_LEN): defined.
...
* encoding.c (str_cat_char): use RUBY_MAX_CHAR_LEN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 05:36:15 +00:00
akr
19416601a0
* include/ruby/oniguruma.h (OnigEncodingTypeST): add end argument for
...
left_adjust_char_head.
(ONIGENC_LEFT_ADJUST_CHAR_HEAD): add end argument.
(onigenc_get_left_adjust_char_head): ditto.
* include/ruby/encoding.h (rb_enc_left_char_head): add end argument.
* regenc.h (onigenc_single_byte_left_adjust_char_head): ditto.
* regenc.c (onigenc_get_right_adjust_char_head): follow the interface
change.
(onigenc_get_right_adjust_char_head_with_prev): ditto.
(onigenc_get_prev_char_head): ditto.
(onigenc_step_back): ditto.
(onigenc_get_left_adjust_char_head): ditto.
(onigenc_single_byte_code_to_mbc): ditto.
* re.c: ditto.
* string.c: ditto.
* io.c: ditto.
* regexec.c: ditto.
* enc/euc_jp.c: ditto.
* enc/cp949.c: ditto.
* enc/shift_jis.c: ditto.
* enc/gbk.c: ditto.
* enc/big5.c: ditto.
* enc/euc_tw.c: ditto.
* enc/euc_kr.c: ditto.
* enc/emacs_mule.c: ditto.
* enc/gb18030.c: ditto.
* enc/utf_8.c: ditto.
* enc/utf_16le.c: ditto.
* enc/utf_16be.c: ditto.
* enc/utf_32le.c: ditto.
* enc/utf_32be.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-13 19:23:52 +00:00
akr
a953d28e3c
* include/ruby/oniguruma.h (onigenc_get_prev_char_head): add end
...
argument.
* include/ruby/encoding.h (rb_enc_prev_char): ditto.
* regenc.c (onigenc_get_prev_char_head): add end argument.
* regparse.c: follow the interface change.
* regexec.c: ditto.
* string.c: ditto.
* parse.y: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-13 18:22:04 +00:00
akr
c965010582
* include/ruby/oniguruma.h (onigenc_get_right_adjust_char_head): add
...
end argument.
* include/ruby/encoding.h (rb_enc_right_char_head): add end argument.
* regenc.c (onigenc_get_right_adjust_char_head): use end argument.
* re.c (rb_reg_adjust_startpos): follow the interface change.
* string.c (rb_str_index): ditto.
* regexec.c (backward_search_range): ditto.
(onig_search): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-13 16:40:31 +00:00
naruse
d51b061565
* include/ruby/oniguruma.h (OnigCodePoint): unsigned long to unsigned int.
...
* include/ruby/encoding.h (rb_enc_codepoint): ditto.
* encoding.c (rb_enc_codepoint): signed int to unsigned int.
* encoding.c (rb_enc_ascget): ditto.
* string.c (rb_str_casecmp): ditto.
* string.c (enc_succ_alnum_char): ditto.
* string.c (rb_str_inspect): ditto.
* string.c (rb_str_upcase_bang): ditto.
* string.c (rb_str_downcase_bang): ditto.
* string.c (rb_str_capitalize_bang): ditto.
* string.c (rb_str_swapcase_bang): ditto.
* string.c (struct tr): ditto.
* string.c (trnext): ditto.
* string.c (tr_trans): ditto.
* string.c (tr_setup_table): ditto.
* string.c (tr_find): ditto.
* string.c (rb_str_delete_bang): ditto.
* string.c (rb_str_squeeze_bang): ditto.
* string.c (rb_str_count): ditto.
* string.c (rb_str_split_m): ditto.
* string.c (rb_str_each_line): ditto.
* string.c (rb_str_lstrip_bang): ditto.
* string.c (rb_str_rstrip_bang): ditto.
* string.c (rb_str_intern): ditto.
* dir.c (char_casecmp): ditto.
* sprintf.c (rb_str_format): ditto.
* enc/emacs_mule.c (mbc_to_code): to be 32bit clean.
* enc/emacs_mule.c (code_to_mbc): ditto.
* enc/gb18030.c (mbc_to_code): ditto.
* enc/gb18030.c (code_to_mbc): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-11 10:34:59 +00:00
kazu
6bf5c34cf2
* configure.in: Mac OS X's crypt(2) is broken with invalid salt.
...
[ruby-dev:35899]
* string.c (rb_str_crypt): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-07 08:57:53 +00:00
matz
31b6ea65bb
* include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.
...
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp>
in [ruby-dev:36102].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 18:24:21 +00:00
naruse
56c3432476
* string.c (rb_str_index_m): only regexp uses byte offset.
...
* string.c (rb_str_rindex_m): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 09:22:17 +00:00
naruse
7fc16c2377
* encoding.c (rb_enc_compatible): ASCII compatible string and US-ASCII
...
regexp is compatible. [ruby-dev:36033]
* string.c (rb_str_index_m): second argument is position of character.
by usa. [ruby-dev:36033]
* string.c (rb_str_rindex_m): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-29 02:20:23 +00:00
mame
c543447ee0
* string.c (rb_str_shared_replace): remove corrupt noembed string
...
which causes SEGV. [ruby-dev:35989]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-28 14:40:53 +00:00
nobu
5f9c188d97
* include/ruby/ruby.h (rb_intern_const): tiny optimization.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 00:20:31 +00:00