summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-ext/src/string.c
AgeCommit message (Collapse)Author
2018-11-19Remove implicit conversion using `to_str` method; fix #3854Yukihiro "Matz" Matsumoto
We have added internal convenience method `__to_str` which does string type check. The issue #3854 was fixed but fundamental flaw of lack of stack depth check along with fibers still remains. Use `MRB_GC_FIXED_ARENA` for workaround.
2018-11-15`String#{squeeze,delete,count}` to use bitmap for matching; ref #4163Yukihiro "Matz" Matsumoto
2018-11-15Pattern length may overflow `uint16_t`; fixed #4163Yukihiro "Matz" Matsumoto
The issue is reported by `https://hackerone.com/dgaletic`.
2018-11-02Empty pattern string for `String#tr` should remove characters; fix #4157Yukihiro "Matz" Matsumoto
2018-11-02Empty pattern string can generate `TR_UNINITIALIZED` pattern; fix #4156Yukihiro "Matz" Matsumoto
2018-11-01Silence Appveyor's VC compilation warnings.Yukihiro "Matz" Matsumoto
2018-10-30VS 2017 C does not understand inline struct initialization; ref #4153Yukihiro "Matz" Matsumoto
2018-10-29Keep tr_pattern statictake-cheeze
2018-09-27Fixed a `String#squeeze` bug in handling `iso-8859-1` strings; ref #4127Yukihiro "Matz" Matsumoto
2018-09-26Revert "Fix comparisons in str_squeeze."Yukihiro "Matz" Matsumoto
This reverts commit 7b04fcd092006b6e78cd63619fb7ae972f8e0c5d. The issue was addressed by 9e3cbaa. No longer needed.
2018-09-26Avoid using `memmove()` for performance; fix #4130Yukihiro "Matz" Matsumoto
2018-09-26Rename `tr_pattern_free()` to `tr_free_pattern()`.Yukihiro "Matz" Matsumoto
2018-09-25Fix leak in `mrb_str_count`Takeshi Watanabe
2018-09-24Fix comparisons in str_squeeze.Clayton Smith
2018-09-21Implement `String#delete` and `#delete!`; ref #4086Yukihiro "Matz" Matsumoto
mruby restriction: In mruby, `String#delete` only takes single pattern argument.
2018-09-21Implement `String#count`; ref #4086Yukihiro "Matz" Matsumoto
mruby restriction: In mruby, `String#count` does not take multiple pattern arguments, but only one pattern.
2018-09-21Add `String#squeeze` and `#squeeze!`; ref #4086Yukihiro "Matz" Matsumoto
mruby restriction: `String#squeeze` can take more than 1 pattern arguments in CRuby, in that case, the intersection of patterns will be used to match. But in mruby, it doesn't take multiple patterns.
2018-09-21Add `String#tr_s` and `String#tr_s!`; ref #4086Yukihiro "Matz" Matsumoto
2018-09-21Add `String#tr` and `#tr!` to `mruby-string-ext` gem; fix #4086Yukihiro "Matz" Matsumoto
This patch is based on `mruby/c` implementation by Hirohito Higashi. We might need to add `#tr_s`, `#squeeze` and `#delete` as well. Adding them should not be too hard using functions we implemented here.
2018-07-30New bytecode implementation of mruby VM.Yukihiro "Matz" Matsumoto
2018-04-21Implement `String#upto` in Ruby.Yukihiro "Matz" Matsumoto
Avoid using `mrb_yield` in C code. The function is not recommended. Because it doesn't work well with fibers.
2018-04-19CRuby2.6 stops deprecating `String#lines` with a block.Yukihiro "Matz" Matsumoto
`String#lines` (with a block) is now implemented in Ruby.
2018-04-19`String#lines` with a block is deprecated style.Yukihiro "Matz" Matsumoto
2017-12-08Uninitialized value returned.Yukihiro "Matz" Matsumoto
2017-11-04Merge branch 'master' of github.com:mruby/mrubyYAMAMOTO Masaya
2017-10-17Use a new function: `mrb_get_argc()`; ref #3826Yukihiro "Matz" Matsumoto
2017-10-17Add `String#delete_{prefix,suffix}`; CRuby2.5Yukihiro "Matz" Matsumoto
2017-10-16Support MRB_WIHTOUT_FLOAT to mruby-string-extYAMAMOTO Masaya
2017-09-27fix: mrbgems\mruby-string-ext\src\string.c(49): warning C4244: '=': ↵Tomasz Dąbrowski
conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27fix: mrbgems\mruby-string-ext\src\string.c(30): warning C4244: '=': ↵Tomasz Dąbrowski
conversion from 'mrb_int' to 'long', possible loss of data
2017-09-27fix: mrbgems\mruby-string-ext\src\string.c(38): warning C4244: '=': ↵Tomasz Dąbrowski
conversion from 'mrb_int' to 'char', possible loss of data
2017-08-18Rename `mrb_str_concat2` to `mrb_str_concat_m`.Yukihiro "Matz" Matsumoto
According to the naming convention a function that implements a method should be suffixed by `_m`.
2017-06-20Avoid using `snprintf(3)` in case `MRB_DISABLE_STDIO`; fix #3714Yukihiro "Matz" Matsumoto
2017-06-19Save gc_arena after buffer got allocatedAsmod4n
Latest fix was freeing the buffer while it was still in use. Fixes #3712
2017-06-16Use `MRB_PRId` instead of `d` for mrb_int decimal specifier; ref #3701Yukihiro "Matz" Matsumoto
2017-06-16Use `mrb_str_new()` instead of `malloc()`; ref #3701Yukihiro "Matz" Matsumoto
Otherwise the function may terminate and cause memory leaks.
2017-06-16Should not use `sizeof(buf)` when `buf` is `char*`; #3701Yukihiro "Matz" Matsumoto
2017-06-14Use malloc instead of dynamic allocationksss
2017-06-14Fix arena overflow errorksss
2017-06-14Reimplement String#uptoksss
2017-05-21String#concat: Try to convert when not stringksss
2017-04-25Silence warnings caused by implicit type casting.Yukihiro "Matz" Matsumoto
2017-04-03Unify `else` clause styleYukihiro "Matz" Matsumoto
2017-02-10String#ljust and String#rjust reimplemented with optimized RubyTomasz Dabrowski
2017-02-10String#ljust and String#rjust reimplementation (fix #3445)Tomasz Dabrowski
- String#ljust and String#rjust are now C functions to improve performance - infinite loop because of an empty padding argument is now prevented (ArgumentError is raised) - extra tests for ljust/rjust added
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-04Rewrite String#prepend with Rubyksss
Fix #3357
2016-12-28save/restore arena index around yield; ref #3359Yukihiro "Matz" Matsumoto
2016-11-24Read length after args in String#setbyteCraig Lehmann
Prevents RCE Reported by https://hackerone.com/raydot
2016-11-16Fixed memory disclosure in String#linesYukihiro "Matz" Matsumoto
Reported from from Alex Snaps via Mathieu Leduc-Hamel, both from shopify.com. Thank you!