summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
2019-08-06Add `mrb_noreturn` to `cmperr()` in `src/numeric.c`KOBAYASHI Shuji
2019-08-06Should have cleared `mrb->globals` in `mrb_gc_free_gv`; fix #4618Yukihiro "Matz" Matsumoto
2019-08-05Use new specifiers/modifiers of `mrb_vfromat()`KOBAYASHI Shuji
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in my environment than before the introduction of new specifiers/modifiers (5116789a) with this change. ------------+-------------------+-------------------+-------- BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO ------------+-------------------+-------------------+-------- mruby | 593416 bytes | 593208 bytes | -0.04% libmruby.a | 769048 bytes | 767264 bytes | -0.23% ------------+-------------------+-------------------+-------- BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613, so I put it back.
2019-08-03Change second argument to `%l` of `mrb_vformat()` to `size_t` from `mrb_int`KOBAYASHI Shuji
- `size_t` is more commonly used. - `len` argument of `mrb_str_new()` is `size_t`. NOTE: The test for `%l` is temporarily disabled because adding a new type to `mrbgems/mruby-test/vformat.c` causes an error (memory error?) on Visual Studio 2017 in AppVeyor.
2019-08-03Fix `mrb_vformat("%f")` with `MRB_USE_FLOAT`KOBAYASHI Shuji
It potentially not work when `mrb_float` is `float` because `float` variable in variable length arguments is promoted to `double`. Also I fixed build with `MRB_WITHOUT_FLOAT`.
2019-08-02Change the `mrb_vformat` specifier `%d` for `int`KOBAYASHI Shuji
It potentially breaks, for example, in the case of `mrb_int` is 64-bit and more smaller type is passed by `%d`. In fact, the problem could become apparent when I used `%d` to `backtrace_location::lineno` in `src/backtrace.c:mrb_unpack_backtrace()` on AppVeyor. Therefore, change `%d` for `int` (not `mrb_int`) so that it can be used mostly without casting.
2019-08-01Add new specifiers/modifiers to format string of `mrb_vfromat()`KOBAYASHI Shuji
Format sequence syntax: %[modifier]specifier Modifiers: ----------+------------------------------------------------------------ Modifier | Meaning ----------+------------------------------------------------------------ ! | Convert to string by corresponding `inspect` instead of | corresponding `to_s`. ----------+------------------------------------------------------------ Specifiers: ----------+----------------+-------------------------------------------- Specifier | Argument Type | Note ----------+----------------+-------------------------------------------- c | char | d,i | mrb_int | f | mrb_float | l | char*, mrb_int | Arguments are string and length. n | mrb_sym | s | char* | Argument is NUL terminated string. t | mrb_value | Convert to type (class) of object. v,S | mrb_value | C | struct RClass* | T | mrb_value | Convert to real type (class) of object. Y | mrb_value | Same as `!v` if argument is `true`, `false` | | or `nil`, otherwise same as `T`. % | - | Convert to percent sign itself (no argument | | taken). ----------+----------------+-------------------------------------------- This change will increase the binary size, but replacing all format strings with new specifiers/modifiers will decrease the size because it reduces inline expansion of `mrb_obj_value()`, etc. at the caller.
2019-07-31Avoid `MRB_INT_MIN` to apply `fixdivmod`.Yukihiro "Matz" Matsumoto
`MRB_INT_MIN` is the only integer value that has no corresponding positive integer value (i.e. `-MRB_INT_MIN` = `MRB_INT_MIN`).
2019-07-31Normalize floating point negative zero to positive zero in `flodivmod'.Yukihiro "Matz" Matsumoto
2019-07-31Should return +/- infinity for float division by zero.Yukihiro "Matz" Matsumoto
2019-07-31Use `NULL` instead of `0` for null pointers.Yukihiro "Matz" Matsumoto
2019-07-30Fixed integer overflow in `lshift`.Yukihiro "Matz" Matsumoto
2019-07-22Merge pull request #4590 from shuujii/fix-Module-dup-to-frozen-moduleYukihiro "Matz" Matsumoto
Fix `Module#dup` to frozen module
2019-07-22Set `MRB_STR_ASCII` flag in `String#inspect`KOBAYASHI Shuji
`String#inspect` can set `MRB_STR_ASCII` flag to receiver and return value because it checks character byte length.
2019-07-22No rounding needed if 'ndigits` is bigger than `DBL_DIG+2`; fix #4566Yukihiro "Matz" Matsumoto
2019-07-20Fix `Module#dup` to frozen moduleKOBAYASHI Shuji
Before this patch: $ bin/mruby -e 'p Module.new.freeze.dup.frozen?' #=> true After this patch (same as Ruby): $ bin/mruby -e 'p Module.new.freeze.dup.frozen?' #=> false
2019-07-18Merge pull request #4575 from dearblue/attr-use-stackYukihiro "Matz" Matsumoto
Use stack memory for small name of attr accessors
2019-07-18Clear `env` before top-level execution; fix #4581Yukihiro "Matz" Matsumoto
2019-07-17Avoid `MRB_INLINE` for `mrb_str_modify()`; ref #4579Yukihiro "Matz" Matsumoto
Functions that are called infrequently need not to be inline.
2019-07-16Copy receiver's `MRB_STR_ASCII` flag in some methods of `String`KOBAYASHI Shuji
2019-07-16Merge pull request #4580 from shuujii/unify-type-of-line-number-to-uint16_tYukihiro "Matz" Matsumoto
Unify type of line number to `uint16_t`
2019-07-16Merge pull request #4579 from ↵Yukihiro "Matz" Matsumoto
shuujii/keep-MRB_STR_ASCII-flag-in-some-methods-of-String Keep `MRB_STR_ASCII` flag in some methods of `String`
2019-07-15Unify type of line number to `uint16_t`KOBAYASHI Shuji
2019-07-15Add `MRB_API` to `mrb_str_modify_keep_ascii()`KOBAYASHI Shuji
2019-07-14Keep `MRB_STR_ASCII` flag in some methods of `String`KOBAYASHI Shuji
2019-07-14Improve `utf8len()` performance with UTF-8dearblue
2019-07-13Use stack memory for small name of attr accessorsdearblue
Also integrated the common parts of `mrb_mod_attr_reader()` and `mrb_mod_attr_writer()` functions.
2019-07-13Change type of a variable for signedness mismatch; ref #4573Yukihiro "Matz" Matsumoto
2019-07-13Avoid `mrb_funcall()` if possible using `mrb_Float()`; ref #4555Yukihiro "Matz" Matsumoto
2019-07-12Fix heap buffer overflow; fix #4569dearblue
2019-07-11Improve performance `String#index` with UTF-8dearblue
Based on Boyer-Moore-Horspool algorithm (Quick Search algorithm). As a side effect, the correct position is returned even if an invalid UTF-8 string is given. ```console % ./mruby@master -e 'p ("\xd1" * 100 + "#").index("#")' 50 % ./mruby@improve-index -e 'p ("\xd1" * 100 + "#").index("#")' 100 ``` The other behavior should be the same as the current implementation.
2019-07-10Remove an unused argument of `str_with_class()`KOBAYASHI Shuji
2019-07-09Set `MRB_STR_ASCII` flag when an inline symbol is stringizedKOBAYASHI Shuji
2019-07-08Add macros for inline symbol for readabilityKOBAYASHI Shuji
2019-07-06Fix missing `#ifndef MRB_ENABLE_ALL_SYMBOLS`KOBAYASHI Shuji
2019-07-05Read/write `MRB_STR_ASCII` flag only when `MRB_UTF8_STRING` is definedKOBAYASHI Shuji
2019-07-04It was too early to check `key` for `undef`; ref #4534Yukihiro "Matz" Matsumoto
2019-07-04Rename `MRB_STR_NO_UTF` to 'MRB_STR_ASCII`; close #4550Yukihiro "Matz" Matsumoto
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.
2019-07-04Fix heap buffer overflow; ref #4549dearblue
This patch is showed in #4549.
2019-07-03Refine document to mrb_get_args()` [ci skip]KOBAYASHI Shuji
2019-07-02Fix and refine error message in `mrb_obj_to_sym()`KOBAYASHI Shuji
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
2019-07-01Remove unused C header file from `src/etc.c`KOBAYASHI Shuji
2019-06-30Fix `include`, `prepend` and `extend` to frozen objectKOBAYASHI Shuji
2019-06-29Simplify `mrb_str_aref_m()` and `mrb_str_aref()`dearblue
It is integration with part of argument parsing used in `mrb_str_aset_m()`.
2019-06-29Replace `String#[]=` method by C implementsdearblue
The purpose is to eliminate string objects that are temporarily created during processing.
2019-06-28Remove unnecessary backticks in `src/range.c`; ref #2858KOBAYASHI Shuji
2019-06-27Skip copying delete keys in a hash; fix #4534Yukihiro "Matz" Matsumoto
2019-06-26Silence unused label warnings from gcc; ref #4524KOBAYASHI Shuji
mruby/mruby/src/string.c:1722:4: warning: label 'bytes' defined but not used [-Wunused-label] bytes: ^~~~~
2019-06-26Merge pull request #4524 from dearblue/reverse-utf8Yukihiro "Matz" Matsumoto
Change to UTF-8 string reversing with in place
2019-06-26Merge pull request #4532 from ↵Yukihiro "Matz" Matsumoto
shuujii/fix-String-byteslice-with-MRB_UTF8_STRING-and-some-edge-cases Fix `String#byteslice` with `MRB_UTF8_STRING` and some edge cases