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

794 Коммитов

Автор SHA1 Сообщение Дата
akr d3b337c58d fix spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-08 13:07:20 +00:00
akr df925d91e2 * string.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-06 15:38:14 +00:00
shyouhei f86ca53460 * string.c: fix rdoc typo.
https://github.com/shyouhei/ruby/pull/3


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 05:22:54 +00:00
naruse 2b79366f52 * string.c (rb_str_inspect): fix: extra back slash is added when
the string is dummy encoding and includes \x22 or \x5C.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-11 19:03:26 +00:00
nobu 417ea3a3c3 * string.c (rb_memhash): zero-filled strings should return
different values.  [ruby-core:33500]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-01 05:36:39 +00:00
naruse ed22b0ecee * string.c (rb_str_inspect): fix typo (not 0xFD but 0xFE).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-01 01:20:56 +00:00
naruse 05d7d889ea * string.c (rb_str_inspect): inspect as a dummy encoding string
when a UTF-16/32 (not BE/LE) string does not have a BOM.
  Unicode and some RFCs say that a string labeld as UTF-16/32
  doesn't have a BOM, it should be considered big endian.
  But many Windows programs generates little endian UTF-16
  strings without a BOM. So String#inspect treats a string
  labeled UTF-16/32 withaout a BOM as a dummy encoding string.
  patched by Martin Duerst. [ruby-core:33461]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-30 16:47:24 +00:00
naruse 220d07d2fc * string.c (rb_str_inspect): treat UTF-16 and UTF-32 as BE or LE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-24 02:20:11 +00:00
nobu 94e6c0c233 * string.c (rb_str_inspect): fix for ascii-compatible external
encoding and different encoding string.  [ruby-core:33283]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22 12:30:58 +00:00
nobu 6ade3a4291 * string.c (rb_str_inspect): append for each chars instead of bulk
copy if encoding conversion is needed.  [ruby-core:33283]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22 09:33:32 +00:00
naruse 3002e5e1f9 * string.c (rb_str_concat): set ENC_CODERANGE_VALID when the
receiver is 7BIT and the argument is non ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22 03:01:45 +00:00
nobu 742d440cba * string.c (rb_enc_cr_str_buf_cat): concatenation of valid
encoding string and invalid encoding string should result
  invalid encoding.  [ruby-core:33027]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-03 05:13:54 +00:00
nobu 30ab36c7dc * string.c (rb_str_dump): fix expected length. [ruby-core:32935]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-28 18:04:23 +00:00
nobu 23e8deaf0d * array.c, gc.c, hash.c, object.c, string.c, struct.c,
transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
  replace calls to rb_error_frozen() with rb_check_frozen().  a
  patch from Run Paint Run Run at [ruby-core:32014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24 08:14:05 +00:00
nobu 671b498070 Commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:25:29 +00:00
nobu 12cbb58819 * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:22:03 +00:00
naruse a01e628318 * numeric.c (rb_num_to_uint): added to check the range of arguments.
Mainly for negative value with NUM2UINT on 32bit environment.

* string.c (rb_str_concat): use rb_num_to_uint.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 03:56:31 +00:00
naruse 1e22306569 * string.c (rb_str_concat): use unsigned int for GB18030.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 09:25:33 +00:00
nobu f5b0cb07e2 * string.c (sym_call), vm.c (invoke_block_from_c),
vm_insnhelper.c (vm_yield_with_cfunc): pass given block.
  [ruby-core:32075]

* vm_eval.c (rb_funcall_passing_block): new function to call
  method with passing given block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-24 14:45:19 +00:00
naruse c49a1d11b9 * string.c (rb_str_to_i): fix rdoc: String#to_i raises an
exception when base is invalid. [ruby-core:31685]

Fri Sep 24 15:28:35 2010  NARUSE, Yui  <naruse@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-24 06:52:25 +00:00
naruse 955507313b * string.c (rb_str_rindex): use rb_enc_prev_char instead of repeated str_nth.
patched by Michael Selig [ruby-core:32498]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-24 06:28:35 +00:00
nobu 757f5bcb97 * string.c (rb_str_times): mentioned about Hash argument. a patch
from Daniel Bovensiepen at [ruby-core:32386].

* sprintf.c (get_hash): ditto, and fix typo.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-14 22:27:54 +00:00
naruse 09fb7189ec * string.c (tr_setup_table): optimized. don't create hash objects
when given pattern is ASCII only.

* string.c (tr_find): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-01 07:52:16 +00:00
naruse d074ef4d60 * string.c (tr_setup_table): fix bug in r29146.
Initialize table even if cflag is 0; tr_find see whether
  del is empty or not.

* string.c (tr_find): nodel can't be NULL; if NULL, it means
  it is not specified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-30 19:45:30 +00:00
naruse 1a02ec9170 * string.c (tr_setup_table): initialize negating table when
negating string is given. [ruby-core:31851]

* string.c (tr_find): add a sentence for the time when
  target characters include negating one.

* string.c (rb_str_count): move definition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-30 06:01:14 +00:00
shyouhei cff3c3d52a * string.c (rb_str_prepend): new method by Sora Harakami
[Feature #3765]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-27 07:33:19 +00:00
nobu 94fc95c8b0 Tue Aug 17 07:42:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (str_make_independent_expand): set capacity properly. a
	  patch from Peter Weldon at [ruby-core:31734].  [ruby-core:31653]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-16 22:42:46 +00:00
nobu dccf9e0c45 * configure.in, include/ruby/defines.h (RUBY_FUNC_EXPORTED): macro
to declare exported function.

* array.c (rb_ary_memsize), string.c (rb_str_memsize),
  variable.c (rb_objspace_data_type_memsize): used in
  objspace.  [ruby-dev:42022]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 06:33:06 +00:00
nobu b80ddbf461 * string.c (rb_str_set_len): bail out when buffer overflowed
probably.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-05 11:00:18 +00:00
nobu 8965ed167d * string.c (rb_str_set_len): should fail to modify shared string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-05 07:42:47 +00:00
nobu ae82480705 * string.c (str_make_independent_expand): fix buffer overflow
while shrinking.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-05 03:39:19 +00:00
mame 7eb5352e24 * string.c (rb_str_resize):: fix r28857 that failed to revert r28851.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-04 17:31:09 +00:00
nobu 5f13d888cf * string.c (rb_str_resize): reverted r28851. rb_str_resize cannot
work before the length is set.  [ruby-core:31615]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-04 11:08:28 +00:00
nobu 36044b0773 * string.c (rb_str_set_len): rb_str_modify cannot work before the
length is set, which is a precondition for rb_str_modify.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-04 10:37:05 +00:00
nobu 99d96a89ce * string.c (rb_str_resize): should copy the content properly. a
patch from Jeremy Evans at [ruby-core:31615].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-04 07:09:47 +00:00
nobu 4be5721dcb * string.c (rb_str_modify_expand, rb_str_resize): get rid of
repeating malloc and realloc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-01 14:04:39 +00:00
nobu 06e935a126 * include/ruby/ruby.h (RSTRING_GETMEM): new macro to get ptr and
len at once.

* string.c (rb_str_cmp, str_eql, rb_str_eql): trivial improvements.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-20 09:39:22 +00:00
naruse 3a6fd339d5 * string.c (rb_str_conv_enc_opts): fix infinite loop because
of ISO-2022-JP conversion with empty string.
  patched by Brian Buchanan [ruby-core:31107]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-08 08:18:07 +00:00
mame 4f7b82475a * string.c (NONASCII_MASK): NONASCII_MASK must be unsigned.
[ruby-dev:41782]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-05 15:32:35 +00:00
marcandre 2116184190 * string.c (rb_str_gsub_bang, rb_str_sub_bang, str_gsub): rdoc fix
based on patch by Run Paint [ruby-core:30938]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-30 22:14:38 +00:00
nobu 88eb029a2c * string.c (rb_str_buf_cat_escaped_char): get rid of buffer
overflow on platforms int is bigger than 32bit, and warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-06 13:37:23 +00:00
naruse 0d49737b4f * string.c (sym_inspect): Escape when the symbol is not
resulted encoding and not ascii_only. It had escaped
  ascii-incompatible string, but it is wrong.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 11:31:58 +00:00
naruse 291809f473 * string.c (rb_str_buf_cat_escaped_char): defined.
Splited from rb_str_inspect.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 11:31:54 +00:00
naruse d16fc7ca69 * string.c (rb_str_inspect): inspect as ASCII when the codepoint
of a character in Unicode string is ASCII printable one.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-31 06:04:27 +00:00
mame 701c70e068 * string.c (str_replace_shared): change embedded state atomically.
[ruby-core:29953] [ruby-dev:41456]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 14:32:18 +00:00
nobu 732e40d9b0 * string.c (sym_inspect): escape ASCII-compatible strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 09:39:41 +00:00
nobu 2138c773cc * string.c (rb_str_inspect): escape ASCII-compatible strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 09:37:06 +00:00
marcandre 914efd0b60 * proc.c (proc_lambda, unnamed_parameters): Small documentation fixes.
* re.c: ditto

* string.c: ditto

* time.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:46 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
marcandre 4afa9ed041 * array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators
    - array methods and argument naming (array -> ary, an_array -> new_ary)
    - minor improvements, typo fixed and styling issues

  Other documentation errors fixed:
    - return value was self instead of a new array (or vice-versa) for
      Array#{pop,shift,permutation,repeated_permutation,keep_if}
    - Array#rindex was missing the form with a block.

* dir.c: ditto.

* enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify
  that #each will be finish before any element is yielded.

* error.c: ditto.

* gc.c: ditto.

* hash.c: ditto.

* io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948]

* numeric.c: ditto.

* range.c: ditto.

* string.c: ditto.

* struct.c: ditto.

* vm_eval.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 05:49:55 +00:00