aboutsummaryrefslogtreecommitdiffstats
path: root/ext/stringio
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/stringio] Bump up the versionNobuyoshi Nakada2019-09-291-1/+1
| | | | https://github.com/ruby/stringio/commit/f0e5027279
* [ruby/stringio] Use rb_funcallv_kw when delegating argumentsNobuyoshi Nakada2019-09-291-2/+7
| | | | https://github.com/ruby/stringio/commit/5892663e32
* [ruby/stringio] Replaced rb_funcall2 with rb_funcallvNobuyoshi Nakada2019-09-291-4/+4
| | | | https://github.com/ruby/stringio/commit/a37ab7c419
* [ruby/stringio] Dropped older ruby versionsNobuyoshi Nakada2019-09-291-1/+1
| | | | https://github.com/ruby/stringio/commit/e8065153b8
* [ruby/stringio] Get rid of String#undump for ruby 2.4 or earlierNobuyoshi Nakada2019-09-291-1/+1
| | | | https://github.com/ruby/stringio/commit/4dfd997e0a
* Make rb_scan_args handle keywords more similar to Ruby methods (#2460)Jeremy Evans2019-09-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [ruby/stringio] Fixed a typoNobuyoshi Nakada2019-08-231-1/+1
| | | | | | https://github.com/ruby/stringio/commit/b249631c433f800c979be2705bf63555075db2fc#commitcomment-34804150 https://github.com/ruby/stringio/commit/998d6257fb
* [ruby/stringio] Supported BOMNobuyoshi Nakada2019-08-141-0/+81
| | | | https://github.com/ruby/stringio/commit/b249631c43
* [ruby/stringio] Supported `mode:` optionNobuyoshi Nakada2019-08-141-1/+20
| | | | https://github.com/ruby/stringio/commit/53def32ba0
* [ruby/stringio] Allow bignum modeNobuyoshi Nakada2019-08-141-2/+3
| | | | https://github.com/ruby/stringio/commit/d28927b561
* [ruby/stringio] Added support for older versionsNobuyoshi Nakada2019-08-142-0/+56
| | | | | https://github.com/ruby/stringio/commit/c4a13d41cd https://github.com/ruby/stringio/commit/359c9f395c
* [ruby/stringio] stringio: encoding supportNobuyoshi Nakada2019-08-141-27/+20
| | | | https://github.com/ruby/stringio/commit/7b20075ab0
* ext/stringio/stringio.c (strio_read): "binray" is always zero hereYusuke Endoh2019-07-151-1/+1
| | | | Remove unused conditional expression to suppress Coverity Scan warnings.
* Include ruby/assert.h in ruby/ruby.h so that assertions can be thereNobuyoshi Nakada2019-07-141-0/+1
|
* Removed stub lines from gemspec filesNobuyoshi Nakada2019-07-131-2/+0
|
* C90 for old versionsNobuyoshi Nakada2019-07-101-14/+11
|
* Use the found version numberNobuyoshi Nakada2019-07-101-1/+1
|
* Removed useless `freeze`sNobuyoshi Nakada2019-07-101-13/+13
|
* Added StringIO::VERSIONNobuyoshi Nakada2019-07-102-1/+14
|
* Removed moving toplevel header since r12501nobu2019-02-081-1/+1
| | | | | | | 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
* Use `&` instead of `modulo`nobu2019-01-151-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* setbyte / ungetbyte allow out-of-range integersshyouhei2019-01-151-26/+19
| | | | | | | | | | | | * 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
* * expand tabs.svn2019-01-091-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Follow behaviour of IO#ungetbytekazu2019-01-091-4/+15
| | | | | | see r65802 and [Bug #14359] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Merge stringio.gemspec from github repository.hsbt2018-11-281-3/+4
| | | | | | Temporary ignored configuration of certificate sign. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Merge stringio.gemspec from github repository.hsbt2018-10-221-2/+2
| | | | | | It fixed the wrong paths of libraries. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Removed needless date attribute from gemspec of default gems.hsbt2018-08-071-1/+0
| | | | | | 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
* no ID cache in Init functionsnobu2018-02-161-0/+1
| | | | | | 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
* [DOC] StringIO#write accepts multiple arguments since r60377 [ci skip]kazu2017-12-221-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* stringio.c: write multiple argumentsnobu2017-10-231-3/+15
| | | | | | | * 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
* ext: adjust indent [ci skip]nobu2017-09-271-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* To use github url for gemspec.hsbt2017-09-151-1/+1
| | | | | | [Bug #13906][ruby-core:82817] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update gemspec for gem released versions.hsbt2017-09-141-0/+2
| | | | | | | * 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
* stringio.c: suppress a warning [ci skip]nobu2017-08-131-0/+1
| | | | | | | * 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
* stringio.c: encoding at empty chomped resultnobu2017-08-131-9/+9
| | | | | | | * 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
* stringio.c: encoding at empty resultnobu2017-08-131-1/+2
| | | | | | | * 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
* stringio.c: encoding at EOFnobu2017-08-121-0/+2
| | | | | | | | * 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
* Make string literal to frozen object on gemspec of defulte gems.hsbt2017-06-191-0/+1
| | | | | | | | | | | | 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
* stringio.gemspec: requires ruby 2.2nobu2017-03-221-1/+1
| | | | | | | * 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
* stringio.c: RB_INTEGER_TYPE_Pnobu2017-03-221-0/+4
| | | | | | | * 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
* Use https URL instead of http URLkazu2017-03-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby tool/update-deps --fixshyouhei2017-03-221-0/+1
| | | | | | | | | | | | | | 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
* gemify stringionobu2017-03-221-0/+24
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* stringio.c: check rangenobu2017-03-211-2/+2
| | | | | | | * 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
* stringio.c: check character codenobu2017-03-211-2/+4
| | | | | | | | * 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
* remove branches in dmark and dfree GC callbacksnormal2017-03-171-3/+2
| | | | | | | | | | | | | | | | | 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
* stringio.c: chomp CRnobu2016-12-101-2/+9
| | | | | | | * 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
* stringio: chomp optionnobu2016-12-031-8/+37
| | | | | | * 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
* stringio.c: fix signed integer overflowrhe2016-09-261-6/+10
| | | | | | | | | | | | | * ext/stringio/stringio.c (strio_seek): Avoid signed integer overflow. It's not harmful in practice here, but is still undefined behavior. * ext/stringio/stringio.c (strio_extend): Check that the new length does not exceed LONG_MAX. This fixes the invalid write on the overflow. * test/stringio/test_stringio.rb (test_write_integer_overflow): Add a test case for the above fix in strio_extend(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* stringio.c: convert arguments just oncenobu2016-07-111-12/+32
| | | | | | | | * ext/stringio/stringio.c (strio_each, strio_readlines): convert arguments just once before reading, instead of conversions for each lines, as r55603. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e