Yukihiro "Matz" Matsumoto
9b2454c94d
Leave hash->ht to be NULL if initial capacity is zero.
2017-11-19 03:46:58 +09:00
YAMAMOTO Masaya
acdc2d1f24
Add MRB_WITHOUT_FLOAT
2017-10-11 17:58:11 +09:00
Tomasz Dąbrowski
7d98055862
fix: src\hash.c(139): warning C4244: 'function': conversion from 'mrb_int' to 'khint_t', possible loss of data
2017-09-27 22:22:05 +02:00
Tomasz Dąbrowski
8cef3f946c
fix: src\hash.c(40): warning C4244: '=': conversion from 'mrb_int' to 'khint_t', possible loss of data
2017-09-27 22:22:05 +02:00
Yukihiro "Matz" Matsumoto
3d288ef0d8
Use standard hash functions in mrb_hash_ht_hash_func.
2017-08-10 08:47:01 +09:00
Christopher Aue
ec7475d88b
Prevented resizing just created hashes in specific size ranges
2017-08-05 20:59:26 +02:00
Christopher Aue
0e5c3c4ebd
Improved speed of creating new hash tables
2017-08-04 22:08:29 +02:00
Yukihiro "Matz" Matsumoto
f26d00d9e8
Embed small size array elements in the heap.
...
It reduces the memory consumption and sometimes improve the
performance as well. For example, the consumed memory size
of `bench/bm_ao_render.rb` is reduced from 1.2GB to 1GB, and
its total execution time become 18.795 sec from 22.229 sec.
2017-07-27 16:13:06 +09:00
Yukihiro "Matz" Matsumoto
667e788159
Use mrb_int instead of int as argument to mrb_hash_new_capa.
2017-06-19 09:21:07 +09:00
Yukihiro "Matz" Matsumoto
c3961847cf
Hash#dup didn't check if internal khash is initialized; fix #3609
2017-04-18 09:55:32 +09:00
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