without block returns enumerator.
patched by Michael Edgar [Bug #4847] [ruby-core:36800]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
occurrence" since first occurrence is not a specification of
Hash#key. [Ruby 1.9 - Bug #4760]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
the total size of environment block to 5,120 chars. and on such
OS, putenv() causes SEGV. So, ruby should limit the size of an
environment variable to 5,120 bytes for workaround.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
failed, because of the restriction of the size on Windows.
based on a patch from Peter Weldon at [ruby-core:32304]. fix:
Bug#3812, [ruby-core:32250]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
- 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
key during iteration. Traditionally, an exception was raised only
when rehash occurs, but it may lead to difficult bug to reproduce.
[ruby-core:23614]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(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
unsetenv is void in older BSDs (FreeBSD 6 and OpenBSD 4.5 at least).
* hash.c (ruby_setenv): don't use the result of unsetenv if unsetenv
doesn't return a value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
environments where putenv(3) is used. Raise EINVAL If a
variable name contains an '='.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (rb_hash_initialize): should do arity check as #default_proc=.
[ruby-core:26281]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
* test/ruby/test_thread.rb (test_recursive_outer): Test for above
* hash.c (rb_hash_hash): Return a sensible hash for in case of recursion [ruby-core:24648]
* range.c (rb_range_hash): ditto
* struct.c (rb_struct_hash): ditto
* array.c (rb_array_hash): ditto
* test/ruby/test_array.rb (test_hash2): test for above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (env_str_new): use rb_locale_str_new instead of
rb_tainted_str_new. rb_locale_str_new set string locale
encoding and tainted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
the result of recursive array. a patch from ujihisa at
[ruby-core:23601]. [ruby-dev:38555]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
e.g. copy.
* hash.c (rb_hash_aset): use st_insert2() to reduce redundant
st_lookup calls.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (rb_any_hash, recursive_hash): use VALUE for hash.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
value of rb_hash may be used as a hash value itself and bignums have
no unique VALUE.
* test/ruby/test_hash.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
false as hash keys. a patch from Matthias Waechter.
[ruby-core:21568]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to specify no-transcoding. and other corner case fixed.
[ruby-dev:37496]
* hash.c (rb_hash_lookup2): new function to look-up hash with
default value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
an exact instance of String, not a subclass. based on a patch
from Mike Gold <mike.gold.4433 at gmail.com> in [ruby-talk:322667].
[incompatible] [ruby-talk:322417]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
string to the encoding of the buffer.
* hash.c (rb_any_hash): typo fixed.
* ext/zlib/zlib.c (rb_gzwriter_write): oops, IO string conversion
need to be done by to_s.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
support. a patch from Yusuke Endoh <mame at tsg.ne.jp>
in [ruby-dev:35851].
* sprintf.c (rb_str_format): add gettext style named format
(%{name}) support. inspired by [ruby-dev:35852].
* sprintf.c (GETNAMEARG): should raise KeyError exception when no
named argument found.
* hash.c (rb_hash_fetch): export fetch function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c (nucomp_hash): should use hash values of the elements.
* rational.c (nurat_hash): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(rb_io_mode_modenum): declared.
(rb_close_before_exec): declared.
(struct rb_exec_arg): add options and redirect_fds field.
(rb_check_argv): removed.
(rb_exec_initarg): declared.
(rb_exec_getargs): declared.
(rb_exec_initarg2): declared.
(rb_fork): add third argument: fds.
* io.c (max_file_descriptor): new static variable to record maximum
file descriptor ruby used.
(UPDATE_MAXFD): new macro.
(UPDATE_MAXFD_PIPE): new macro.
(rb_io_mode_modenum): externed.
(rb_sysopen): update max_file_descriptor.
(rb_close_before_exec): new function.
(popen_exec): redirection removed because it is done by extended
spawn mechanism.
(pipe_open): generate a hash for spawn options to specify
redirections.
(pipe_open_v): use rb_exec_getargs.
(pipe_open_s): use rb_exec_getargs.
(rb_io_initialize): update max_file_descriptor..
* process.c (hide_obj): new function.
(check_exec_redirect_fd): new function.
(check_exec_redirect): new function.
(check_exec_options_i): new function.
(check_exec_fds): new function.
(rb_check_exec_options): new function.
(check_exec_env_i): new function.
(rb_check_exec_env): new function.
(rb_exec_getargs): new function.
(rb_exec_initarg2): new function.
(rb_exec_initarg): new function.
(rb_f_exec): use rb_exec_initarg.
(intcmp): new function.
(run_exec_dup2): new function.
(run_exec_close): new function.
(run_exec_open): new function.
(run_exec_pgroup): new function.
(run_exec_rlimit): new function.
(run_exec_options): new function.
(rb_exec): call run_exec_options.
(move_fds_to_avoid_crash): new function.
(pipe_nocrash): new function.
(rb_fork): use pipe_nocrash to avoid file descriptor conflicts.
(rb_spawn): use rb_exec_initarg.
(rlimit_resource_name2int): extracted from rlimit_resource_type.
(rlimit_type_by_hname): new function.
(rlimit_type_by_lname): new function.
(rlimit_resource_type): use rlimit_type_by_hname.
(proc_daemon): add fds argument for rb_fork.
* hash.c (rb_env_clear): renamed from env_clear and externed.
[ruby-dev:34086]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
env_reject_bang): Return an enumerator if no block is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e