summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
AgeCommit message (Collapse)Author
2017-05-05Adjust to the optimum typeksss
2017-04-06Make String#replace to check equality before modifying flags.Yukihiro "Matz" Matsumoto
ref #3588
2017-04-03Unify `else` clause styleYukihiro "Matz" Matsumoto
2017-04-03String#initialize to make a string empty; ref #3574Yukihiro "Matz" Matsumoto
2017-03-05String#index shouldn't return nil when "".index ""ksss
2017-02-28Fix integer overflow; fix #3473Yukihiro "Matz" Matsumoto
The fix is suggested by https://hackerone.com/lucnguyen
2017-02-28Add type check by mrb_get_args(); ref #3476Yukihiro "Matz" Matsumoto
2017-02-28Add check before calling str_substr(); ref #3476Yukihiro "Matz" Matsumoto
2017-02-28Check if the value is fixnum before mrb_funcall(); fix #3476Yukihiro "Matz" Matsumoto
The issue is reported by https://hackerone.com/aerodudrizzt
2017-02-11Revert "Optimization for String#* for 1-byte strings"Tomasz Dabrowski
This reverts commit d1bc7caecaf337976351934d5910726106601bd9.
2017-02-11String#replace should update s->flags for MRB_STR_NO_UTF.Yukihiro "Matz" Matsumoto
Otherwise String#size may return wrong length; fix #3448
2017-02-11Add type cast to pacify warningYukihiro "Matz" Matsumoto
2017-02-10Optimization for String#* for 1-byte stringsTomasz Dabrowski
2017-02-07Fix interpolation escaping in String.inspectEdgar Boda-Majer
2017-01-23Changed the behavior of mrb_range_beg_len(); close #3411Yukihiro "Matz" Matsumoto
The new API is: int mrb_range_beg_len(mrb, range, &beg, &len, len, trunc) The new argument `trunc` is a boolean value that specifies whether the function truncates the range. The new return value is an integer instead of a boolean, that is: 0: not a range 1: range with proper edges 2: out of range To get the old behavior, you have to rewrite: mrb_range_beg_len(mrb, range, &beg, &len, len) to: mrn_range_beg_len(mrb, range, &beg, &len, len, TRUE) == 1 [Breaking Change]
2017-01-23Should not make empty strings shared; fix #3407Yukihiro "Matz" Matsumoto
2017-01-11String#replace should check replacing string; fix #3374Yukihiro "Matz" Matsumoto
This issue was reported by https://hackerone.com/tunz
2017-01-06Improve capacity enhancing conditionsYukihiro "Matz" Matsumoto
2017-01-06Add pointer cast to pacify warnings.Yukihiro "Matz" Matsumoto
2017-01-06Move mrb_assert() position.Yukihiro "Matz" Matsumoto
2017-01-06Should not deallocate shared string referring static; fix #3373Yukihiro "Matz" Matsumoto
2017-01-02Fix memory error on str_buf_catksss
Modify from nofree to embed string
2017-01-02Small refactoring: should use RSTR_CAPAksss
2016-12-31str_buf_cat(): better size check added; ref #3342Yukihiro "Matz" Matsumoto
2016-12-31str_buf_cat(): should allocate at least RSTRING_EMBED_LEN_MAX+1.Yukihiro "Matz" Matsumoto
2016-12-25Merge pull request #3364 from ksss/string2Yukihiro "Matz" Matsumoto
Check overflow string length
2016-12-23Check overflow string lengthksss
Fix #3360
2016-12-23Do nothing when empty stringksss
Fix #3361
2016-12-15Fix crash when exponent is -2147483648Clayton Smith
2016-12-13Add assertion to make sure new capacity does not overflow.Yukihiro "Matz" Matsumoto
2016-12-13Make sure str->capa is under MRB_INT_MAX; fix #3342Yukihiro "Matz" Matsumoto
2016-12-12rename prefix RBASIC_ to MRB_; ref #3340Yukihiro "Matz" Matsumoto
2016-12-11Implement Object#freezeTakashi Kokubun
2016-12-08Removed unnecessary const macro - const keyword is already a dependencyFelix Jones
2016-12-08disable define const on VSYasuhiro Matsumoto
2016-12-07Removed the errno declaration from string.cFelix Jones
2016-12-07Wrapped string.c errno with ifndef macro for platforms that use inbuilt ↵Felix Jones
errno macro
2016-12-03add MRB_API to mrb_float_read(); ref #3270Yukihiro "Matz" Matsumoto
2016-12-03Import locale insensitive strtod() from Ruby1.8; fix #3270Yukihiro "Matz" Matsumoto
The function was renamed to `mrb_float_read(const char*, char**)`.
2016-11-24Get String length after args in String#chomp!Clayton Smith
Fixes RCE issue Reported by @bouk
2016-11-24Fixes for compiling mruby as C++Tomasz Dąbrowski
2016-11-17String#include? does not take integersYukihiro "Matz" Matsumoto
2016-11-16Correct argument specifications for few methods:Tomasz Dąbrowski
- Struct#values_at - Module#define_method - String#chop - String#chop!
2016-09-27mrb_str_strlen() should be MRB_API; ref #3216Yukihiro "Matz" Matsumoto
2016-09-25Remove needless MRB_APIKouhei Sutou
ref #3215 If a function (such as mrb_read_irep_file()) is declared without MRB_API in header file (such as include/mruby/dump.h), implementation of the function in source file (such as src/load.c) should also defined without MRB_API. If MRB_API is mismatch, Visual C++ reports link error with C2375 error code: https://msdn.microsoft.com/en-us/library/5k6kw95a.aspx
2016-02-05[cppcheck] mrb_str_rindex() remove unnecessary len update by chars2bytes()Yukihiro "Matz" Matsumoto
2016-02-04cache UTF8 status for utf8_strlen(); ref #980Yukihiro "Matz" Matsumoto
2016-01-14Fix all zero string caseSyohei YOSHIDA
2016-01-05bytes2chars() conversion to fail if target byte offset is not on the ↵Yukihiro "Matz" Matsumoto
character boundary; ref #3067 that means String#index matches first byte of a multi-byte character. this behavior is different from CRuby, but a compromise for mruby which does not have encoding stuffs.
2015-12-31Use memchr for performanceksss
```ruby s = "b" str = ("a" * 100 + s) t = Time.now str.index(s) puts Time.now - t ``` before => 0.000788 after => 0.000508 --- ```ruby s = "b" str = ("a" * 100 * 1024 * 1024 + s) t = Time.now str.index(s) puts Time.now - t ``` before => 0.225474 after => 0.008658