Yukihiro Matsumoto
6f9ed1c5b2
use return value from sprintf/snprintf
2012-06-27 15:14:56 +09:00
Masamitsu MURASE
c152c194a1
Prevent memory leak when string literal is created.
2012-06-26 01:34:41 +09:00
Yukihiro Matsumoto
f045e64675
reduce calling mrb_str_new_cstr() to avoid strlen(); #301
2012-06-23 13:51:50 +09:00
Yukihiro Matsumoto
2d781f5c1d
remove assertion for false assumption; mrb_str_new(0, len) where len > 0 can be used to allocate an unintialized string
2012-06-23 09:49:14 +09:00
Masaki Muranaka
21f2e5364b
Use mrb_str_new() instead of mrb_str_new2() as possible.
2012-06-22 17:02:08 +09:00
Yukihiro Matsumoto
a70c4e0c79
reduce calling of strlen(); #301
2012-06-21 16:22:29 +09:00
Yukihiro Matsumoto
ef50e63a63
remove RuntimeError from mrb_state
2012-06-20 20:43:27 +09:00
Masaki Muranaka
2c93fab066
Remove TRUE/FALSE definition in C sources. (Reported by #282 but not applied.)
2012-06-15 16:55:49 +09:00
Yukihiro Matsumoto
76f7aecff3
use ENABLE/DISABLE instead of INCLUDE for configuration macro names
2012-06-15 15:34:49 +09:00
Masaki Muranaka
f564ec7e82
Remove some redundant code.
2012-06-15 00:56:00 +09:00
Yukihiro Matsumoto
30a062c165
String#split("") should split per character (byte for now)
2012-06-12 12:58:49 +09:00
Yukihiro Matsumoto
ff4925b804
corrupted String#inspect on backslash escapes
2012-06-12 12:56:21 +09:00
Yukihiro Matsumoto
5937c29281
s.split(nil) should work like s.split()
2012-06-12 12:29:20 +09:00
Yukihiro Matsumoto
debf296843
remove obsolete comment
2012-06-12 10:22:56 +09:00
Yukihiro Matsumoto
6987ba02f8
String#split now understands string sep
2012-06-12 09:51:10 +09:00
Yukihiro Matsumoto
dd550ca0d4
should increment p on every iteration; close #254
2012-06-11 14:33:01 +09:00
Masamitsu MURASE
3bb09f9928
string.subseq should create new string based on 'ptr' not on 'aux.shared'.
2012-06-11 02:00:32 +09:00
Yukihiro Matsumoto
e3d17e54f8
mruby/string.h: rename buf to ptr
2012-06-05 23:17:09 +09:00
Yukihiro Matsumoto
b2e6a0fc04
symbol can contain non printable characters
2012-06-04 20:34:43 +09:00
Yukihiro Matsumoto
3be1c88907
str_modify() revives string buffer kept in shared structure if refcnt == 1
2012-06-03 22:59:40 +09:00
Yukihiro Matsumoto
dece49750d
string.subseq should update shared refcnt
2012-06-03 21:06:04 +09:00
Yukihiro Matsumoto
361d0ca75d
strig.c should properly decref shared entities
2012-06-03 20:59:33 +09:00
Yukihiro Matsumoto
28b9619bb4
should decref shared string body on gc_free
2012-06-03 15:45:06 +09:00
Yukihiro Matsumoto
6c2c5540e2
should initialize shared->buf as well as s->buf
2012-06-03 09:09:40 +09:00
Yukihiro Matsumoto
52fdeb0225
str_make_shared not to return new string
2012-06-03 09:05:09 +09:00
Yukihiro Matsumoto
12d75223d6
make shared string to reference-counted C structure to reduce GC pressure
2012-06-03 07:55:39 +09:00
Yukihiro Matsumoto
b2d0f22dee
ensure str_modify is called at the beginning of modifying methods
2012-06-02 04:12:23 +09:00
Yukihiro Matsumoto
cd48737e11
mrb_str_concat was broken for shared strings; close #214
2012-06-02 00:07:05 +09:00
Yukihiro Matsumoto
f56abcbb5a
reorder mrb_ary_new_from_values() args to (argc, argv)
2012-06-01 02:18:30 +09:00
Yukihiro Matsumoto
ae9d9a0781
correctly share string bodies
2012-05-31 22:49:38 +09:00
Yukihiro Matsumoto
16b0a1a0e8
remove unused str_new_frozen
2012-05-31 19:52:46 +09:00
Yukihiro Matsumoto
21c1e2fdad
shared strings should not chain
2012-05-31 19:52:37 +09:00
Yukihiro Matsumoto
326fc888e4
allow string shared body
2012-05-31 19:16:48 +09:00
Yukihiro Matsumoto
3055a3bc8c
reimplement String#*
2012-05-31 16:34:57 +09:00
Yukihiro Matsumoto
5450f925da
reimplement String#<=>
2012-05-31 16:33:03 +09:00
Yukihiro Matsumoto
b05014f6a9
reimplement String#capitalize
2012-05-31 16:31:33 +09:00
Yukihiro Matsumoto
0009239f29
reimplement String#chomp
2012-05-31 16:29:47 +09:00
Yukihiro Matsumoto
c7f540ed67
reimplement String#upcase
2012-05-31 16:14:50 +09:00
Yukihiro Matsumoto
86697ca7b4
reimplement String#downcase
2012-05-31 16:14:11 +09:00
Yukihiro Matsumoto
1df00298f9
reimplement String#replace
2012-05-31 16:10:28 +09:00
Yukihiro Matsumoto
1f1ab75d75
resolve conflict
2012-05-31 15:33:20 +09:00
Yukihiro Matsumoto
64fc4ac332
resolve conflict
2012-05-31 15:32:38 +09:00
Yukihiro Matsumoto
0d8adaaaa1
wrong String#index behavior on udef INCLUDE_ENCODING
2012-05-31 14:54:52 +09:00
Yukihiro Matsumoto
708c455833
wrong String#inspect behavior on udef INCLUDE_ENCODING
2012-05-31 14:50:16 +09:00
Yukihiro Matsumoto
0e5958d404
rename ruby_digitmap to mrb_digitmap
2012-05-30 21:19:04 +09:00
Masaki Muranaka
34dddc58e1
Use default case in switch statement.
2012-05-29 16:15:43 +09:00
Yukihiro Matsumoto
ad9e841c53
made mrb_get_args() better (optinal args, type checks); close #173 #176
2012-05-24 01:09:36 +09:00
Yukihiro Matsumoto
4523bee953
cast style consistency
2012-05-23 03:31:55 +09:00
Mitchell Blank Jr
9e336b00e5
More C++ compilability work: mrb_obj_alloc void* conversions
...
One of the biggest set of changes needed to make C++ compile, is that you
can't autoconvert "void*" to a different pointer type without a cast (you
can of course, convert pointers *to* "void*"!)
For the first part, convert the users of "mrb_obj_alloc". Since it has
to return something, make it RBasic* (that's what mrb_obj_alloc() is
operating on anyway). This way, even in C you'll get a warning if you
don't cast it.
For places where there are a lot of similar calls to mrb_obj_alloc(),
this can be easily hidden through a macro. I did this in string.c:
#define mrb_obj_alloc_string(mrb) ((struct RString *) mrb_obj_alloc((mrb), MRB_TT_STRING, (mrb)->string_class))
I also updated the mrb_object() macro to also return a RBasic* -- my
previous commit changed that from "void*" -> "RObject*", but I figure
it should be consistent with mrb_obj_alloc()
2012-05-20 09:43:14 -07:00
Yukihiro Matsumoto
b68e69aa32
remove unused assignments
2012-05-17 12:57:08 +09:00