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

468 Коммитов

Автор SHA1 Сообщение Дата
nobu d93746490d * array.c (rb_ary_set_len): new function to set array length.
* vm_eval.c (method_missing): set the length of argv array, to mark
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-29 14:53:51 +00:00
shyouhei 710dc1afc0 * array.c: Fix typo. https://github.com/ruby/ruby/pull/36
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-26 14:37:09 +00:00
naruse 35f2f9bf13 * array.c (rb_ary_delete_at_m): use simple array literal in rdoc.
patched by samuel tonini. [ruby-core:38310] [Bug #5066]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-21 08:31:44 +00:00
nobu 6343e30c14 * array.c (ary_reject_bang): should not remove elements which are
not yielded.  [Bug #2545]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-03 04:44:53 +00:00
nobu e7047b8a37 * array.c (rb_ary_reject_bang, rb_ary_delete_if): rejected
elements should be removed.  fixed [Bug #2545]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-01 22:17:46 +00:00
naruse be953b4d1c * cont.c (cont_capture): add volatile.
On clang -O, it is needed to avoid the optimization.
  With this and llvm/clang's recent fix, clang 3.0 can
  build ruby-trunk with -O option.

* cont.c (cont_capture): use for-loop.

* array.c (rb_ary_each): add volatile and use it.

* vm_insnhelper.c (vm_call_cfunc): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-22 11:00:24 +00:00
akr 5ed8c08aa0 * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
declare internal functions.

* internal.h, vm_core.h: declare internal functions.

* array.c: include internal.h.

* common.mk: update dependency for array.o.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 08:26:19 +00:00
drbrain 8bfb41ba7e * array.c (rb_ary_drop): Improve documentation. Patch by Caley Woods.
[Ruby 1.9 - Bug #4858]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-16 22:23:25 +00:00
naruse 4e04749516 * array.c (rb_ary_sort_bang): fix rdoc.
patched by burningTyger. https://github.com/ruby/ruby/pull/11

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-22 03:05:32 +00:00
akr 67b9e488dc * array.c (ary_join_1): fix array size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-15 11:35:35 +00:00
naruse c7d3b3f1b4 * array.c (array_join): copy the encoding of the first element as
an initial encoding.

* array.c (array_join_0): ditto.

* array.c (array_join_1): ditto.

* array.c (inspect_ary): ditto.

* array.c (array_join_1): add an argument to check the appending is
  first one or not.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-15 07:08:24 +00:00
naruse 366e1c3884 * array.c (inspect_ary): don't taint the inspected result of a
recursive array.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-15 07:08:18 +00:00
kosaki e0258fa04b * array.c: documentation clarification in rotate, rotate!,
index, and rindex. [ruby-core:35144]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-09 03:12:59 +00:00
naruse f83d4b1780 Additional fix for r30736
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30 21:47:10 +00:00
naruse 88a9b87816 * array.c (rb_ary_uniq_bang): call ARY_SET_LEN(ary, 0) before
rb_resize_capa because rb_resize_capa expects resized length is
  smaller than current array length. call rb_ary_unshare before
  rb_resize_capa because rb_resize_capa losts the reference to
  original shared array.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30 20:42:40 +00:00
naruse 674ea103fa * array.c (rb_ary_join): [].join.encoding must be US-ASCII.
[ruby-list:47790]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-29 15:33:50 +00:00
akr 355c3a250d * array.c (rb_ary_times): less MEMCPY calls.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-17 14:37:05 +00:00
kazu 489d6a24e4 fix typos
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-11 06:34:14 +00:00
usa c480ca0f13 * array.c (rb_ary_resize): should care of embeded array when extending
the array.

* array.c (rb_ary_resize): need to set capa when changing the real
  size of the array.
  these are latent bugs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-11 04:09:02 +00:00
nobu 65ea2eed78 * array.c (rb_ary_modify): export.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 20:25:50 +00:00
nobu c8aaf31fdd * array.c (rb_ary_resize): new utility function. [ruby-dev:42912]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 20:10:59 +00:00
matz 11b3b5ed90 * array.c (rb_ary_dup): should copy contents only. no instance
variable, no class would be copied.  it would affect methods
  #sort, #reject, #transpose, #uniq, #compact, and #shuffle.
  [ruby-core:33640]

* array.c (rb_ary_reverse_m): ditto.

* array.c (rb_ary_rotate_m): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-09 06:46:25 +00:00
akr 8c8814230f * array.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-01 12:44:03 +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
nobu 7735e63593 * array.c (rb_ary_and, rb_ary_or), class.c (rb_mod_init_copy),
gc.c (undefine_final), time.c (time_mload): get rid of
  type-punning casts.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 22:22:18 +00:00
naruse d53e0fe330 * array.c (rb_ary_rotate_m): fix typo of rdoc.
patched by Andrei Kulakov [ruby-core:31975]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-01 05:36:33 +00:00
nobu 9614d22b5d * array.c (rb_ary_sample): removed unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-27 06:23:56 +00:00
nobu 5b7ccc0629 * array.c (rb_ary_shuffle_bang): bail out from modification during
shuffle.

* array.c (rb_ary_sample): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-26 22:57:39 +00:00
nobu 71cf670f0f * array.c (rb_ary_shuffle): rdoc fix. argument name was missing.
a patch from Run Paint Run Run at [ruby-core:31848].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-26 13:54:03 +00:00
nobu 7e4015e16d * array.c (rb_ary_shuffle_bang): check number of argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-26 00:49:54 +00:00
nobu 8554e16355 * array.c (rb_ary_{shuffle_bang,sample}): use Random class object.
* random.c (try_get_rnd): use default_rand for Random as same as
  singleton methods.

* random.c (rb_random_real): check the range of result.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-25 22:30:03 +00:00
shyouhei 2531892cbc reverted to r29091; r29092 breaks test-all
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-25 12:14:38 +00:00
nobu ae6a9009dc * array.c (rb_ary_{shuffle_bang,sample}): use Random class object.
* random.c (try_get_rnd): use default_rand for Random as same as
  singleton methods.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-25 09:00:17 +00:00
nobu 569d821929 * array.c (rb_ary_sample): use frozen shared array to get rid of
reallocation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-25 08:56:47 +00:00
nobu 2f6c0e3be3 * array.c (rb_ary_shuffle_bang, rb_ary_sample): add optional
argument random.  [ruby-dev:41923] [EXPERIMENTAL]

* random.c (rb_random_{int32,real,bytes}): fallback to normal
  method invocation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-23 22:07:39 +00:00
nobu 119da02e87 * array.c (RAND_UPTO): macro for random number.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-21 21:46:31 +00:00
mrkn 1d04aedb5a * array.c (rb_ary_permutation, rb_ary_repeated_permutation, rb_ary_repeated_combination, rb_ary_product): use ary_make_shared_copy instead of ary_make_substitution. [ruby-dev:42067] [Bug #3708]
* test/ruby/test_array.rb (test_product, test_repeated_permutation, test_repeated_combination): append assertions against [Bug #3708].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-19 03:10:15 +00:00
mrkn 354e376028 forget to commit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-18 10:13:54 +00:00
mrkn 4023ffa92f * array.c (ary_make_shared), test/ruby/test_array.rb (test_permutation): always return the original array when it is shared. [ruby-dev:42067] [Bug #3708]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-18 09:42:36 +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 87d8a3b9ce * array.c (rb_ary_clear): should not unshare embedded array, and
should make unshared array embedded.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-19 03:33:33 +00:00
nobu 10a90fbce8 * array.c (rb_ary_clear): no need to duplicate buffer just before
clearing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 12:20:14 +00:00
akr 58772d7110 * array.c (rb_ary_product): clear uninitialized elements in temporary
array.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-06 10:56:45 +00:00
nobu c22b223cb0 * array.c (rb_ary_product): need to set the length in order to get
the entries marked.  [ruby-dev:41540]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-06 01:44:38 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
shyouhei 11cef3cca3 * array.c (rb_ary_product): Use tmpary instead, to ensure marking
arrays by GC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 08:51:41 +00:00
shyouhei 97b1c9edd2 * array.c (rb_ary_product): Do not rely on GC, t0 should be
checked explicitly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 02:43:34 +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