1. 07 2月, 2020 1 次提交
  2. 20 1月, 2020 1 次提交
    • N
      Fixed double closedir · bdef392e
      Nobuyoshi Nakada 提交于
      In the case that shinking the entries buffer to the exact size
      failed, `dirp` is already closed.  Found by mame with Coverity
      Scan.
      bdef392e
  3. 19 1月, 2020 1 次提交
  4. 18 1月, 2020 1 次提交
  5. 29 12月, 2019 1 次提交
  6. 26 12月, 2019 1 次提交
    • decouple internal.h headers · 5e22f873
      卜部昌平 提交于
      Saves comitters' daily life by avoid #include-ing everything from
      internal.h to make each file do so instead.  This would significantly
      speed up incremental builds.
      
      We take the following inclusion order in this changeset:
      
      1.  "ruby/config.h", where _GNU_SOURCE is defined (must be the very
          first thing among everything).
      2.  RUBY_EXTCONF_H if any.
      3.  Standard C headers, sorted alphabetically.
      4.  Other system headers, maybe guarded by #ifdef
      5.  Everything else, sorted alphabetically.
      
      Exceptions are those win32-related headers, which tend not be self-
      containing (headers have inclusion order dependencies).
      5e22f873
  7. 04 12月, 2019 1 次提交
  8. 18 11月, 2019 2 次提交
    • J
      Deprecate taint/trust and related methods, and make the methods no-ops · ffd0820a
      Jeremy Evans 提交于
      This removes the related tests, and puts the related specs behind
      version guards.  This affects all code in lib, including some
      libraries that may want to support older versions of Ruby.
      ffd0820a
    • J
      Warn on access/modify of $SAFE, and remove effects of modifying $SAFE · c5c05460
      Jeremy Evans 提交于
      This removes the security features added by $SAFE = 1, and warns for access
      or modification of $SAFE from Ruby-level, as well as warning when calling
      all public C functions related to $SAFE.
      
      This modifies some internal functions that took a safe level argument
      to no longer take the argument.
      
      rb_require_safe now warns, rb_require_string has been added as a
      version that takes a VALUE and does not warn.
      
      One public C function that still takes a safe level argument and that
      this doesn't warn for is rb_eval_cmd.  We may want to consider
      adding an alternative method that does not take a safe level argument,
      and warn for rb_eval_cmd.
      c5c05460
  9. 12 10月, 2019 1 次提交
  10. 09 10月, 2019 1 次提交
    • avoid overflow in integer multiplication · 7e0ae169
      卜部昌平 提交于
      This changeset basically replaces `ruby_xmalloc(x * y)` into
      `ruby_xmalloc2(x, y)`.  Some convenient functions are also
      provided for instance `rb_xmalloc_mul_add(x, y, z)` which allocates
      x * y + z byes.
      7e0ae169
  11. 01 10月, 2019 1 次提交
  12. 26 9月, 2019 1 次提交
    • J
      Make rb_scan_args handle keywords more similar to Ruby methods (#2460) · 80b5a0ff
      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.
      80b5a0ff
  13. 02 9月, 2019 1 次提交
  14. 27 8月, 2019 1 次提交
  15. 14 7月, 2019 1 次提交
  16. 22 3月, 2019 1 次提交
  17. 21 3月, 2019 1 次提交
  18. 16 1月, 2019 1 次提交
  19. 09 1月, 2019 1 次提交
  20. 05 12月, 2018 1 次提交
  21. 26 9月, 2018 1 次提交
  22. 25 9月, 2018 2 次提交
  23. 22 9月, 2018 1 次提交
    • S
      dir.c: performance fix with braces · 2a119042
      shirosaki 提交于
      Braces were expended before ruby_glob0(). This caused to call
      replace_real_basename() for same plain patterns repeatedly.
      Move blace expansion into glob_helper() in ruby_glob0() to reduce
      replace_real_basename() call.
      This fix changes the order of glob results.
      [Feature #13167] [Fix GH-1864]
      
      git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
      2a119042
  24. 21 9月, 2018 1 次提交
  25. 26 7月, 2018 1 次提交
  26. 25 7月, 2018 1 次提交
  27. 17 7月, 2018 1 次提交
  28. 09 7月, 2018 1 次提交
    • N
      dir.c: fix directory glob · 58f2e6bc
      nobu 提交于
      * dir.c (glob_helper): fix directory glob which resulted in lacking
        the first byte.  adjust the length of basename to be appended as
        well as removing the heading path, not the length of the joined
        path.  [ruby-dev:50588] [Bug #14899]
      
      git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
      58f2e6bc
  29. 22 6月, 2018 1 次提交
  30. 19 4月, 2018 1 次提交
  31. 08 4月, 2018 1 次提交
  32. 30 3月, 2018 1 次提交
  33. 29 3月, 2018 1 次提交
  34. 28 3月, 2018 1 次提交
  35. 23 2月, 2018 1 次提交
  36. 24 1月, 2018 1 次提交
  37. 22 1月, 2018 1 次提交
  38. 18 1月, 2018 1 次提交