- mrb_div_int() does integer division in Ruby way (mdiv)
returns mrb_int
- mrb_div_int_value() division with zero div and overflow checks.
returns mrb_value
- remove `lex_strterm_before_heredoc` that does not nest
- remove `all_heredocs` that cannot distinguish nested and followed
here-doc
- replace `lex_strterm` represented by cons list by C struct
- push/pop `lex_strterm` before/after interpolation
that checks if the value is an `Integer` which may be a big integer,
where existing `mrb_ensure_int_type()` checks if the value is an Integer
**and** fits in `mrb_int`.
Users can now switch to their own implementation of GEM.
However, we do not guarantee that this will not be a problem in the current situation.
This may need to be improved in the future.
Normal return of control from the `mrb_sys_fail()` function has unexpected results.
Example: double free, malloc with huge size used as error integer
The following is an example of an actual crash:
```console
% cat crash.rb
def SystemCallError._sys_fail(*a)
nil
end
File.readlink("/404")
% bin/mruby crash.rb
zsh: segmentation fault (core dumped) bin/mruby crash.rb
```
Internal functions can only be called from within the library.
Functions listed in `mruby/internal.h` can be called from:
* core (src/*.c)
* gems (mrbgems/**/*.c)
But not from the application linked with `libmruby`.
Since the possible values of the backtrace are limited to `nil`, `RData`, and `RAray`, they are now stored as object pointers.
This change saves memory by eliminating the need to use instance variables for common exceptions.
ref. #2485
There is no need to limit the type to `struct RString`.
Also, the `MRB_EXC_MESG_STRING_FLAG` flag can be eliminated by checking if `struct RException::mesg` is `NULL` or not.
ref. #2485
To more consistent names.
* mrb_num_plus() -> mrb_num_add()
* mrb_num_minus() -> mrb_num_sub()
Since no one seems to use those functions, there should be no problem.
We added migration macros for compatibility for safety.
- Changed the description to match the order of the changed members.
- Replaced "array of symbols" instead of "array of strings that mean symbols".
- The `mrb_kwargs::optional` member has not been present since the first merge. It is a remnant from development time.
- Removed `const` modifier used in variable declarations in examples. This is not always necessary from a user perspective.
- Added note on the use of `MRB_SYM()`.
resolved#5649
ref. #2485
The `SystemCallError#to_s` method also needed to be modified, but since it has no functional difference from the `Exception#to_s` method, it will be removed.
It seems to be preferable to be able to handle pointers of type `char` as well.
For this purpose, `mrb_nanbox_tt_inline` has been reorganized.
- `MRB_NANBOX_TT_POINTER` has been split into `MRB_NANBOX_TT_OBJECT` and `MRB_NANBOX_TT_CPTR`
- `MRB_NANBOX_TT_SYMBOL` has been merged into `MRB_NANBOX_TT_MISC`
The main purpose is to increase the chances of finding presym and to prevent errors due to C++11 lambda expressions.
- The argument to receive the class may be written, for example, `mrb_class_get()`.
- The argument that receives the implementation function of the method may be a C++ lambda expression.
In this case, if multiple variable declarations are separated by colons, the preprocessor will recognize them as argument delimiters and report an error.
This patch prevents it from happening.
```c++
// When preprocessing...
func([] { int x, y, z; })
// ^^^^^^^^^^ 1st argument?
// ^ 2nd argument?
// ^^^^ 3rd argument?
```