Yukihiro "Matz" Matsumoto
bbb0882343
Modifying frozen objects will raise FrozenError.
...
`FrozenError` is a subclass of `RuntimeError` which used to be
raised. [Ruby2.5]
2017-12-12 18:41:18 +09:00
Yukihiro "Matz" Matsumoto
f1207573bd
Uninitialized value returned.
2017-12-08 09:50:02 +09:00
YAMAMOTO Masaya
625f9f6fa3
Merge branch 'master' of github.com:mruby/mruby
2017-11-04 01:23:12 +09:00
Yukihiro "Matz" Matsumoto
3c20c96f84
Use a new function: mrb_get_argc(); ref #3826
2017-10-17 15:23:32 +09:00
Yukihiro "Matz" Matsumoto
4122c320bb
Add {String,Symbol}#casecmp?; CRuby2.4
2017-10-17 13:26:37 +09:00
Yukihiro "Matz" Matsumoto
332d8d2a1c
Add String#delete_{prefix,suffix}; CRuby2.5
2017-10-17 11:19:12 +09:00
YAMAMOTO Masaya
9c1f21aaa1
Support MRB_WIHTOUT_FLOAT to mruby-string-ext
2017-10-16 18:09:56 +09:00
Tomasz Dąbrowski
2640896911
fix: mrbgems\mruby-string-ext\src\string.c(49): warning C4244: '=': conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27 22:22:04 +02:00
Tomasz Dąbrowski
8d816fa142
fix: mrbgems\mruby-string-ext\src\string.c(30): warning C4244: '=': conversion from 'mrb_int' to 'long', possible loss of data
2017-09-27 22:22:04 +02:00
Tomasz Dąbrowski
d3819620ce
fix: mrbgems\mruby-string-ext\src\string.c(38): warning C4244: '=': conversion from 'mrb_int' to 'char', possible loss of data
2017-09-27 22:22:04 +02:00
Yukihiro "Matz" Matsumoto
198c898817
Rename mrb_str_concat2 to mrb_str_concat_m.
...
According to the naming convention a function that implements
a method should be suffixed by `_m`.
2017-08-18 22:17:47 +09:00
Yukihiro "Matz" Matsumoto
615e7e44e3
Avoid using snprintf(3) in case MRB_DISABLE_STDIO; fix #3714
2017-06-20 09:39:33 +09:00
Asmod4n
abca63c73b
Save gc_arena after buffer got allocated
...
Latest fix was freeing the buffer while it was still in use.
Fixes #3712
2017-06-19 20:27:38 +02:00
Yukihiro "Matz" Matsumoto
0411cea2df
Use MRB_PRId instead of d for mrb_int decimal specifier; ref #3701
2017-06-16 11:50:38 +09:00
Yukihiro "Matz" Matsumoto
e96f254ead
Use mrb_str_new() instead of malloc(); ref #3701
...
Otherwise the function may terminate and cause memory leaks.
2017-06-16 11:46:40 +09:00
Yukihiro "Matz" Matsumoto
473b2bb20d
Should not use sizeof(buf) when buf is char*; #3701
2017-06-16 11:42:51 +09:00
ksss
4d9ca27ba6
Use malloc instead of dynamic allocation
2017-06-14 18:28:39 +09:00
ksss
432a813905
Fix arena overflow error
2017-06-14 18:12:56 +09:00
ksss
19785f43d1
Reimplement String#upto
2017-06-14 17:30:31 +09:00
ksss
98f9c33fe0
String#concat: Try to convert when not string
2017-05-21 10:30:27 +09:00
Yukihiro "Matz" Matsumoto
3e07a2d77c
Silence warnings caused by implicit type casting.
2017-04-25 21:00:16 +09:00
Yukihiro "Matz" Matsumoto
77331d127b
Unify else clause style
2017-04-03 16:56:27 +09:00
Yukihiro "Matz" Matsumoto
4763312fb8
Terminate loop if generated string longer than the last; ref #3489
2017-03-10 10:38:28 +09:00
ksss
eba4b1fd76
Check modifiable for String `bang' methods
2017-03-05 23:04:22 +09:00
Yukihiro "Matz" Matsumoto
0b143898c4
Remove historical comment; ref #3450 #3448
2017-02-11 16:52:45 +09:00
robert
b130f43298
remove skip that shouldn't be necessary anymore.
...
the test should pass after https://github.com/mruby/mruby/commit/8f4a929e1a01c8d6176fb53a9ef5dff6de632959 .
2017-02-11 07:40:55 +00:00
Tomasz Dabrowski
ac9d04f4af
String#ljust and String#rjust reimplemented with optimized Ruby
2017-02-10 15:31:33 +01:00
Tomasz Dabrowski
24048cd998
Tests for UTF-8 String#ljust and String#rjust
2017-02-10 15:16:49 +01:00
Tomasz Dabrowski
981105b3e6
String#ljust and String#rjust reimplementation ( fix #3445 )
...
- 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-02-10 12:59:28 +01:00
Yukihiro "Matz" Matsumoto
5e1d923381
Changed the behavior of mrb_range_beg_len(); close #3411
...
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-23 14:35:26 +09:00
ksss
eeca6ec8f5
Rewrite String#prepend with Ruby
...
Fix #3357
2017-01-04 14:00:28 +09:00
Yukihiro "Matz" Matsumoto
803bf010ca
save/restore arena index around yield; ref #3359
2016-12-28 13:00:28 +09:00
Craig Lehmann
83005d83d8
Read length after args in String#setbyte
...
Prevents RCE
Reported by https://hackerone.com/raydot
2016-11-24 10:31:29 -05:00
Yukihiro "Matz" Matsumoto
92be276d76
String#{strip,lstrip,rstrip} may cause OOB access
2016-11-17 18:00:21 +09:00
Yukihiro "Matz" Matsumoto
242b219471
Fixed memory disclosure in String#lines
...
Reported from from Alex Snaps via Mathieu Leduc-Hamel,
both from shopify.com. Thank you!
2016-11-16 02:05:19 +09:00
Nobuyoshi Nakada
6511bfd79a
Removed trailing spaces
2016-09-28 12:29:41 +09:00
Hiroshi Mimaki
861b0eed7b
Fix String#ord failure which return a negative value
2016-08-17 15:29:59 +09:00
Kouhei Sutou
6bb0775d76
Reduce needless Array generation in some String methods
...
Here are some benchmarks:
each_char:
# /tmp/each_char.rb
a = "a" * 1000000
a.each_char do |x|
end
Without this change:
% time bin/mruby /tmp/each_char.rb
bin/mruby /tmp/each_char.rb 1.07s user 0.02s system 99% cpu 1.088 total
With this change:
% time bin/mruby /tmp/each_char.rb
bin/mruby /tmp/each_char.rb 0.52s user 0.01s system 99% cpu 0.530 total
2 times faster with this change.
codepoints:
# /tmp/codepoints.rb
a = "a" * 1000000
a.codepoints do |x|
end
Without this change:
% time bin/mruby /tmp/codepoints.rb
bin/mruby /tmp/codepoints.rb 1.16s user 0.05s system 99% cpu 1.216 total
With this change:
% time bin/mruby /tmp/codepoints.rb
bin/mruby /tmp/codepoints.rb 0.56s user 0.02s system 99% cpu 0.589 total
2016-07-27 13:58:07 +09:00
ksss
bef63a4f91
Support to call without block to String#each_char
2016-07-26 18:46:23 +09:00
ksss
d83d9cd164
String#insert should be destructive
2016-07-14 21:33:15 +09:00
Akira Moroo
cb1a80e741
Add String#rjust test to mruby-string-ext
2016-01-30 14:28:00 +09:00
Akira Moroo
e86bc6bb47
Add String#rjust to mruby-string-ext
2016-01-30 14:25:53 +09:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
takahashim
621487a0cd
add {Array|Hash|String}.try_convert
2015-11-24 08:39:39 +09:00
Yukihiro "Matz" Matsumoto
798ec3aff4
UTF-8 string support in core
...
define MRB_UTF8_STRING (in mrbconf.h) to enable UTF-8 support.
2015-09-24 02:37:33 +09:00
INOUE Yasuyuki
0d055559f1
Use #nil? instead of == nil.
2015-08-22 19:57:11 +09:00
Yukihiro "Matz" Matsumoto
4fdf492219
add String#setbyte and String#byteslice to mruby-string-ext
2015-08-05 11:28:41 +09:00
Jun Hiroe
4e4929bc72
Rename extended xxxx class or module to xxxx class or module extension
2015-06-28 11:18:52 +09:00
Jun Hiroe
c69d1201e1
Fix typo; Replace extensional with extended
2015-06-28 00:05:58 +09:00
cremno
2ee84eb3df
remove unnecessary including of <ctype.h>
...
Not needed anymore since 85075bef75
2015-05-28 10:44:20 +02:00