construction bits to Init_RandomSeed2. Random::DEFAULT
and Ruby internal hashes are no longer shared their seed.
* random.c (Init_RandomSeed2): ditto. And, kill evil
rb_obj_reveal() stuff.
* random.c (init_hashseed): add MT argument.
* random.c: (init_siphash): ditto.
* test/ruby/test_rand.rb (TestRand#test_default_seed): new
test for Random::DEFAULT::seed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
be return -1 as an error. Therefore, added error handling.
* ext/openssl/ossl_pkey_dsa.c (dsa_generate): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(potential divide by zero) for VisualC++. It's meaningless.
Before r26197, there is ruby_div0() in this place and it
actually made divide by zero. But now it's just garbage.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
mean the result might not have an enough cryptic strength and
easy predictable. That's no good for SecureRandom.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* common.mk: add a rule for explicit.o.
* configure.in: detect explicit_bzero and memset_s.
* include/ruby/missing.h: add explicit_bzero.
* random.c (init_randomseed): use explicit_bzero() instead of
memset(). memset could be eliminated by compiler optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
if --enable-libedit is spcified. [Bug #11751]
patched by John Hein
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Removing the indirection helps me with readability, at
least. It doesn't seem like there are many other places
in the Ruby code where macros are used like this.
[ruby-core:71735] [Feature #11749]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (parser_here_document): store dispatched result of
on_tstring_content at the last fragment of a here document.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
If the server closes a keep-alive http connection, the client socket
reaches EOF. To avoid an EOFError, detect the closed connection and
reconnect.
Added test to ensure HTTP#post succeeds even if the
keep-alive-connection has been closed by the server.
by Kristian Hanekamp <kris.hanekamp@gmail.com>
https://github.com/ruby/ruby/pull/1089 fix GH-1089
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_peephole_optimize): enable tail call
optimization for specialized indexers.
* compile.c (iseq_compile_each): blockiseq should be NULL, but not
Qnil.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
I was worried r52750 would break IO.copy_stream with things like
OpenSSL sockets which wrap IOs, but require data to be run through
through encryption/decryption filters. Apparently my worry
was unfounded, but perhaps this test will ensure this case continues
to work.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
when _FILE_OFFSET_BITS=64 is defined (= when 32-bit compile).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* beos: Drop support for BeOS now that Haiku is stable.
[Fix GH-1112]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h (rb_gc_for_fd): move to export, as referred by
ext/socket.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c: [DOC] add a missing period to File docs, to terminate
the sentence and separate from the next sentence. [Fix GH-1111]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* NEWS: Fix the issue number of `Struct#dig`, which should be
[Feature #11688]. [Fix GH-1110]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
accept(2) documents ENOMEM as a possible error, handle it
consistent with all of our other FD-allocating wrappers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* dir.c (dir_initialize): use rb_gc_for_fd for ENOMEM
* ext/socket/init.c (rsock_socket): ditto
* ext/socket/socket.c (rsock_socketpair): ditto
* internal.h (rb_gc_for_fd): prototype
* io.c (rb_gc_for_fd): remove static
[ruby-core:71623] [Feature #11727]
Manpages for opendir(2), socket(2), and socketpair(3posix)
describe ENOMEM as a possible error for each of these;
handle it consistently with our existing wrappers for
open(2)/pipe(2) etc...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This simplifies callers and makes error handling more consistent
between our pipe, open, fdopen, and dup wrappers.
This adds missing ENOMEM handling as documented in the open(2),
pipe(2freebsd), and fdopen(3posix) manpages on my system.
We also avoid repeatedly accessing `errno` which is implemented
in TLS on GNU/Linux systems and more expensive to read than a
local variable.
We may export this in internal.h for ext/socket/* and dir.c, too.
* io.c (rb_gc_for_fd): new helper function
(ruby_dup): use rb_gc_for_fd
(rb_sysopen): ditto
(rb_fdopen): ditto
(rb_pipe): ditto
[ruby-core:71623] [Feature #11727]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Some external functions I wish to call may take a long time
and unnecessarily block other threads. This may lead to performance
regressions for fast functions as releasing/acquiring the GVL is not
cheap, but can improve performance for long-running functions
in multi-threaded applications.
This also means we must reacquire the GVL when calling Ruby-defined
callbacks for Fiddle::Closure, meaning we must detect whether the
current thread has the GVL by exporting ruby_thread_has_gvl_p
in internal.h
* ext/fiddle/function.c (struct nogvl_ffi_call_args):
new struct for GVL release
(nogvl_ffi_call): new function
(function_call): adjust for GVL release
[ruby-core:71642] [Feature #11607]
* ext/fiddle/closure.c (struct callback_args):
new struct for GVL acquire
(with_gvl_callback): adjusted original callback function
(callback): wrapper for conditional GVL acquire
* ext/fiddle/depend: add dependencies
* ext/fiddle/extconf.rb: include top_srcdir for internal.h
* internal.h (ruby_thread_has_gvl_p): expose for fiddle
* vm_core.h (ruby_thread_has_gvl_p): moved to internal.h
* test/fiddle/test_function.rb (test_nogvl_poll): new test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
in $ansi_options is often also needed in CPPFLAGS,
because some feature definitions vary depending on such
standards options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Re-apply r52469 made by Kazuki Tanaka, with fixing bug about
mathn.rb compatibility. [ruby-core:68528] [Feature #10974]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
AC_TRY_CPP and AC_TRY_COMPILE pass, because some options
(e.g. -std=iso9899:1999) are not set when running C preprocessor
or building ext.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_peephole_optimize): remove unreachable code
chunk after jump/leave.
* parse.y: move dead code elimination of logical operation to
compile.c. not to warn logical operation of literal constants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_peephole_optimize): eliminate always/never
branches after a literal object and when the value is used after
the branch.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
if available, mainly for enabling some features in sockets.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (proc_options): fix pointer overrun. do not advance argv
until it is valid.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e