Yukihiro "Matz" Matsumoto
56322cd5dd
Pacify signed warning; ref #3565
2017-04-01 18:41:55 +09:00
Yukihiro "Matz" Matsumoto
39ca4ef3bc
Avoid crash if hv.n is greater than kh_size(h); fix #3565
...
The resulting behavior is different from CRuby, but modifying
hash key afterwards is undefined behavior in ISO spec.
2017-03-31 13:02:01 +09:00
Clayton Smith
a6e25f73a0
Renumber hash keys during dup since there may be duplicates.
2017-03-28 16:31:19 -04:00
Yukihiro "Matz" Matsumoto
04296925ac
Use mrb_funcall_argv() instead of mrb_funcall()
2017-02-15 09:24:35 +09:00
Yukihiro "Matz" Matsumoto
30aa521854
Do not use mrb_funcall() if Hash#default is not overridden; ref #3421
...
This change reduces the recursion level, but does not solve the stack
overflow issue entirely.
2017-02-14 00:22:12 +09:00
Yukihiro "Matz" Matsumoto
2e0c2b5807
Add mrb_hash_modify() to Hash#{delete,clear}; ref #3370
...
This issue was reported by https://hackerone.com/an0n-j
2017-01-05 16:46:08 +09:00
Yukihiro "Matz" Matsumoto
92c843dd07
rename prefix RBASIC_ to MRB_; ref #3340
2016-12-12 00:54:36 +09:00
Takashi Kokubun
10bb7ad693
Implement Object#freeze
2016-12-11 03:44:15 +09:00
Shugo Maeda
338e0ff52d
Copy default_proc by Hash#dup.
2016-12-07 22:39:20 +09:00
Yukihiro "Matz" Matsumoto
cb5c9d3415
always call Hash#default if no key found; fix #3272
2016-11-24 18:09:04 +09:00
Yukihiro "Matz" Matsumoto
88604e39ac
Hash#[] to call Hash#default
2016-11-12 05:23:05 +09:00
William Light
e02a88e031
make mrb_hash_values() a public API function
2016-08-01 11:05:46 +02:00
Yukihiro "Matz" Matsumoto
3c73c315f4
Hash: check flags before accessing ifnone; ref #980
2016-02-05 10:08:28 +09:00
Yukihiro "Matz" Matsumoto
725b3ca5a7
move KHASH_DECLARE(ht..) to mruby/hash.h; close #3073
2016-01-07 12:46:38 +09:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
Seba Gamboa
13b552538a
Remove obvious warnings from docs
2015-10-20 12:48:31 -03:00
Seba Gamboa
e871b77f41
Increasing docs coverage
2015-10-20 12:16:46 -03:00
Kazuho Oku
8256d77c7f
avoid unnecessary string duplications by checking the frozen flag
2015-09-10 22:50:01 +09:00
Kazuho Oku
44eb1492be
freeze the hash key ( fixes #2945 )
2015-09-10 22:24:10 +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
Tatsuhiko Kubo
3202938099
Add a missing space after ",".
2014-08-27 19:13:40 +09:00
kkkkkt
a9b37bff4b
refactor mrb_hash_shift, num_pow, flo_eq, flo_finite_p method
2014-08-13 18:26:58 +09:00
Yukihiro "Matz" Matsumoto
206f89e209
add MRB_API modifiers to mruby API functions
2014-08-04 00:47:08 +09:00
take_cheeze
77aefa1d03
Always return non-NULL in mrb_hash_tbl.
2014-07-03 22:56:15 +09:00
Yukihiro "Matz" Matsumoto
2ed7089546
need to call write barrier on hash keys; ref #2375
2014-06-13 00:41:49 +09:00
Yukihiro "Matz" Matsumoto
4a6650b191
Merge pull request #2287 from yui-knk/add-space
...
Add a space aftre bracket.
2014-05-18 21:09:04 +09:00
yui-knk
45305686fe
Add a space aftre bracket.
2014-05-18 19:40:17 +09:00
Jun Hiroe
d330e5b102
Fix indent in mrb_hash_to_hash()
2014-05-18 15:33:41 +09:00
Yukihiro "Matz" Matsumoto
91cc8949e8
use mrb_field_write_barrier_value() in hash.c
2014-05-08 11:09:08 +09:00
Yukihiro "Matz" Matsumoto
5138f62d6b
resolve conflict
2014-04-15 10:55:46 +09:00
Yukihiro "Matz" Matsumoto
8d95e5a0de
use kh_put2 in mrb_hash_set for performance improvement
2014-04-13 18:26:13 +09:00
Yukihiro "Matz" Matsumoto
63cf7073de
improve hash function based on #2027 ; close #2027
2014-04-09 11:49:26 +09:00
Yukihiro "Matz" Matsumoto
59cd24d41f
Hash#replace should copy default as well; close #2004
2014-04-04 12:14:23 +09:00
Yukihiro "Matz" Matsumoto
b9a4d64064
implement Hash#initialize in C
2014-04-04 11:03:26 +09:00
Yukihiro "Matz" Matsumoto
28ab106292
Hash#replace to preserve order; close #2001
2014-04-04 10:50:42 +09:00
ksss
8d15ef2e89
Use bool macro KHASH_DEFINE and KHASH_DECLARE
2014-04-02 13:38:43 +00:00
Yukihiro "Matz" Matsumoto
164dcd8b33
Hash#keys to update memory region directly
2014-04-01 15:19:53 +09:00
Yukihiro "Matz" Matsumoto
312e11da39
should adjust hash value order at deletion
2014-04-01 15:19:11 +09:00
Yukihiro "Matz" Matsumoto
1690fc4c99
implement Hash#== and eql? in Ruby
2014-04-01 14:56:23 +09:00
Yukihiro "Matz" Matsumoto
8b141b07b6
function expansion in hash.c
2014-04-01 14:37:10 +09:00
Yukihiro "Matz" Matsumoto
cf58d0d3e9
move Hash#inspect implementation to mrblib/hash.rb
2014-04-01 14:21:40 +09:00
Yukihiro "Matz" Matsumoto
f05069fd1a
Hash to preserve order as Ruby1.9 does
2014-04-01 14:18:21 +09:00
Yukihiro "Matz" Matsumoto
4c2969910f
Hash function to avoid funcalls if possible
2014-03-31 13:44:35 +09:00
Yukihiro "Matz" Matsumoto
62505d51cc
calc hash value directly for strings, symbols and numbers
2014-03-15 15:53:12 +09:00
take_cheeze
7c4961234d
fix mrb_funcall calling
2014-03-12 10:18:38 +09:00
cremno
bfc522bcd5
use mrb_str_cat_lit for literals
2014-03-08 18:38:31 +01:00
ksss
d7b179475b
fix #1823
2014-03-08 17:51:21 +09:00
Yukihiro "Matz" Matsumoto
fe1b4cea41
Hash#== and eql? should not return fixnum; ref #1823
2014-03-07 18:40:10 +09:00
ksss
cab1f734ef
Fix behavior Hash#eql?
2014-03-07 11:08:24 +09:00
cubicdaiya
bd0244d067
use mrb_str_cat_lit() intead of mrb_str_cat
2014-02-27 22:42:25 +09:00