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

748 Коммитов

Автор SHA1 Сообщение Дата
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
naruse ca3c007f05 * string.c (rb_str_match_m): add description about optional
position parameter. [ruby-list:47064]
  patched by KISHIMOTO, Makoto <ksmakoto AT dd.iij4u.or.jp>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-06 06:07:05 +00:00
marcandre 479fa40778 * string.c (rb_str_sub_bang): String#sub! now raises an error when
called on a frozen string, even if no change is made.
  See [ruby-core:23657]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 02:48:49 +00:00
marcandre 478c3e080b * eval.c (make_exception, rb_obj_extend): Fix error messages in case of wrong
number of arguments

* file.c (rb_f_test, rb_file_s_umask): ditto

* numeric.c (int_chr, num_step): ditto

* process.c (rb_f_sleep): ditto

* re.c (rb_reg_initialize_m): ditto

* signal.c (rb_f_kill, sig_trap): ditto

* string.c (rb_str_aref_m, rb_str_aset_m, rb_str_count, rb_str_delete_bang,
  rb_str_slice_bang, rb_str_sub_bang, str_gsub): ditto

* proc.c (curry): rdoc fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-30 02:40:57 +00:00
nobu 92496d73eb * string.c (rb_string_value_cstr): make NUL terminated if it is
not done.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-14 06:58:13 +00:00
akr d0fa628d06 * string.c (rb_str_sum): use UCHAR_MAX.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-20 13:52:34 +00:00
akr 053d89ca2b * string.c (rb_str_sum): don't call method for each byte.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-18 20:35:18 +00:00
marcandre 51ae7f6e9a * io.c: Fix documentation for each/each_line/lines, bytes/each_byte,
codepoints/each_code_point [ruby-core:23948]

* string.c: ditto

* ext/stringio/stringio.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-07 10:22:05 +00:00
mame 24684a8a34 * string.c (str_new_empty): String#split, partition, rpartition
taints the resulting strings if self is tainted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-23 15:41:34 +00:00
nobu f3f43cdbee * array.c (rb_ary_push_m, rb_ary_unshift_m, rb_ary_aset),
(rb_ary_insert, rb_ary_replace, rb_ary_concat),
  (rb_ary_uniq_bang, rb_ary_flatten_bang): check if frozen after
  wrong number of arguments but before TypeError.
  [ruby-core:28140]

* hash.c (rb_hash_replace): ditto.

* string.c (rb_str_replace): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-10 07:31:06 +00:00
mame f26bb91386 * fix the previous previous commit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-31 13:44:19 +00:00
mame 21523e3a98 * string.c (rb_string_value): make no exception for Symbol.
[ruby-dev:40274]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-31 12:46:36 +00:00
nobu 68e111176f * string.c (rb_str_inspect): suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 02:50:05 +00:00
akr 83d9e9f42e * string.c (rb_str_inspect): increment by rb_enc_mbminlen(enc) for
broken byte sequence.  [ruby-core:27748]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-24 05:22:51 +00:00
akr 4b8e14c978 * string.c (rb_enc_strlen_cr): increment by rb_enc_mbminlen(enc) for
broken byte sequence.  [ruby-core:27748]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-24 04:59:31 +00:00
nobu 441dbecf43 * string.c (rb_str_concat): fixed range check for Fixnum, and
added checks for integer overflow and invalid char code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-14 03:50:39 +00:00
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