summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2019-10-31[ruby/date] Revert "Simplify #inspect"Jeremy Evans
This reverts commit af01edd7d8575f544f647dbe8cde5b6ae535d459. Revert requested by Yui Naruse. https://github.com/ruby/date/commit/875d563557
2019-10-31[ruby/date] introduce Date::Error, raise Date::Error for everyglaszig
"invalid <anything>" type of exception https://github.com/ruby/date/commit/3e55c09ba4
2019-10-31[ruby/gdbm] Use Gemfile instead of ↵Hiroshi SHIBATA
Gem::Specification#add_development_dependency. https://github.com/ruby/gdbm/commit/bd2e7f6647
2019-10-31[ruby/gdbm] Remove taint supportJeremy Evans
Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions. https://github.com/ruby/gdbm/commit/f9aaa1a08d
2019-10-31[ruby/zlib] Remove taint supportJeremy Evans
Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions. https://github.com/ruby/zlib/commit/21711ed0ce
2019-10-30Update the latest versions from upstream repository of raccHiroshi SHIBATA
2019-10-26Update StringIO docs:zverok
* More explanations/examples in class docs; * Fix links to other methods (remove <code> tag); * Fix wording of method docs (remove *stringio* receiver name, as it is not rendered by modern RDoc); * Add option mention to linereading methods (added in 2.4); * Several other small fixes. Notes: Merged: https://github.com/ruby/ruby/pull/2615
2019-10-26[ruby/dbm] Remove taint supportJeremy Evans
Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions. https://github.com/ruby/dbm/commit/1f0ff0bce1
2019-10-24Fix typo causing Date.new(year, month) to failJeremy Evans
Add a test for this case. Notes: Merged: https://github.com/ruby/ruby/pull/2605
2019-10-24Revert "[ruby/fiddle] Use ffi_closure_free by default. (#20)"Hiroshi SHIBATA
This reverts commit ce6caade7c57a505f73086ccd7b33c14f7715f22. Notes: Merged: https://github.com/ruby/ruby/pull/2603
2019-10-24[ruby/fiddle] Remove taint support (#21)Jeremy Evans
Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions. https://github.com/ruby/fiddle/commit/18d6fb6915
2019-10-24[ruby/fiddle] Use ffi_closure_free by default. (#20)Vít Ondruch
* Use ffi_closure_free unconditionally. The current conditionals reflect historic heritage of FFI. Usage of ffi_closure_free should be better default nowadays, because libffi 3.0.5 fixing issues of ffi_closure_free should be widely available. * RUBY_LIBFFI_MODVERSION is not used anymore. Because `ffi_closure_free()` is not used unconditionally, there is no other use for RUBY_LIBFFI_MODVERSION define, so drop its usage. * Use more meaningful variable name. `ver` variable used to be used to pupulate RUBY_LIBFFI_MODVERSION define. Since the define was removed, the `libffi_dir` variable name should better describe the remaining usage of the variable. https://github.com/ruby/fiddle/commit/c49cc79eb8
2019-10-24[ruby/fiddle] Fiddle::Function must maintain a reference to the closureAaron Patterson
If the first parameter to Fiddle::Function is a closure object (rather than an interger), `rb_Integer` will cast it to an integer but not maintain a reference to the closure. Then if the closure gets GC'd, we have a segv. This commit keeps a reference to the original parameter to initialize so that the object will not be GC'd. Fixes: https://bugs.ruby-lang.org/issues/13286 https://github.com/ruby/fiddle/commit/0fc697bbc5
2019-10-24[ruby/date] Use Gemfile instead of ↵Hiroshi SHIBATA
Gem::Specification#add_development_dependency. https://github.com/ruby/date/commit/13c94362c2
2019-10-24[ruby/date] Update docszverok
https://github.com/ruby/date/commit/8c02586a98
2019-10-24[ruby/date] Simplify #inspectzverok
https://github.com/ruby/date/commit/af01edd7d8
2019-10-24[ruby/date] Remove taint supportJeremy Evans
Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous versions. https://github.com/ruby/date/commit/519470dc3b
2019-10-24[ruby/date] Support -Float::INFINITY...date rangesJeremy Evans
Fixes Ruby Bug 12961 https://github.com/ruby/date/commit/7f533c2552
2019-10-24[ruby/date] Check for numeric arguments in constructorsJeremy Evans
Previously, the type of these arguments were not checked, leading to NoMethodErrors in some cases, and TypeErrors in other cases, but not showing what field was having the problems. This change makes it so the field with the problem is included in the error message. For the valid_*? methods, this changes them to return false if one of the arguments that should be numeric is not. Fixes Ruby Bug 11935 Fixes Ruby Misc 15298 https://github.com/ruby/date/commit/a2f4b665f8
2019-10-24[ruby/date] Make julian dates roundtrip through to_time.to_dateJeremy Evans
Previously, julian dates would not round trip through to_time.to_date, because Time is always considered gregorian. This converts the Date instance from julian to gregorian before converting to Time, ensuring that an equal date object will be returned if converting that Time back to Date. This does result in julian Date objects showing different day values if converting to Time. Fixes Ruby Bug 8428. https://github.com/ruby/date/commit/d8df64555e
2019-10-21* expand tabs. [ci skip]git
Tabs were expanded because previously the file did not have any tab indentation. Please update your editor config, and use misc/expand_tabs.rb in the pre-commit hook.
2019-10-21Look up event ID offsets by token as indexNobuyoshi Nakada
2019-10-20Also BDOT2 and BDOT3 are operatorsNobuyoshi Nakada
2019-10-20Native MonitorMixin::ConditionVariable#waitKoichi Sasada
MonitorMixin::ConditionVariable#wait can be interrupted just after Monitor#exit_for_cond. So implementation in C.
2019-10-20delegate synchronize methodKoichi Sasada
Delegate MonitorMixin#synchronize body to Monitor#synchronize. It makes guarantee interrupt safe (because Monitor#synchronize is written in C). I thought Ruby implementation is also safe, but I got stuck failure <http://ci.rvm.jp/results/trunk_test@P895/2327639> so that I introduce this fix to guarantee interrupt safe.
2019-10-20make monitor.so for performance. (#2576)Koichi Sasada
Recent monitor.rb has performance problem because of interrupt handlers. 'Monitor#synchronize' is frequently used primitive so the performance of this method is important. This patch rewrite 'monitor.rb' with 'monitor.so' (C-extension) and make it faster. See [Feature #16255] for details. Monitor class objects are normal object which include MonitorMixin. This patch introduce a Monitor class which is implemented on C and MonitorMixin uses Monitor object as re-entrant (recursive) Mutex. This technique improve performance because we don't need to care atomicity and we don't need accesses to instance variables any more on Monitor class. Notes: Merged-By: ko1 <ko1@atdot.net>
2019-10-19Extend Ripper DSL to set to pseudo variables other than `$$`Nobuyoshi Nakada
2019-10-17Remove unused constant.Aaron Patterson
This constant isn't used, so lets remove it.
2019-10-17Look up constant instead of caching in a globalAaron Patterson
The global can go bad if the compactor runs, so we need to look up the constant instead of caching it in a global.
2019-10-14[flori/json] Add ascii_only option to JSON::Ext::Generator::State.new.Sho Hashimoto
https://github.com/flori/json/commit/0e99a9aac5
2019-10-14[flori/json] Add shortcut converting to StringWatson
In where to convert Hash key to String for json, this patch will add shortcut for String/Symbol in Hash key. ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 65.000 i/100ms Calculating ------------------------------------- json 659.576 (± 1.5%) i/s - 3.315k in 5.027127s ``` ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 78.000 i/100ms Calculating ------------------------------------- json 789.781 (± 2.7%) i/s - 3.978k in 5.041043s ``` ``` require 'json' require 'benchmark/ips' obj = [] 1000.times do |i| obj << { "id" => i, :age => 42, } end Benchmark.ips do |x| x.report "json" do |iter| count = 0 while count < iter JSON.generate(obj) count += 1 end end end ``` https://github.com/flori/json/commit/38c0f6dbe4
2019-10-14[flori/json] Convert Hash object using rb_hash_foreach()Watson
To convert Hash convert, this part was using following pseudo code ``` obj.keys.each do |key| value = obj[key] ... end ``` and `rb_funcall()` was called for `obj.keys`. It might be slightly heavy to call the Ruby method. This patch will iterate to convert Hash object about key/value using `rb_hash_foreach()` Ruby API instead of `rb_funcall()`. ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 55.000 i/100ms Calculating ------------------------------------- json 558.501 (± 1.1%) i/s - 2.805k in 5.022986s ``` ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 65.000 i/100ms Calculating ------------------------------------- json 659.576 (± 1.5%) i/s - 3.315k in 5.027127s ``` ``` require 'json' require 'benchmark/ips' obj = [] 1000.times do |i| obj << { "id" => i, :age => 42, } end Benchmark.ips do |x| x.report "json" do |iter| count = 0 while count < iter JSON.generate(obj) count += 1 end end end ``` https://github.com/flori/json/commit/a73323dc5e
2019-10-14[flori/json] Fixed unexpected illegal/malformed utf-8 errorNobuyoshi Nakada
flori/json@c34d01ff6a18dac04a90b2e0f820cdb1d5c7e1b2 does not consider US-ASCII compatible but non-UTF-8 encodings, and causes an error in RDoc tests. https://github.com/flori/json/commit/4f471bf590
2019-10-14[flori/json] Convert string encoding to UTF-8 only when neededWatson
## Before ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 129.000 i/100ms Calculating ------------------------------------- json 1.300k (± 2.3%) i/s - 6.579k in 5.064656s ``` ## After ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 189.000 i/100ms Calculating ------------------------------------- json 1.964k (± 3.3%) i/s - 9.828k in 5.011237s ``` ## Code ``` require 'json' require 'benchmark/ips' obj = [] 1000.times do |i| obj << { "id" => i, :age => 42, } end Benchmark.ips do |x| x.report "json" do |iter| count = 0 while count < iter JSON.generate(obj) count += 1 end end end ``` https://github.com/flori/json/commit/c34d01ff6a
2019-10-14[flori/json] Convert String encoding using `rb_str_encode()`Watson
`rb_funcall` might be slightly heavy to call the Ruby method. This patch will convert String encoding using `rb_str_encode()` instead of `rb_funcall()`. ## Before ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 78.000 i/100ms Calculating ------------------------------------- json 789.781 (± 2.7%) i/s - 3.978k in 5.041043s ``` ## After ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 129.000 i/100ms Calculating ------------------------------------- json 1.300k (± 2.3%) i/s - 6.579k in 5.064656s ``` ## Code ``` require 'json' require 'benchmark/ips' obj = [] 1000.times do |i| obj << { "id" => i, :age => 42, } end Benchmark.ips do |x| x.report "json" do |iter| count = 0 while count < iter JSON.generate(obj) count += 1 end end end ``` https://github.com/flori/json/commit/9ae6d2969c
2019-10-14[flori/json] Does not check whether illegal utf-8 if string has ascii only.Watson
## Before ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 25.000 i/100ms Calculating ------------------------------------- json 250.478 (± 4.8%) i/s - 1.250k in 5.002238s ``` ## After ``` $ ruby bench_json_generate.rb Warming up -------------------------------------- json 32.000 i/100ms Calculating ------------------------------------- json 360.652 (± 3.6%) i/s - 1.824k in 5.064511s ``` ## Test code ``` require 'json' require 'benchmark/ips' obj = [] 1000.times do |i| obj << { :string => "x" * 100, :utf8 => "あ" * 100 } end Benchmark.ips do |x| x.report "json" do |iter| count = 0 while count < iter JSON.generate(obj) count += 1 end end end ``` https://github.com/flori/json/commit/91a24ecac3
2019-10-14[flori/json] Pass args all #to_json in json/add/*.Sho Hashimoto
https://github.com/flori/json/commit/36a7ef6790
2019-10-14[flori/json] Only attempt to resize strings not other objectsFlorian Frank
https://github.com/flori/json/commit/167ada8da7
2019-10-14Fixed overflow at onig_region_setNobuyoshi Nakada
To get rid of a bug of `onig_region_set` which takes `int`s instead of `OnigPosition`s, set elements of `beg` and `end` members directly, for the time being.
2019-10-14Import StringScanner 1.0.3 (#2553)Sutou Kouhei
Notes: Merged-By: kou <kou@clear-code.com>
2019-10-12Suppress deprecation warnings of MD5 from Xcode 11.1Nobuyoshi Nakada
2019-10-12Moved RB_METHOD_DEFINITION_DECL to intern.hNobuyoshi Nakada
This macro is used here before defined in ruby.h.
2019-10-12atime may not updated unless strictatime is set on macOS CatalinaNobuyoshi Nakada
Cited from mount(8): ``` strictatime Always update the file access time when reading from a file. Without this option the filesystem may default to a less strict update mode, where some access time updates are skipped for performance reasons. This option could be ignored if it is not supported by the filesystem. ```
2019-10-10ext/syslog/extconf.rb: add -llog for AndroidYusuke Endoh
Otherwise, requiring syslog results in: cannot locate symbol "__android_log_print" referenced by "syslog.so"
2019-10-10Prefer rb_gc_register_mark_objectNobuyoshi Nakada
* ext/openssl/ossl_asn1.c (Init_ossl_asn1): prefer `rb_gc_register_mark_object`, which is better for constant objects, over `rb_gc_register_address` for global/static variables which can be re-assigned at runtime. [Bug #16196]
2019-10-10Guard static variable firstNobuyoshi Nakada
* ext/openssl/ossl_asn1.c (Init_ossl_asn1): register the static variable to grab an internal object, before creating the object. otherwise the just-created object could get collected during the global variable list allocation. [Bug #16196]
2019-10-08Import changes from ruby/bigdecimal (#2531)Kenta Murata
Sync to ruby/bigdecimal@92356ba71c6bd325b0ab618c634a7aecf8cdc767 Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2019-10-05ext/openssl/ossl_ssl.c: Use const declaration if LibreSSL >= 2.8.0Yusuke Endoh
to suppress a warning in OpenBSD. ``` ossl_ssl.c:938:31: warning: incompatible pointer types passing 'SSL_SESSION *(SSL *, unsigned char *, int, int *)' (aka 'struct ssl_session_st *(struct ssl_st *, unsigned char *, int, int *)') to parameter of type 'SSL_SESSION *(*)(struct ssl_st *, const unsigned char *, int, int *)' (aka 'struct ssl_session_st *(*)(struct ssl_st *, const unsigned char *, int, int *)') [-Wincompatible-pointer-types] SSL_CTX_sess_set_get_cb(ctx, ossl_sslctx_session_get_cb); ^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/openssl/ssl.h:738:20: note: passing argument to parameter 'get_session_cb' here SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, ^ 1 warning generated. ```
2019-10-05ext/json/parser/prereq.mk: use `if $. == 1` instead of a hacky codeYusuke Endoh
2019-10-05ext/json/parser/prereq.mk: keep line numbers of ext/json/parser/parser.cYusuke Endoh
Follow up of 5717e55e9a7790c938afa694a9bf558c0e54bb83. Adding a header with newline broke linenos.