| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
In #4550, @shuuji proposed the name name `MRB_STR_NO_MULTI_BYTE` for
more precise description. Although I agree that the name name is
correct, but the flag means the string does not contain multi byte UTF-8
characters, i.e. all characters fit in the range of ASCII.
|
|
This patch is showed in #4549.
|
|
|
|
Before this patch:
$ bin/mruby -e '1.respond_to?(2)' #=> nil is not a symbol
After this patch (same as Ruby):
$ bin/mruby -e '1.respond_to?(2)' #=> 2 is not a symbol nor a string
|
|
|
|
|
|
It is integration with part of argument parsing used in `mrb_str_aset_m()`.
|
|
The purpose is to eliminate string objects that are temporarily created during processing.
|
|
|
|
|
|
mruby/mruby/src/string.c:1722:4: warning: label 'bytes' defined but not used [-Wunused-label]
bytes:
^~~~~
|
|
Change to UTF-8 string reversing with in place
|
|
shuujii/fix-String-byteslice-with-MRB_UTF8_STRING-and-some-edge-cases
Fix `String#byteslice` with `MRB_UTF8_STRING` and some edge cases
|
|
Example:
$ bin/mruby -e '
p "あa".byteslice(1)
p "bar".byteslice(3)
p "bar".byteslice(4..0)
'
Before this patch:
"a"
""
RangeError (4..0 out of range)
After this patch (same as Ruby):
"\x81"
nil
nil
|
|
Fix argument specs to `Array`
|
|
shuujii/compare-obj-pointer-directly-instead-of-using-mrb_obj_eq-in-mrb_gc_unregister
Compare obj pointer directly instead of using mrb_obj_eq in mrb_gc_unregister
|
|
The #4520 tried to address the issue, but it changes the type of
`mrb_check_frozen` argument; close #4520
|
|
|
|
Because immediate values are not registered.
|
|
|
|
Refine `Hash#rehash` example [ci skip]
|
|
Now to be calls `mrb_str_modify()` only once when 2 or more characters.
|
|
|
|
|
|
Reverses UTF-8 strings without allocated heap for working memory.
1. String before reversing:
```
"!yburmの界世"
# byte unit
[33, 121, 98, 117, 114, 109, 227, 129, 174, 231, 149, 140, 228, 184, 150]
```
2. Reverse the byte order of each character:
```
[33, 121, 98, 117, 114, 109, 174, 129, 227, 140, 149, 231, 150, 184, 228]
```
3. Reverse the whole byte order and complete:
```
[228, 184, 150, 231, 149, 140, 227, 129, 174, 109, 114, 117, 98, 121, 33]
# string
"世界のmruby!"
```
|
|
|
|
Previous example doesn't work because string key (frozen) can't be modified.
|
|
For example on 32 bit mode, when `p = 0xfffffffd`, `e = 0xfffffffe`
and `len = 4`, the sum of `p` and `len` can be to `1`, and comparison
with `e` will to be false.
As a result, a segmentation fault occurs by referring to address 0.
|
|
|
|
Before this patch:
$ bin/mruby -e 'p Struct.new("A-")'
#=> Struct::"A-"
After this patch:
$ bin/mruby -e 'p Struct.new("A-")'
#=> NameError: identifier A- needs to be constant
|
|
- They are not include in Ruby.
- Appear in duplicate when `$1`-`$9` are defined.
|
|
This method is defined in `mruby-metaprog` gem.
|
|
|
|
This time, the allocated memory comes from the string object, which is
referenced from GC arena. The memory region will be reclaimed when the C
function called from VM is terminated, or the GC arena is restored.
|
|
Remove `mrb_alloca()` function
|
|
|
|
When I found this function, I expected it to behave the same as the
`alloca(3)` function, but it is accually the `mrb_alloca()` function
does not free the heap until the `mrb_close()` function is called.
Also, even if it is deleted, it can be replaced with the combination
of the `MRB_TT_DATA` object and the `mrb_gv_set()` function if it is
sure necessary.
|
|
- Before patched:
```
$ mruby -e 'p (-12..-1).map { |i| "Hello"[i] }.join'
"HelloHello"
```
- After patched:
```
$ mruby -e 'p (-12..-1).map { |i| "Hello"[i] }.join'
"Hello"
```
|
|
|
|
Read irep from buffers
|
|
|
|
Or `Float` if `mrb_float` value is too big (or too small) to fit in
`mrb_int`. The `_int_` in `mrb_int_value` means `Integral` module, which
represents integer-like values in mruby.
|
|
|
|
Having these methods in Numeric can get in the way of creating subclasses of
Numeric because they only support Fixnum and Float.
|
|
New functions:
* mrb_num_plus(mrb, x, y)
* mrb_num_minus(mrb, x, y)
* num_num_mul(mrb, x, y)
|
|
Remove "LINE" section reader
|
|
Because it is not currently output by `mrbc`.
|