| Age | Commit message (Collapse) | Author |
|
- mrb_utf8len() - returns the size of a UTF-8 char (in bytes)
- mrb_utf8_strlen() - returns the length of a UTF-8 string (in char)
|
|
|
|
If `mrb->jmp` is `NULL` and the function `mrb_funcall_with_block()` is
called, GC Arena is returned from the function with over-used.
- A normal (no global exodus) return will consume two GC Arena's.
- In the event of an exception, five GC Arena are consumed.
This patch reduces consumption in both cases to one.
|
|
C++ is stricter in implicit type casting.
|
|
Differences from the PR #4940:
* Use simple search for short strings only.
* "short" means `m+n` is shorter than `MRB_QS_SHORT_STRING_LENGTH`.
* The current default value for `MRB_QS_SHORT_STRING_LENGTH` is 2048.
|
|
|
|
|
|
My cat stepped on the keyboard at the last moment before the commit.
|
|
|
|
In top-level, `mid` is `NULL`. We used to ignore 'mid` update for `NULL`.
|
|
|
|
This bug was introduced in 694089f to address #4832
|
|
|
|
Issue 19902: mruby:mruby_fuzzer: Stack-buffer-overflow in mrb_str_len_to_dbl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The basic idea of this change is from @dearblue.
Note: the arguments of `mrb_str_pool()` have changed, but the function
is provided for internal use (No `MRB_API`). So basically you don't have
to worry about the change.
|
|
The behavior when returning from a function without `va_end()` is
undefined.
|
|
|
|
shuujii/add-mrb_num_args_error-for-wrong-number-of-arguments-error
Add `mrb_num_args_error()` for "wrong number of arguments" error
|
|
Because literal pool may be released by GC.
#### Example:
```ruby
s1 = eval('"abcdefghijklmnopqrstuvwxyz01"')
GC.start
p s1 #=> "\x00\x00\x00\x00\x00\x00\x00\x90\x00\x00\x00\x00\x00\x00\x00\x90\x03\x00stuvwxyz01"
```
|
|
Integrate `i` and `arg_i` in `mrb_get_args()`
|
|
The behavior of these two variables is the same.
|
|
|
|
#### Example (with `MRB_METHOD_CACHE`)
```ruby
GC.start
c = Class.new
p c #=> #<Class:0x7fd6a180e790>
c.new #=> cache `c.new`
c = nil
GC.start #=> `c` is GCed
r = Range.dup
p r #=> #<Class:0x7fd6a180e790>
# [same pointer as `c`]
r.new(2, 3) #=> ArgumentError: 'initialize':
# wrong number of arguments (2 for 0)
# [`c.new` is called instead of `r.new`]
```
#### Cause
An entry of method cache is identified by class pointer and method
id. However, reusing memory after GC may create a class with the same
pointer as the cached class.
#### Treatment
Cleared method caches of the class when the class is GCed.
|
|
If `mrb_sym` is smaller than `int`, it is promoted to `int`.
|
|
|
|
shuujii/remove-location-info-from-Exception-inspect
Remove location info from `Exception#inspect`
|
|
The following improvements are made according to Ruby's behavior:
- Match location number to index.
- Remove duplicate most recent call output.
- Fix that first call is not output when array (unpacked) backtrace.
### Example
```ruby
def a; raise "error!" end
def b; a end
begin
b
rescue => e
e.backtrace if ARGV[0] == "unpack" # unpack backtrace
raise e
end
```
#### Before this patch:
```
$ bin/mruby example.rb unpack
trace (most recent call last):
[0] example.rb:2:in b
[1] example.rb:1:in a
example.rb:1: error! (RuntimeError)
```
#### After this patch:
```
$ bin/mruby example.rb unpack
trace (most recent call last):
[2] example.rb:4
[1] example.rb:2:in b
example.rb:1:in a: error! (RuntimeError)
```
|
|
`struct backtrace_location` is created only in `each_backtrace()`, and
the `filename` field will never be null (it will be `(unknown)` if null).
|
|
Because location info (file name and line number) is kept in the backtrace,
it should not be kept in the result of `inspect` (and the exception object
itself), I think.
### Example
```ruby
# example.rb
begin
raise "err"
rescue => e
p e
end
```
#### Before this patch:
```
$ bin/mruby example.rb
example.rb:2: err (RuntimeError)
```
#### After this patch:
```
$ bin/mruby example.rb
err (RuntimeError)
```
|
|
The `#prepend_features` and `#module_function` methods are not haves for
class objects.
|
|
#### Before this patch:
```
$ mruby -e '[].each(1){}' #=> no error
```
#### After this patch:
```
$ mruby -e '[].each(1){}' #=> ArgumentError: wrong number of arguments
```
|
|
To unify the style of messages.
|
|
#### Before this patch:
```ruby
Integer("1_ ") #=> 1
```
#### After this patch (same as Ruby):
```ruby
Integer("1_ ") #=> ArgumentError
```
|
|
#### Before this patch:
```ruby
Integer("_1") #=> 1
"_1".to_i #=> 1
```
#### After this patch (same as Ruby):
```ruby
Integer("_1") #=> ArgumentError
"_1".to_i #=> 0
```
|
|
shuujii/fix-that-String-to_f-accepts-consecutive-_-as-a-numeric-expression
Fix that `String#to_f` accepts consecutive `_` as a numeric expression
|
|
Consecutive `_` is not allowed as a numeric expression:
1_2__3 #=> SyntaxError
Float("1_2__3") #=> ArgumentError
Integer("1_2__3") #=> ArgumentError
"1_2__3".to_i #=> 12
But `String#to_f` accept it, so I fixed the issue.
Before this patch:
"1_2__3".to_f #=> 123
After this patch:
"1_2__3".to_f #=> 12
|
|
|
|
Fix keyword arguments not be obtained with `mrb_get_args()`; Fix #4754
|
|
#### Before this patch:
```
$ bin/mruby -e 'Float("1_a")'
-e:1: invalid string for float(a) (ArgumentError)
```
#### After this patch:
```
$ bin/mruby -e 'Float("1_a")'
-e:1: invalid string for float("1_a") (ArgumentError)
```
|
|
If ":" is after "|" and there is no "?" or "*", the keyword argument
could not be obtained and it was not initialized with `undef`.
For example: "|oo:"
|
|
* The allocated memory is guaranteed to be aligned for any data type (it was
not guaranteed when string type is embed).
* Make allocation size exactly specified size (does not allocate space for a
null byte).
|
|
Add assertion to `RVALUE` size
|
|
The bit width terminology is unified to `BIT` according to `MRB_INT_BIT`
and `CHAR_BIT`. Also the bit position terminology is unified to `BIT_POS`.
|
|
|