| 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)
|
|
|
|
When removing elements from an array, it is possible to avoid creating
an empty array.
Before this patch:
```c
mrb_ary_splice(mrb, ary, head, len, mrb_ary_new(mrb));
```
After this patch:
```c
mrb_ary_splice(mrb, ary, head, len, mrb_undef_value());
```
|
|
|
|
The difference between `mrb_singleton_class` and `mrb_singleton_class_ptr`:
- `mrb_singleton_class_ptr` returns `struct RClass*`.
- `mrb_singleton_class_ptr` returns `NULL` on immediate values where
`mrb_singleton_class` raises exceptions.
|
|
The tranpoline code in 6a0b68f8b was wrong; reverted.
|
|
|
|
In ISO, those methods should raise `TypeError`, but the spec has been
changed. The change was discussed in [Feature#12979].
|
|
Fix `MRB_TT_CPTR` object with `MRB_NAN_BOXING`
|
|
Previously, if `MRB_NAN_BOXING` is defined, for example,
`mrb_cptr_value()` could not keep an odd address.
If it is `MRB_32BIT`, it can be embedded in `NaN` as it is.
If it is `MRB_64BIT`, some operations are shared with `MRB_WORD_BOXING`.
In this case, the MRB_API function `mrb_nan_boxing_cptr_value()` is
defined.
|
|
In order to share the same operation with `mrb_float_to_str()`,
the internal structure is modified.
|
|
Changed to understand `#`, `0`, `-`, ` ` and `+`.
Based on src/stdio/vfprintf.c in git://git.musl-libc.org/musl
|
|
Based on src/stdio/vfprintf.c in git://git.musl-libc.org/musl
|
|
|
|
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.
|