needed. a patch from Marc-Andre Lafortune. [ruby-core:23661]
* enum.c (enum_first): call to_int once for an argument. based on
a patch from Marc-Andre Lafortune.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This change stop to install node.h beacuase of saving ABI
(node.h will be changed. Extensions should not depends on
this file).
* blockinlining.c, class.c, compile.c, debug.h, enum.c,
gc.c, iseq.c, parse.y, ruby.c, signal.c, variable.c,
vm.c, vm_core.h, vm_dump.c: ditto.
* ext/ripper/depend: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
extra calls to is_pointer_to_heap() in GC.
* enum.c (enum_zip): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
array.c (rb_ary_count): If no argument or block is given, count
the number of all elements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
the number of cycles is specified.
* array.c (rb_ary_cycle): Ditto for Array#cycle.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-dev:34313].
* array.c (rb_ary_index): Define find_index as an alias to index.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
shortest length. [ruby-core:14738]
* enum.c (enum_zip): returns array not enumerator for no block
form. [ruby-core:14738]
* enumerator.c (next_ii): do not ignore multiple values yielded.
* array.c (rb_ary_zip): faster version without creating generators.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
pack them into an array. [ruby-dev:32708]
* enum.c: all method but all?, any?, one? and none? passed packed
multiple values to the block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
compatibility with Enumerator#with_index(). a patch from Yusuke
ENDOH <mame AT tsg.ne.jp>. [ruby-dev:32195]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
elements but first n. RDoc need to be updated.
* enumerator.c (Init_Enumerator): remove unnecessary symbol
initialization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
<david AT davidflanagan.com> in [ruby-core:12710].
* enum.c (enum_take, enum_drop): ditto.
* enum.c (enum_cycle): should not cause infinite loop for empty
arrays. [ruby-core:12710]
<david AT davidflanagan.com> in [ruby-core:12710].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
given. [ruby-core:12697]
* range.c (range_last): returns last n elements if argument is
given.
* array.c (rb_ary_subseq, rb_ary_last): export.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
e.next has not been called before.
* enumerator.c (enumerator_next): raise StopIteration (name taken
from Python) instead of IndexError.
* enum.c (enum_zip): catch StopIteration exception.
* enumerator.c (enumerator_with_index): return Enumerator if no
block is given.
* test/ruby/test_iterator.rb (TestIterator::test_enumerator): add
test for enumerators.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
values from the enumerable at once.
* enum.c (enum_minmax_by): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
a patch from sheepman <sheepman AT sheepman.sakura.ne.jp>.
[ruby-dev:30846]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c (one_i): no needs to iterate once the result became false.
* enum.c (enum_one): fix for an example.
* enum.c (one_iter_i, none_iter_i): DRY.;
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
have to specify two argument method name as the first argument.
* enum.c (Init_Enumerable): reduce is new alias to inject.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/cgi.rb (CGI::out): should not convert utf-8 implicitly using
NKF. it is too Japanese centric.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(RARRAY_LEN): defined for accessing array members.
(RARRAY_PTR): ditto.
* array.c: use RARRAY_LEN and RARRAY_PTR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(for constant reference).
* eval.c (rb_call0): use TMP_ALLOC() instead of allocating
a temporary array object.
* eval.c (eval): need not to protect $SAFE value.
[ruby-core:07177]
* error.c (Init_Exception): change NameError to direct subclass of
Exception so that default rescue do not handle it silently.
* struct.c (rb_struct_select): update RDoc description.
[ruby-core:7254]
* numeric.c (int_upto): return an enumerator if no block is
attached to the method.
* numeric.c (int_downto): ditto.
* numeric.c (int_dotimes): ditto.
* enum.c (enum_first): new method Enumerable#first to take first n
element from an enumerable.
* enum.c (enum_group_by): new method Enumerable#group_by that
groups enumerable values according to their block values.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
proc object. [ruby-dev:28146]
* test/drb/drbtest.rb (DRbService::self.ext_service): increase
timeout limit. a patch from Kazuhiro NISHIYAMA
<zn at mbf.nifty.com>. [ruby-dev:28132]
* eval.c (ev_const_get): fixed a bug in constant reference during
instance_eval. [yarv-dev:707]
* eval.c (ev_const_defined): ditto.
* lib/yaml.rb (YAML::add_domain_type): typo fixed. a patch from
Joel VanderWerf <vjoel at path.berkeley.edu>.
[ruby-talk:165285] [ruby-core:6995]
* ext/digest/sha2/sha2.c (ULL): support AIX C. a patch from
Kailden <kailden at gmail.com>. [ruby-core:06984]
* ext/syck/rubyext.c (rb_syck_compile): avoid potential memory
leak.
* ext/syck/rubyext.c (syck_set_ivars): avoid potential memory
leak by explicit symbol allocation.
* lib/delegate.rb (Delegator::method_missing): should delegate
block as well.
* lib/cgi.rb (CGI::QueryExtension::MorphingBody): fix criteria to
use Tempfile. A fix from Zev Blut <rubyzbibd at ubit.com>.
[ruby-core:06076]
* string.c: remove global functions work on $_.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
protect temporary context object. [ruby-dev:27979]
* ext/iconv/iconv.c (Init_iconv): rb_gc_register_address() should
be called before actual variable initialization.
[ruby-dev:27986]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
no block is given.
* enumerator.c: moved from ext/enumerator.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (rb_ary_update): a[n,m]=nil no longer works as element
deletion.
* enum.c (enum_sort_by): protect continuation jump in.
[ruby-dev:24642]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_io_fread() by freezing it temporarily. [ruby-dev:24479]
* dir.c (rb_push_glob): block call at once the end of method.
[ruby-dev:24487]
* ext/enumerator/enumerator.c (enum_each_slice): remove
rb_gc_force_recycle() to prevent potential SEGV.
[ruby-dev:24499]
* ext/zlib/zlib.c (zstream_expand_buffer): hide internal string
buffer by clearing klass. [ruby-dev:24510]
* ext/socket/socket.c (sock_s_getservbyaname): protocol string
might be altered. [ruby-dev:24503]
* string.c (rb_str_upto): check if return value from succ is a
string. [ruby-dev:24504]
* io.c (rb_io_popen): get mode string via rb_io_flags_mode() to
avoid mode string modification. [ruby-dev:24454]
* io.c (rb_io_getline_fast): should take delim as unsigned char to
distinguish EOF and '\377'. [ruby-dev:24460]
* io.c (rb_io_getline): add check for RS modification.
[ruby-dev:24461]
* enum.c (enum_sort_by): use qsort() directly instead using
rb_iterate(). [ruby-dev:24462]
* enum.c (enum_each_with_index): remove rb_gc_force_recycle() to
prevent access to recycled object (via continuation for
example). [ruby-dev:24463]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c (rb_io_flags_mode): requires output buffer no more. no
allocation needed.
* array.c (rb_ary_index): takes a block to compare items in an
array. [ruby-talk:113069] [Ruby2]
* array.c (rb_ary_rindex): ditto.
* marshal.c (r_byte): retrieve pointer from string value for each
time. [ruby-dev:24404]
* marshal.c (r_bytes0): ditto.
* enum.c (sort_by_i): re-entrance check added. [ruby-dev:24399]
* io.c (io_read): should freeze all reading buffer.
[ruby-dev:24400]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
one defined in object.c.
* object.c (Init_Object): remove Kernel#to_a.
* enum.c (enum_zip): use "to_a" instead of "to_ary".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
return from the yielded block.
* hash.c (delete_if_i): use st_delete_safe() (via
rb_hash_delete()) instead of returning ST_DELETE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
before detach pid. [ruby-talk:71519]
* eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677],
[ruby-dev:20202]
* eval.c (BEGIN_CALLARGS): restore outer block by using
ruby_block->outer.
* eval.c (block_pass): do not alter block->prev, but block->outer.
* array.c (get_inspect_tbl): warning on wrong condition.
* eval.c (localjump_xvalue): renamed exitstatus to exit_value
since it's not exit "status" after all.
* eval.c (localjump_error): add reason to LocalJumpError.
* compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value
is nil. now take new 2 arguments.
* time.c (time_cmp): 2003-05-16 fix was incomplete.
(ruby-bugs-ja:PR#458)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
empty path, just ignore.
* dir.c: remove <sys/parm.h> inclusion.
* compar.c (cmp_eq,cmp_gt,cmp_ge,cmp_lt,cmp_le): check using
rb_cmpint().
* error.c (init_syserr): remove sys_nerr dependency.
* numeric.c (num_cmp): added to satisfy Comparable assumption.
* eval.c (rb_add_method): "initialize" should be public if it is a
singleton method.
* regex.c (re_match): avoid dereferencing if size == 0.
(ruby-bugs-ja:PR#360)
* time.c (time_cmp): should return nil if an operand is not a
number nor time. (ruby-bugs-ja:PR#359)
* file.c (rb_stat_cmp): should return nil if an operand is not
File::Stat.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
zipped with nil if argument arrays are shorter. if arrays are
longer, left items are ignored. now works with blocks.
* enum.c (zip_i): changed for new behavior.
* array.c (rb_ary_transpose): added. [new]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c (enum_find): do not use rb_eval_cmd(); should not accept
a string for if_none.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
suggested by Guy Decoux.
* hash.c (rb_hash_s_create): use rb_hash_aset() instead of calling
st_insert() directly, to dup&freeze string keys.
* parse.y (yylex): proper error message for "@@0".
* parse.y (yylex): paren to parse_string() must be zero for
unparenthesized strings.
* parse.y (str_extend): broken string when unterminated "#{".
* enum.c (enum_sort_by): had a bug in 1 element enumeration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
values; suggested by Masahiro TANAKA <masa@ir.isas.ac.jp>.
* range.c (range_step): step (for Range#step method) <= 0 makes no
sence, thus ArgError will be raised.
* range.c (range_each): Range#each method is special case for
Range#step(1)
* file.c (rb_find_file): load must be done from an abolute path if
$SAFE >= 4.
* enum.c (enum_partition): new method. [new]
* re.c (rb_reg_s_quote): quote whitespaces for /x cases.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
also be detected.
* eval.c (rb_eval_cmd): cbase should not be NULL; it should be
either ruby_wrapper or Object.
* enum.c (enum_each_with_index): should return self.
* process.c (proc_setpgrp): should return value for non-void function.
* process.c (proc_getpgid): should raise exception if getpgid() return -1.
* string.c (rb_str_ljust): should return a duplicated string.
* string.c (rb_str_rjust): ditto.
* string.c (rb_str_center): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
modifying buffer is shared.
* array.c (ary_make_shared): make an internal buffer of an array
to be shared.
* array.c (rb_ary_shift): avoid sliding an internal buffer by
using shared buffer.
* array.c (rb_ary_subseq): avoid copying the buffer.
* parse.y (gettable): should freeze __LINE__ string.
* io.c (rb_io_puts): old behavoir restored. rationale: a) if you
want to call to_s for arrays, you can just call print a, "\n".
b) to_s wastes memory if array (and sum of its contents) is
huge. c) now any object that has to_ary is treated as an array,
using rb_check_convert_type().
* hash.c (rb_hash_initialize): now accepts a block to calculate
the default value. [new]
* hash.c (rb_hash_aref): call "default" method to get the value
corrensponding to the non existing key.
* hash.c (rb_hash_default): get the default value based on the
block given to 'new'. Now it takes an optinal "key" argument.
"default" became the method to get the value for non existing
key. Users may override "default" method to change the hash
behavior.
* hash.c (rb_hash_set_default): clear the flag if a block is given
to 'new'
* object.c (Init_Object): undef Data.allocate, left Data.new.
* ext/curses/curses.c (window_scrollok): use RTEST().
* ext/curses/curses.c (window_idlok): ditto.
* ext/curses/curses.c (window_keypad): ditto.
* ext/curses/curses.c (window_idlok): idlok() may return void on
some platforms; so don't use return value.
* ext/curses/curses.c (window_scrollok): ditto for consistency.
* ext/curses/curses.c: replace FIX2INT() by typechecking NUM2INT().
* parse.y (str_extend): should not process immature #$x and
#@x interpolation, e.g #@#@ etc.
* enum.c (enum_sort_by): sort_by does not have to be stable always.
* enum.c (enum_sort_by): call qsort directly to gain performance.
* util.c (ruby_qsort): ruby_qsort(qs6) is now native thread safe.
* error.c (rb_sys_fail): it must be a bug if it's called when
errno == 0.
* regex.c (WC2MBC1ST): should not pass through > 0x80 number in UTF-8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (gc_mark_all): tweak mark order for little bit better scan.
* gc.c (rb_gc_mark): ditto.
* gc.c (rb_gc): ditto.
* enum.c (sort_by_i): slight performance boost.
* gc.c (gc_mark_rest): should call gc_mark_children(), not gc_mark().
* gc.c (rb_gc_mark): may cause infinite looop.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
POSIX_SIGNAL is defined.
* eval.c (error_print): errat array may be empty.
* eval.c (rb_eval_cmd): should not upgrade safe level unless
explicitly specified by argument newly added.
* signal.c (sig_trap): should not allow tainted trap closure.
* variable.c (rb_f_trace_var): should not allow trace_var on safe
level higher than 3.
* variable.c (rb_f_trace_var): should not allow tainted trace
closure.
* gc.c: do not use static stack until system stack overflows.
* eval.c (eval): should call Exception#exception instead of
calling rb_exc_new3() directly.
* error.c (exc_exception): set "mesg" directly to the clone. it
might be better to set mesg via some method for flexibility.
* variable.c (cvar_override_check): should print original module
name, if 'a' is T_ICLASS.
* parse.y (yylex): float '1_.0' should not be allowed.
* variable.c (var_getter): should care about var as Qfalse
(ruby-bugs#PR199).
* array.c (cmpint): <=> or block for {min,max} may return bignum.
* array.c (sort_1): use rb_compint.
* array.c (sort_2): ditto.
* enum.c (min_ii): ditto.
* enum.c (min_ii): ditto.
* enum.c (max_i): ditto.
* enum.c (max_ii): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c (umethod_bind): recv can be an instance of descender of
oklass if oklass is a Module.
* hash.c (rb_hash_equal): check identiry equality first.
* file.c (group_member): should check real gid only.
* file.c (eaccess): do not cache euid, since effective euid may be
changed via Process.euid=().
* file.c (eaccess): return -1 unless every specified access mode
is permitted.
* eval.c (rb_eval): while/until returns the value which is given
to break.
* parse.y (value_expr): using while/until/class/def as an
expression is now gives a warning, not an error.
* range.c (range_eqq): should compare strings based on magical
increment (using String#upto), not dictionary order.
* enum.c (enum_sort_by): new method for Schewartzian transformed
stable sort.
* variable.c (mod_av_set): detect constant overriding for built-in
classes/modules.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (cond0): no special treatment of string literal in
condition.
* math.c: add acos, asin, atan, conh, sinh, tanh and hypot to Math.
* configure.in: check hypot availablility.
* missing/hypot.c: public domain rewrite of hypot.
* parse.y (warn_unless_e_option): warning condition was wrong.
* parse.y (warning_unless_e_option): ditto.
* enum.c (enum_all): new method 'all?', which returns true if
block returns true for all elements.
* enum.c (enum_any): new method 'any?', which returns true if
block retruns true for any of elements.
* marshal.c (marshal_load): do not give warning unless explicitly
set to verbose.
* eval.c (rb_exit): give string value "exit" to SystemExit.
* ruby.c (proc_options): -v should not print version if
proc_options called via moreswitches().
* parse.y (stmt): while/until modifier must work for empty body.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (rb_gc_call_finalizer_at_exit): clear klass member of
terminating object.
* eval.c (rb_call): raise exception for terminated object.
* bignum.c (bigdivrem): t2 might be too big for signed long; do
not use rb_int2big(), but rb_uint2big().
* error.c (rb_load_fail): new func to report LoadError.
* ruby.c (load_file): use rb_load_fail.
* eval.c (ruby_finalize): should enclosed by PUSH_TAG/POP_TAG.
* gc.c (rb_gc_mark): link 2 of NODE_IFUNC should not be explicitly
marked. it may contain non object pointer.
* re.c (reg_s_last_match): Regexp::last_match(nth) returns nth
substring of the match (alternative for $& and $<digit>).
* eval.c (rb_mod_define_method): wrong comparison for blocks.
* gc.c (id2ref): should handle Symbol too.
* gc.c (id2ref): should print original ptr value
* eval.c (rb_iterate): NODE_CFUNC does not protect its data
(nd_tval), so create new node NODE_IFUNC for iteration C
function.
* eval.c (rb_yield_0): use NODE_IFUNC.
* gc.c (rb_gc_mark): support NODE_IFUNC.
* gc.c (mem_error): prohibit recursive mem_error().
(ruby-bugs-ja:PR#36)
* eval.c (rb_thread_fd_writable): should not switch context if
rb_thread_critical is set.
* eval.c (rb_thread_wait_fd): ditto.
* eval.c (rb_thread_wait_for): ditto.
* eval.c (rb_thread_select): ditto.
* eval.c (rb_thread_join): join during critical section causes
deadlock.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
which included commits to RCS files with non-trunk default branches.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
which included commits to RCS files with non-trunk default branches.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12 b2dd03c8-39d4-4d8f-98ff-823fe69b080e