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

7315 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 929a4aa722
Adjust a fucntion signature 2019-11-05 02:05:46 +09:00
Justin McNally 10c2a08548 Clean up implementation of SOCKSSocket, its confusing and undocumented 2019-11-01 18:40:24 +09:00
Justin McNally 68e0bfcd4a Prefer libsocksd over libsocks 2019-11-01 18:39:59 +09:00
Justin McNally b800410387 Support libsocksd socks library for SOCKSSocket 2019-11-01 18:39:59 +09:00
Nobuyoshi Nakada 6abf4c4802 [ruby/date] Added update-zonetab target
https://github.com/ruby/date/commit/9bc6e30a82
2019-11-01 17:30:17 +09:00
Jeremy Evans 469545307f [ruby/date] Add more timezone abbreviations
This gets the time zone abbreviations from
https://www.timeanddate.com/time/zones/, and adds unambiguous time
zones not already present in zonetab.list.  See bin/update-abbr
for the program used.

This regenerates zonetab.h using prereq.mk (requires gperf).

Only one test line is added, just to make sure a new time zone
abbreviation is picked up.

Fixes Ruby Bug 16286

https://github.com/ruby/date/commit/702e8b3033
2019-11-01 17:30:14 +09:00
Nobuyoshi Nakada 63f70eb651 [ruby/zlib] Removed no longer used variables
https://github.com/ruby/zlib/commit/3e98e4cac3
2019-10-31 22:24:00 +09:00
Alan Wu 0aaa15f636 [ruby/zlib] Fix setting mtime to zero in GzipWriter
Before this change, it was not possible to write out zero for the
timestamp part of a Gzip file's header, as calling GzipWriter#mtime with
zero was ignored.

Judging from the docs for `GzipWriter#mtime=`, it should be possible to
indicate that no timestamp is available by calling the method with zero.

https://github.com/ruby/zlib/commit/310be39cac
2019-10-31 22:23:58 +09:00
Jeremy Evans ebc884461b
[ruby/stringio] Remove taint support
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/stringio/commit/60ee9ccd95
2019-10-31 16:24:02 +09:00
Jeremy Evans 3895e548bd [ruby/date] Revert "Simplify #inspect"
This reverts commit af01edd7d8575f544f647dbe8cde5b6ae535d459.

Revert requested by Yui Naruse.

https://github.com/ruby/date/commit/875d563557
2019-10-31 15:51:30 +09:00
glaszig fce940aac7 [ruby/date] introduce Date::Error, raise Date::Error for every
"invalid <anything>" type of exception

https://github.com/ruby/date/commit/3e55c09ba4
2019-10-31 15:51:25 +09:00
Hiroshi SHIBATA 39281d5774
[ruby/gdbm] Use Gemfile instead of Gem::Specification#add_development_dependency.
https://github.com/ruby/gdbm/commit/bd2e7f6647
2019-10-31 15:34:01 +09:00
Jeremy Evans b93ab7d693
[ruby/gdbm] Remove taint support
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 15:34:01 +09:00
Jeremy Evans 290903dba0
[ruby/zlib] Remove taint support
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-31 15:34:01 +09:00
Hiroshi SHIBATA 6c3ed0d71c
Update the latest versions from upstream repository of racc 2019-10-30 21:36:59 +09:00
zverok 2746fd5d50 Update StringIO docs:
* 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.
2019-10-26 10:24:20 -07:00
Jeremy Evans 0c579b0a97 [ruby/dbm] Remove taint support
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-26 07:03:33 +09:00
Jeremy Evans 5fe8943fda Fix typo causing Date.new(year, month) to fail
Add a test for this case.
2019-10-24 12:34:51 -07:00
Hiroshi SHIBATA efd641ffab Revert "[ruby/fiddle] Use ffi_closure_free by default. (#20)"
This reverts commit ce6caade7c.
2019-10-24 20:58:32 +09:00
Jeremy Evans b809784817 [ruby/fiddle] Remove taint support (#21)
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 19:34:49 +09:00
Vít Ondruch ce6caade7c [ruby/fiddle] Use ffi_closure_free by default. (#20)
* 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 19:34:43 +09:00
Aaron Patterson 7733db665a [ruby/fiddle] Fiddle::Function must maintain a reference to the closure
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 19:34:15 +09:00
Hiroshi SHIBATA 487d96c6b1
[ruby/date] Use Gemfile instead of Gem::Specification#add_development_dependency.
https://github.com/ruby/date/commit/13c94362c2
2019-10-24 18:39:04 +09:00
zverok 9d3a4ab05b
[ruby/date] Update docs
https://github.com/ruby/date/commit/8c02586a98
2019-10-24 18:39:04 +09:00
zverok 913807bd6c
[ruby/date] Simplify #inspect
https://github.com/ruby/date/commit/af01edd7d8
2019-10-24 18:39:04 +09:00
Jeremy Evans 2e37c1960a
[ruby/date] Remove taint support
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 18:39:04 +09:00
Jeremy Evans fc0e8d00bc
[ruby/date] Support -Float::INFINITY...date ranges
Fixes Ruby Bug 12961

https://github.com/ruby/date/commit/7f533c2552
2019-10-24 18:39:04 +09:00
Jeremy Evans 4e40ca301c
[ruby/date] Check for numeric arguments in constructors
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 18:39:04 +09:00
Jeremy Evans 9eb798a3f1
[ruby/date] Make julian dates roundtrip through to_time.to_date
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-24 18:39:04 +09:00
git 215e4b8721 * expand tabs. [ci skip]
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-21 11:50:44 +09:00
Nobuyoshi Nakada 44da5a1c87
Look up event ID offsets by token as index 2019-10-21 11:45:54 +09:00
Nobuyoshi Nakada ca7de0334d
Also BDOT2 and BDOT3 are operators 2019-10-20 20:45:56 +09:00
Koichi Sasada a236eaa762 Native MonitorMixin::ConditionVariable#wait
MonitorMixin::ConditionVariable#wait can be interrupted just after
Monitor#exit_for_cond. So implementation in C.
2019-10-20 15:45:30 +09:00
Koichi Sasada a0a3c70181 delegate synchronize method
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-20 14:21:04 +09:00
Koichi Sasada caac5f777a
make monitor.so for performance. (#2576)
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.
2019-10-20 04:52:20 +09:00
Nobuyoshi Nakada 1d435bd51a
Extend Ripper DSL to set to pseudo variables other than `$$` 2019-10-19 17:19:27 +09:00
Aaron Patterson 1d564acedc
Remove unused constant.
This constant isn't used, so lets remove it.
2019-10-17 13:35:26 -07:00
Aaron Patterson 9026e12f93
Look up constant instead of caching in a global
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-17 13:30:09 -07:00
Sho Hashimoto 308bbb4e10
[flori/json] Add ascii_only option to JSON::Ext::Generator::State.new.
https://github.com/flori/json/commit/0e99a9aac5
2019-10-14 19:54:49 +09:00
Watson 98a9445db9
[flori/json] Add shortcut converting to String
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 19:54:49 +09:00
Watson a2f9c38a71
[flori/json] Convert Hash object using rb_hash_foreach()
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 19:54:49 +09:00
Nobuyoshi Nakada 2003755a2c
[flori/json] Fixed unexpected illegal/malformed utf-8 error
flori/json@c34d01ff6a 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 19:54:48 +09:00
Watson d7fa7e2c86
[flori/json] Convert string encoding to UTF-8 only when needed
## 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 19:54:48 +09:00
Watson 40724d7d10
[flori/json] Convert String encoding using `rb_str_encode()`
`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 19:54:48 +09:00
Watson 641136c4af
[flori/json] Does not check whether illegal utf-8 if string has ascii only.
## 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 19:54:48 +09:00
Sho Hashimoto d9e50fcbeb
[flori/json] Pass args all #to_json in json/add/*.
https://github.com/flori/json/commit/36a7ef6790
2019-10-14 19:54:48 +09:00
Florian Frank 7376d70cb0
[flori/json] Only attempt to resize strings not other objects
https://github.com/flori/json/commit/167ada8da7
2019-10-14 19:54:48 +09:00
Nobuyoshi Nakada 3e763883ea
Fixed overflow at onig_region_set
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-14 15:10:56 +09:00
Sutou Kouhei 95c420c4a6
Import StringScanner 1.0.3 (#2553) 2019-10-14 12:40:50 +09:00
Nobuyoshi Nakada f405564711
Suppress deprecation warnings of MD5 from Xcode 11.1 2019-10-12 18:47:06 +09:00