summaryrefslogtreecommitdiff
path: root/ext/stringio
AgeCommit message (Collapse)Author
2019-10-31[ruby/stringio] 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/stringio/commit/60ee9ccd95
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-09-29[ruby/stringio] Bump up the versionNobuyoshi Nakada
https://github.com/ruby/stringio/commit/f0e5027279
2019-09-29[ruby/stringio] Use rb_funcallv_kw when delegating argumentsNobuyoshi Nakada
https://github.com/ruby/stringio/commit/5892663e32
2019-09-29[ruby/stringio] Replaced rb_funcall2 with rb_funcallvNobuyoshi Nakada
https://github.com/ruby/stringio/commit/a37ab7c419
2019-09-29[ruby/stringio] Dropped older ruby versionsNobuyoshi Nakada
https://github.com/ruby/stringio/commit/e8065153b8
2019-09-29[ruby/stringio] Get rid of String#undump for ruby 2.4 or earlierNobuyoshi Nakada
https://github.com/ruby/stringio/commit/4dfd997e0a
2019-09-25Make rb_scan_args handle keywords more similar to Ruby methods (#2460)Jeremy Evans
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. Notes: Merged-By: jeremyevans <code@jeremyevans.net>
2019-08-23[ruby/stringio] Fixed a typoNobuyoshi Nakada
https://github.com/ruby/stringio/commit/b249631c433f800c979be2705bf63555075db2fc#commitcomment-34804150 https://github.com/ruby/stringio/commit/998d6257fb
2019-08-14[ruby/stringio] Supported BOMNobuyoshi Nakada
https://github.com/ruby/stringio/commit/b249631c43
2019-08-14[ruby/stringio] Supported `mode:` optionNobuyoshi Nakada
https://github.com/ruby/stringio/commit/53def32ba0
2019-08-14[ruby/stringio] Allow bignum modeNobuyoshi Nakada
https://github.com/ruby/stringio/commit/d28927b561
2019-08-14[ruby/stringio] Added support for older versionsNobuyoshi Nakada
https://github.com/ruby/stringio/commit/c4a13d41cd https://github.com/ruby/stringio/commit/359c9f395c
2019-08-14[ruby/stringio] stringio: encoding supportNobuyoshi Nakada
https://github.com/ruby/stringio/commit/7b20075ab0
2019-07-15ext/stringio/stringio.c (strio_read): "binray" is always zero hereYusuke Endoh
Remove unused conditional expression to suppress Coverity Scan warnings.
2019-07-14Include ruby/assert.h in ruby/ruby.h so that assertions can be thereNobuyoshi Nakada
2019-07-13Removed stub lines from gemspec filesNobuyoshi Nakada
2019-07-10C90 for old versionsNobuyoshi Nakada
2019-07-10Use the found version numberNobuyoshi Nakada
2019-07-10Removed useless `freeze`sNobuyoshi Nakada
2019-07-10Added StringIO::VERSIONNobuyoshi Nakada
2019-02-08Removed moving toplevel header since r12501nobu
Moving public headers was 12-years ago, no depend files would expect ruby.h in the top source directory now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-15Use `&` instead of `modulo`nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-15setbyte / ungetbyte allow out-of-range integersshyouhei
* string.c: String#setbyte to accept arbitrary integers [Bug #15460] * io.c: ditto for IO#ungetbyte * ext/strringio/stringio.c: ditto for StringIO#ungetbyte git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-09* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-09Follow behaviour of IO#ungetbytekazu
see r65802 and [Bug #14359] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-28Merge stringio.gemspec from github repository.hsbt
Temporary ignored configuration of certificate sign. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-22Merge stringio.gemspec from github repository.hsbt
It fixed the wrong paths of libraries. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-07Removed needless date attribute from gemspec of default gems.hsbt
They are assigned automatically when pushing gem file to rubygems.org. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16no ID cache in Init functionsnobu
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
2017-12-22[DOC] StringIO#write accepts multiple arguments since r60377 [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-23stringio.c: write multiple argumentsnobu
* ext/stringio/stringio.c (strio_write_m): make StringIO#write accept multiple arguments, as well as IO#write. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-27ext: adjust indent [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-15To use github url for gemspec.hsbt
[Bug #13906][ruby-core:82817] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14Update gemspec for gem released versions.hsbt
* These are dbm, fcntl, io-console, sdbm, stringio, strscan, zlib, cmath, scanf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-13stringio.c: suppress a warning [ci skip]nobu
* ext/stringio/stringio.c (strio_read): suppress an implicit-fallthrough warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-13stringio.c: encoding at empty chomped resultnobu
* ext/stringio/stringio.c (strio_gets): should return string with the external encoding, at empty chomped result . git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-13stringio.c: encoding at empty resultnobu
* ext/stringio/stringio.c (strio_gets): should return string with the external encoding, at empty result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-12stringio.c: encoding at EOFnobu
* ext/stringio/stringio.c (strio_read): should return string with the external encoding, at EOF too. [ruby-core:82349] [Bug #13806] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-19Make string literal to frozen object on gemspec of defulte gems.hsbt
Added following gemspecs. * extensions: date, dbm, etc, fiddle, gdbm, sdbm, stringio, strscan, zlib * pure ruby libraries: cmath, csv, fileutils, scanf, webrick psych and rdoc is out of scope of this commit. I will merge after upstream was change to `frozen_string_literal: true`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-22stringio.gemspec: requires ruby 2.2nobu
* ext/stringio/stringio.gemspec: bump up required ruby version to 2.2, which exports rb_get_kwargs() first. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-22stringio.c: RB_INTEGER_TYPE_Pnobu
* ext/stringio/stringio.c (RB_INTEGER_TYPE_P): fallback definition for 2.3 or earlier. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-22Use https URL instead of http URLkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-22ruby tool/update-deps --fixshyouhei
Onigumo 6 (r57045) introduced new onigumo.h header file, which is required from quite much everywhere. This commit adds necessary dependencies. Note: ruby/oniguruma.h now includes onigumo.h, ruby/io.h includes oniguruma.h, ruby/encoding.h also includes oniguruma.h, and internal.h includes encoding.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-22gemify stringionobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-21stringio.c: check rangenobu
* ext/stringio/stringio.c (strio_ungetc): raise RangeError instead of TypeError at too big value, as well as IO#ungetc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-21stringio.c: check character codenobu
* ext/stringio/stringio.c (strio_ungetc): check if the character code is valid in the encoding. reported by Ahmad Sherif (ahmadsherif) at https://hackerone.com/reports/209593. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-17remove branches in dmark and dfree GC callbacksnormal
dmark and dfree callbacks are never called in gc.c for NULL DATA_PTR values, not even for zombie objects. * compile.c (ibf_loader_mark): remove branch for pointer validity * compile.c (ibf_loader_free): ditto * cont.c (cont_free): ditto * cont.c (fiber_free): ditto * dir.c (dir_free): ditto * ext/stringio/stringio.c (strio_mark): ditto * proc.c (binding_free): ditto * thread_sync.c (mutex_free): ditto * vm.c (thread_free): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10stringio.c: chomp CRnobu
* ext/stringio/stringio.c (strio_getline): chomp CR not only LF, as well as String#chomp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-03stringio: chomp optionnobu
* ext/stringio/stringio.c (strio_getline): implement chomp option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e