Commit Graph

139 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 378aa8a9c8 avoid wrong ArgumentError from mrb_get_args() when surrounding method takes more than one argument; ref #2627 2014-10-30 10:31:06 +09:00
Yukihiro "Matz" Matsumoto 5bd3d9bc27 add cast to return from aget_index(); ref #2627 2014-10-30 10:27:05 +09:00
mattn eaa0296fc5 Handle Array#[float, int] Close #2626 2014-10-29 19:27:20 +09:00
Yukihiro "Matz" Matsumoto 48c5321dca constify pointer from RARRAY_PTR to detect potential write barrier bugs.
if you see compiler errors due to this commit, you'd better to use array-modifying
functions, e.g. mrb_ary_set() or mrb_ary_push(), otherwise you might see nasty
GC bugs in the future.  if you are sure what you are doing, replace `RARRAY_PTR(ary)`
by `mrb_ary_ptr(ary)->ptr`. but be warned.
2014-09-12 12:42:39 +09:00
kkkkkt 9da37cdfd1 refactor mruby method(fix indent. remove temporary value, duplicate procedure) 2014-08-18 10:58:48 +09:00
Jun Hiroe 3569723ab3 Refactor obj_free() in gc.c 2014-08-05 23:16:01 +09:00
Yukihiro "Matz" Matsumoto 6aa6e75f75 rename obsolete mrb_special_const_p to mrb_immediate_p 2014-08-04 00:50:03 +09:00
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
Yukihiro "Matz" Matsumoto ef432d7524 Merge pull request #2451 from take-cheeze/remove_mem_out_check
Remove unnecessary out of memory check in `ary_expand_capa`.
2014-07-08 23:07:30 +09:00
take_cheeze 5b0f900faa Remove unnecessary out of memory check in ary_expand_capa.
Since `mrb_realloc` raises when failed to allocate memory.
2014-07-07 21:58:38 +09:00
take_cheeze 13d9631e21 Add new API mrb_ary_resize(mruby implementation of rb_ary_resize). 2014-07-06 22:23:29 +09:00
Yukihiro "Matz" Matsumoto 5c50bcd20a reformat else part; ref #2447 2014-07-06 21:00:57 +09:00
take_cheeze 6cbcbd5290 Reduce allocation in shared RArray clearing. 2014-07-05 21:10:02 +09:00
Yukihiro "Matz" Matsumoto b34e24b07d use mrb_field_write_barrier_value() in array.c 2014-05-08 11:06:41 +09:00
yui-knk eafc4dd0af Make Array#[]= raise IndexError.
If second param is negative, Array#[] raise IndexError.
2014-05-08 00:17:17 +09:00
cremno 91c22f32f4 rename mrb_str_buf_append to mrb_str_cat_str
The new name is better and less confusing, because:
  - `mrb_str_append` calls `mrb_str_to_str` and this function doesn't
  - `mrb_str_buf_append` _is_ `mrb_str_cat` for `mrb_value` strings
2014-04-27 22:33:22 +02:00
Yukihiro "Matz" Matsumoto 83c1399af0 eliminate plain int except for a few cases like arena_index 2014-04-25 04:01:57 +09:00
cremno bc23a5e9e5 remove mrb_str_buf_cat
It does the same as `mrb_str_cat`.
2014-04-21 21:28:06 +02:00
Yukihiro "Matz" Matsumoto 5138f62d6b resolve conflict 2014-04-15 10:55:46 +09:00
Yukihiro "Matz" Matsumoto b4043256d0 implement part of Array#<=> in C 2014-04-02 18:04:09 +09:00
Yukihiro "Matz" Matsumoto 94effc6a37 implement Array comparisons by Ruby 2014-04-02 17:33:25 +09:00
Yukihiro "Matz" Matsumoto d9feed6703 move Array#inspect implementation to mrblib/array.rb 2014-04-01 14:31:39 +09:00
Yukihiro "Matz" Matsumoto 3e24e06b29 add a space after C reserved words 2014-03-18 23:57:29 +09:00
Masaki Muranaka 1df355e300 Reduce implicit type casts. 2014-03-18 17:36:47 +09:00
Yukihiro "Matz" Matsumoto 5fb8fa5a81 add _FLAG to SET_SHARED macros; ref #1750 2014-03-01 10:26:21 +09:00
Yukihiro "Matz" Matsumoto fca90a43c7 Merge branch 'array-shared-macro' of https://github.com/ksss/mruby into ksss-array-shared-macro 2014-03-01 10:19:55 +09:00
ksss 88f3e5b294 move check condition to outside in while block 2014-02-27 23:54:36 +09:00
ksss f1043ab85c add macro ARY_UNSET_SHARED 2014-02-27 00:11:40 +09:00
ksss 2f090879a5 add macro ARY_SET_SHARED 2014-02-27 00:10:42 +09:00
ksss 3e4e90a708 add macro ARY_SHARED_P 2014-02-26 21:40:36 +09:00
cremno 7691b64963 array implementation: several small changes
src/array.c:
 - make various functions without declaration in the mruby headers static
 - removed all uncessary int casts and two useless comments
 mrb_ary_new_from_values: move to similar functions
 mrb_check_array_type: fix indentation

include/mruby/array.h:
 mrb_shared_array: padding (default "mrbconf.h" on an usual 64-bit system)
                   sizeof(mrb_int)==sizeof(int)==4 && sizeof(mrb_value*)==8

both:
 mrb_ary_aget:  remove declaration in header and make static
                nobody uses it which is not surprising since it has 1 req arg!
 mrb_assoc_new: small optimization and move to similar functions
 mrb_ary_len:   re-implement as static inline function (it is used by mrbgems)
                programmers should directly use RARRAY_LEN instead
2014-02-12 00:37:47 +01:00
Yukihiro "Matz" Matsumoto 4a2c37df93 made mrb_define_class to return existing class, with heavy refactoring 2014-02-08 13:44:31 +09:00
Yukihiro "Matz" Matsumoto 7ba4612956 use mrb_str_new_lit() more widely 2014-02-06 08:54:47 +09:00
h2so5 b53d91e6e2 fix NODE_SPLAT codegen 2014-02-01 12:22:28 +09:00
Yukihiro "Matz" Matsumoto aa08158f67 Array#[]= is now range aware 2014-01-30 10:50:56 +09:00
Yukihiro "Matz" Matsumoto 5346bdd76b move range aware aget to array.c from mruby-array-ext gem 2014-01-29 14:53:38 +09:00
cremno aa655b9ee1 remove superfluous includes
- reduce compile time by a little bit (full-core: ~0.7s for me)
- thanks to 'include-what-you-use' for some help
- include Standard C header files before any other (coding style)
2014-01-07 17:56:30 +01:00
Yukihiro "Matz" Matsumoto 925137475c should splat and iterate elements when "*ary" speficied in the case-when clause; close #1627 2014-01-04 11:25:53 +09:00
Yukihiro "Matz" Matsumoto 6d7b3a7bc9 mrb_ary_splat() to call #to_a 2014-01-03 23:57:20 +09:00
Yukihiro "Matz" Matsumoto dc27c2be46 Merge pull request #1634 from cremno/use-mrb_fixnum_p
tiny word boxing optimization
2014-01-02 15:46:00 -08:00
cremno 18433731ed remove various preprocessor conditionals
- HAVE_IEEEFP_H is nowhere defined or needed at all
- FreeBSD < 4 is unsupported since years
- MSVC workaround (around what exactly?)
2014-01-02 07:33:33 +01:00
cremno 09bb30870b tiny word boxing optimization 2014-01-02 06:36:29 +01:00
Jun Hiroe 853e26e16a Fix ISO no in Array#* and Array#+ 2013-12-07 12:22:25 +09:00
take_cheeze df780ae5e9 add mrb_intern_lit for creating symbol from string literal 2013-12-01 10:38:59 +09:00
Yukihiro "Matz" Matsumoto 9c6398a444 rename mrb_intern2() to mrb_intern(); huge API incompatibility; close #1513 2013-11-29 08:47:28 +09:00
Yukihiro "Matz" Matsumoto 92825660ea changed argument type of mrb_ary_modify(); ref #1554 2013-11-01 09:57:20 +09:00
Yukihiro "Matz" Matsumoto af03812877 add mrb_ary_modify(mrb,a); you have to ensure mrb_value a to be an array; ref #1554 2013-10-31 23:34:08 +09:00
Yukihiro "Matz" Matsumoto 2daf39ddc8 change else formatting 2013-07-22 09:52:06 +09:00
Carson McDonald b9a32e434a Changed use of MRB_INT_MAX to MRB_INT_MAX-1 2013-07-18 09:47:48 -04:00
Jun Hiroe 72892cb14a Refactor mrb_ary_eql() func in array.c. 2013-07-01 23:53:48 +09:00