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

185 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA b94d06096b [ruby/zlib] Bump version to 1.1.0
https://github.com/ruby/zlib/commit/5af77c1ee8
2019-11-30 18:21:52 +09:00
Nobuyoshi Nakada 929a4aa722
Adjust a fucntion signature 2019-11-05 02:05:46 +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 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
Nobuyoshi Nakada 94db8cda9b [ruby/zlib] Fix for older ruby 2.6 or earlier
https://github.com/ruby/zlib/commit/00ead8cb2c
2019-09-29 18:53:11 +09:00
Jeremy Evans 80b5a0ff2a
Make rb_scan_args handle keywords more similar to Ruby methods (#2460)
Cfuncs that use rb_scan_args with the : entry suffer similar keyword
argument separation issues that Ruby methods suffer if the cfuncs
accept optional or variable arguments.

This makes the following changes to : handling.

* Treats as **kw, prompting keyword argument separation warnings
  if called with a positional hash.

* Do not look for an option hash if empty keywords are provided.
  For backwards compatibility, treat an empty keyword splat as a empty
  mandatory positional hash argument, but emit a a warning, as this
  behavior will be removed in Ruby 3.  The argument number check
  needs to be moved lower so it can correctly handle an empty
  positional argument being added.

* If the last argument is nil and it is necessary to treat it as an option
  hash in order to make sure all arguments are processed, continue to
  treat the last argument as the option hash. Emit a warning in this case,
  as this behavior will be removed in Ruby 3.

* If splitting the keyword hash into two hashes, issue a warning, as we
  will not be splitting hashes in Ruby 3.

* If the keyword argument is required to fill a mandatory positional
  argument, continue to do so, but emit a warning as this behavior will
  be going away in Ruby 3.

* If keyword arguments are provided and the last argument is not a hash,
  that indicates something wrong. This can happen if a cfunc is calling
  rb_scan_args multiple times, and providing arguments that were not
  passed to it from Ruby.  Callers need to switch to the new
  rb_scan_args_kw function, which allows passing of whether keywords
  were provided.

This commit fixes all warnings caused by the changes above.

It switches some function calls to *_kw versions with appropriate
kw_splat flags. If delegating arguments, RB_PASS_CALLED_KEYWORDS
is used.  If creating new arguments, RB_PASS_KEYWORDS is used if
the last argument is a hash to be treated as keywords.

In open_key_args in io.c, use rb_scan_args_kw.
In this case, the arguments provided come from another C
function, not Ruby.  The last argument may or may not be a hash,
so we can't set keyword argument mode.  However, if it is a
hash, we don't want to warn when treating it as keywords.

In Ruby files, make sure to appropriately use keyword splats
or literal keywords when calling Cfuncs that now issue keyword
argument separation warnings through rb_scan_args.  Also, make
sure not to pass nil in place of an option hash.

Work around Kernel#warn warnings due to problems in the Rubygems
override of the method.  There is an open pull request to fix
these issues in Rubygems, but part of the Rubygems tests for
their override fail on ruby-head due to rb_scan_args not
recognizing empty keyword splats, which this commit fixes.

Implementation wise, adding rb_scan_args_kw is kind of a pain,
because rb_scan_args takes a variable number of arguments.
In order to not duplicate all the code, the function internals need
to be split into two functions taking a va_list, and to avoid passing
in a ton of arguments, a single struct argument is used to handle
the variables previously local to the function.
2019-09-25 11:18:49 -07:00
卜部昌平 703783324c rb_ensure now free from ANYARGS
After 5e86b005c0, I now think ANYARGS is
dangerous and should be extinct.  This commit deletes ANYARGS from
rb_ensure, which also revealed many arity / type mismatches.
2019-08-27 15:52:26 +09:00
卜部昌平 5c7c2d9951 rb_rescue / rb_rescue2 now free from ANYARGS
After 5e86b005c0, I now think ANYARGS is
dangerous and should be extinct.  This commit deletes ANYARGS from
rb_rescue / rb_rescue2, which revealed many arity / type mismatches.
2019-08-27 15:52:26 +09:00
normal 23444302d9 introduce rb_nogvl C-API to mark ubf as async-signal-safe
zlib and bignum both contain unblocking functions which are
async-signal-safe and do not require spawning additional
threads.

We can execute those functions directly in signal handlers
without incurring overhead of extra threads, so provide C-API
users the ability to deal with that.  Other C-API users may
have similar need.

This flexible API can supercede existing uses of
rb_thread_call_without_gvl and rb_thread_call_without_gvl2 by
introducing a flags argument to control behavior.

Note: this API is NOT finalized.  It needs approval from other
committers.  I prefer shorter name than previous
rb_thread_call_without_gvl* functions because my eyes requires
big fonts.

[Bug #15499]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-04 13:14:11 +00:00
normal cc9b57a2b4 zlib (gzfile_write_raw): do not resize string after .write call
Apparently, a component of Rails implements a buffering .write
method which keeps the String buffer around and makes it unsafe
for us to clear it after calling .write.

This caused Rack::Deflater to give empty results when enabled.

Fortunately, per r61631 / a55abcc0ca,
this misguided optimization was only worth a small (0.5MB) savings
and we still benefit from the majority of the memory savings in
that change.

Thanks to zunda for the bug report.

[ruby-core:90133] [Bug #15356]

Fixes: r61631 (commit a55abcc0ca)
       ("zlib: reduce garbage on gzip writes (deflate)")

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-07 07:09:31 +00:00
nobu fd360dd93a zlib: fix Zlib::VERSION
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-18 00:55:05 +00:00
normal a22232cd93 zlib (rb_gzreader_getc): localize and return cbuf directly
No point in having a long-lived cbuf in "struct gzfile"
since GZFILE_CBUF_CAPA is smaller than RSTRING_EMBED_LEN_MAX
(even on 32-bit).  We can also have rb_econv_convert write
directly to the return value instead of an intermediate buffer.

This brings "struct gzfile" from 264 to 256 bytes on 64-bit
systems to avoid taking an additional cache line.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-18 08:16:18 +00:00
nobu c8094ff154 no ID cache in Init functions
Init functions are called only once, cache is useless.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 08:39:48 +00:00
normal 787fab5bbf zlib: reduce garbage on Zlib::GzipReader#readpartial
For garbage-concious users who use the `outbuf' argument of
`readpartial' to supply a destination buffer, this provides
a drastic reduction in garbage when inflating large inputs
in a streaming fashion.

This results in a anonymous RSS reduction in the reader
similar to the reduction in the writer from r61631.

Results using the test script from r61631
<https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61631>

Before:

        writer   7.359999   0.000000   7.359999 (  7.360639)
        writer RssAnon:     4040 kB
        reader   6.346667   0.070000   6.416667 (  7.387654)
        reader RssAnon:    98272 kB

After:

        writer   7.309999   0.000000   7.309999 (  7.310651)
        writer RssAnon:	    4048 kB
        reader   6.146666   0.003333   6.149999 (  7.334868)
        reader RssAnon:	    4300 kB

* ext/zlib/zlib.c (struct read_raw_arg): new struct
  (gzfile_read_raw_partial): use read_raw_arg
  (gzfile_read_raw_rescue): ditto
  (gzfile_read_raw): accept outbuf, use read_raw_arg
  (gzfile_read_raw_ensure): accept outbuf
  (gzfile_read_header): ditto
  (gzfile_check_footer): ditto
  (gzfile_read_more): ditto
  (gzfile_read_raw_until_zero): adjust for changes
  (gzfile_fill): ditto
  (gzfile_readpartial): ditto
  (gzfile_read_all): ditto
  (gzfile_getc): ditto
  (gzfile_reader_end_run): ditto
  (gzfile_reader_get_unused): ditto
  (rb_gzreader_initialize): ditto
  (gzreader_skip_linebreaks): ditto
  (gzreader_gets): ditto
  (zlib_gunzip_run): ditto
  [ruby-core:84660] [Feature #14319]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-08 01:11:38 +00:00
normal a55abcc0ca zlib: reduce garbage on gzip writes (deflate)
Zlib::GzipWriter generated large amounts of garbage from
(struct zstream).input.  Reuse the .input field when it is
hidden, and recycle it when its lifetime is over.  This change
alone reduced memory usage of the writer from 90MB to 4.5MB.

For the detached buffer of compressed data used by
gzfile_write_raw, we can only clear the string (not recycle it)
since user code may hold references to it (but the data would be
clobbered, anyways).  This reduced memory usage slightly by
around 0.5MB (because it's smaller compressed data).

Combined, these changes reduce the anonymous RSS memory of a
dedicated writer process from over 90MB to under 4MB.

before:

    #      user     system      total        real

    writer   7.823332   0.053333   7.876665 (  7.881464)
    writer RssAnon:    92944 kB
    reader   6.969999   0.076666   7.046665 (  7.906377)
    reader RssAnon:   109820 kB

after:

    writer   7.359999   0.000000   7.359999 (  7.360639)
    writer RssAnon:     4040 kB
    reader   6.346667   0.070000   6.416667 (  7.387654)
    reader RssAnon:    98272 kB

Script used:
-------
require 'zlib'
require 'benchmark'
nr = 16384 * 2

def stats(pfx, bm)
  str = "#{bm}#{File.readlines("/proc/#$$/status").grep(/^RssAnon:/)[0]}"
  puts str.gsub!(/^/m, pfx)
end

rd, wr = IO.pipe
pid = fork do
  buf = ((0..255).map(&:chr).join * 128).freeze
  rd.close
  gzip = Zlib::GzipWriter.new(wr)
  bm = Benchmark.measure do
    nr.times { gzip.write(buf) }
    gzip.close
    wr.close
  end
  stats('writer ', bm)
end

wr.close
buf = ''
gunzip = Zlib::GzipReader.new(rd)
n = 0
bm = Benchmark.measure do
  begin
    gunzip.readpartial(16384, buf)
    n += buf.size
  rescue EOFError
    break
  end while true
end
stats('reader ', bm)
Process.waitall
-------
* ext/zlib/zlib.c (zstream_discard_input): reuse or recycle hidden input
  (zstream_reset_input): clear hidden input
  (zstream_run): detach input and recycle after use
  (gzfile_write_raw): clear buffer after write
  [ruby-core:84638] [Feature #14315]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-05 20:48:55 +00:00
normal e93600334e zlib: remove redundant rb_obj_reveal
No need to reveal strings freshly created with rb_str_new.

* ext/zlib/zlib.c (zstream_detach_input): remove redundant call

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-05 10:30:40 +00:00
nobu 585cbf6535 zlib.c: multiple arguments to write
* ext/zlib/zlib.c (rb_gzwriter_write): accepts multiple arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-23 07:06:12 +00:00
nobu c560c7b10d zlib.c: ensure to free
* ext/zlib/zlib.c (zlib_gunzip): gz0 is a structure variable on
  the stack, no longer valid after exit by an exception.  ensure
  to free instead.  [Bug #13982]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-07 02:23:27 +00:00
nobu b268da23d2 zlib.c: memory leak in gunzip
* ext/zlib/zlib.c (zlib_gunzip): clear zstream to fix memory leak.
  [ruby-core:83162] [Bug #13982]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-06 13:41:37 +00:00
nobu 253fd5fe6b ext: adjust indent [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-27 05:08:53 +00:00
nobu 5d6c1f42d5 zlib.c: fix unnormalized Fixnum
* ext/zlib/zlib.c (rb_gzfile_total_out): cast to long not to
  result in an unsigned long to normalized to Fixnum on LLP64
  platforms.  [ruby-core:81488]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 13:50:00 +00:00
naruse 7c9c2bc1dd Zlib::GzipReader#pos underflows after calling #ungetbyte or #ungetc at start of file [Bug #13616]
patched by Andrew Haines <andrew@haines.org.nz> [ruby-core:81488]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 09:17:55 +00:00
nobu d70e47dc6b zlib.c: no buf_filled in zstream
* ext/zlib/zlib.c (zstream): manage capacity and size of `buf`
  instead of size and separated member `buf_filled`.  reported by
  Christian Jalio (jalio) at https://hackerone.com/reports/211958

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-01 02:01:38 +00:00
nobu c4c3d86a1f zlib.c: zstream_buffer_ungetbyte
* ext/zlib/zlib.c (zstream_buffer_ungetbyte): simplify by using
  zstream_buffer_ungets().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-01 00:35:02 +00:00
nobu 5f8ae91717 zlib.c: zstream_expand_buffer_non_stream
* ext/zlib/zlib.c (zstream_expand_buffer_non_stream): rename from
  zstream_expand_buffer_without_gvl() and replace duplicate code
  in zstream_expand_buffer().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-01 00:35:00 +00:00
nobu 0adce99357 rdoc for r57126 [ci skip]
* ext/zlib/zlib.c: [DOC] update as keyword arguments.
  [Feature #13020]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-20 17:15:37 +00:00
naruse ba568c0ea3 Zlib.gzip uses kwargs instead of argc [Feature #13020]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-20 16:02:21 +00:00
naruse 1d51f427ff fix Zlib.gzip/gunzip document
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-11 06:13:02 +00:00
nobu f46a137746 zlib.c: replace with substring
* ext/zlib/zlib.c (zstream_discard_input): replace with unread
  portion substring, not modifying the input buffer directly.
  [ruby-core:78567] [Bug #13021]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10 08:26:40 +00:00
kazu adc9c71fbe Fix document of gunzip and gzip [ci skip]
- fix a typo (`GzipReadr` -> `GzipReader`)
- `Zlib::GzipReader.new` does not take block
- fix encoding

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10 02:16:55 +00:00
naruse 583b6dc33c Zlib.gzip and Zlib.gunzip [Feature #13020]
Encode and Decode gzip data without creating files.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-09 22:45:39 +00:00
nobu 4e44f6ef86 [DOC] replace Fixnum with Integer [ci skip]
* numeric.c: [DOC] update document for Integer class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-26 06:11:23 +00:00
nobu 871472c72b Unnecessary checks
* ext/bigdecimal/bigdecimal.c: FIX2INT and FIX2UINT imply the
  check for Fixnum.

* ext/zlib/zlib.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-17 08:45:05 +00:00
naruse fd307c3b60 * ext/zlib/zlib.c: remove hacky macro introduced at r30437.
* ext/zlib/zlib.c (gzfile_make_header): cast as long (instead of int).

* ext/zlib/zlib.c (gzfile_make_footer): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 17:47:52 +00:00
zzak 70d040ddbd * ext/zlib/zlib.c: Document mtime header behavior with patch by @schneems
Fixes [GH-1129]: https://github.com/ruby/ruby/pull/1129


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-09 05:33:35 +00:00
nobu 26bc97bda4 zlib.c: Fix typo [ci skip]
* ext/zlib/zlib.c (Init_zlib): [DOC] Fix double-word typo and
  grammatical error.  [Fix GH-1162]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-19 05:27:52 +00:00
hsbt 79a6daa394 * ext/zlib/zlib.c: fix a typo.
[ci skip][fix GH-1149] Patch by @crismali

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-15 02:55:13 +00:00
nobu 898fd2ed2a use rb_check_arity [ci skip]
* ext: use rb_check_arity and rb_error_arity to raise
  ArgumentError.  [Feature #9025]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-25 00:43:06 +00:00
nobu 498b6f4776 zlib.c: GC guards
* ext/zlib/zlib.c: prevent from GC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-10 12:50:26 +00:00
nobu 41bd073de2 zlib.c: protoize
* ext/zlib/zlib.c (do_checksum): protoize the definition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-10 12:49:58 +00:00
hsbt 4162f90e03 * ext/zlib/zlib.c: Fix indentation for rdoc.
[Bug #11221][ruby-core:69465]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-11 10:11:30 +00:00
glass d88957abad * ext/zlib/zlib.c (rb_gzreader_external_encoding):
define GzipReader#external_encoding.
  [Bug #10900]

* test/zlib/test_zlib.rb: test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-10 03:43:22 +00:00
akr b6d5ce7975 * ext/zlib/zlib.c (rb_gzfile_close): Don't raise on double
close for consistent to IO#close.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08 13:52:51 +00:00
hsbt 6d92166c97 * ext/zlib/zlib.c: fix document of method signatures.
[Bug #10668][ruby-core:67186][ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-10 03:57:17 +00:00
normal 02be147c8a ext/zlib/zlib.c: TypedData conversion
* ext/zlib/zlib.c (zstream_mark, zstream_free): update signature
  (gzfile_mark, gzfile_free): ditto
  (zstream_memsize): new function for rb_data_type->dsize
  (gzfile_memsize): ditto
  (zstream_data_type, gzfile_data_type): new data types
  (zstream_new): Data_Make_Struct => TypedData_Make_Struct
  (gzfile_new): ditto
  (get_zstream, get_gzfile): Data_Get_Struct => TypedData_Get_Struct
  (rb_zstream_flush_next_in): ditto
  (rb_zstream_flush_next_out): ditto
  (rb_zstream_avail_out): ditto
  (rb_zstream_avail_in): ditto
  (rb_zstream_closed_p): ditto
  (rb_deflate_initialize): ditto
  (rb_deflate_init_copy): ditto
  (rb_inflate_initialize): ditto
  (gzfile_ensure_close): ditto
  (rb_gzfile_closed_p): ditto
  (rb_gzfile_path): ditto
  (rb_gzwriter_initialize): ditto
  (rb_gzreader_initialize): ditto
  (rb_gzreader_unused): ditto
  [ruby-core:65377] [Feature #10319]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-04 20:56:10 +00:00
nobu 28b9f11d5a protoize no-arguments functions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-30 05:25:32 +00:00
normal 338cea741d ext/zlib/zlib.c (struct gzfile): pack (288 => 272 bytes) on 64-bit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-17 22:01:31 +00:00
normal f5e06db39c ext/zlib/zlib.c (zlib_mem_alloc): check overflow
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-17 07:26:12 +00:00
normal 3cee6a22c0 zlib: GzipReader#rewind preserves ZSTREAM_FLAG_GZFILE
* ext/zlib/zlib.c (gzfile_reset): preserve ZSTREAM_FLAG_GZFILE
  [Bug #10101]

* test/zlib/test_zlib.rb (test_rewind): test each_byte

We must preserve the ZSTREAM_FLAG_GZFILE flag to prevent
zstream_detach_buffer from:

a) returning Qnil and breaking out of the `each_byte' loop
b) yielding a large string to each_byte

Note: the test case in bug report takes a long time.  I found this
bug because I noticed the massive time descrepancy between
`each_byte' and `readbyte' loop before this patch.  With this patch,
`each_byte' and `readbyte' both take very long.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-30 23:53:28 +00:00