Граф коммитов

647 Коммитов

Автор SHA1 Сообщение Дата
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