aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
Commit message (Collapse)AuthorAgeFilesLines
...
* * hash.c (rb_hash_keys): make rb_hash_keys() static.glass2014-01-011-1/+1
| | | | | | | | | | it is no longer used from array.c since r43969. the patch is from normalperson (Eric Wong). [ruby-core:59449] [Feature #9336] * internal.h: remove definition of rb_hash_keys(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: remove dead codenobu2013-12-261-26/+1
| | | | | | | * hash.c (rb_hash_reject): remove dead code for the deprecated behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: no extra states copynobu2013-12-261-1/+1
| | | | | | | * hash.c (HASH_REJECT_COPY_EXTRA_STATES): turn off the old behavior, copying extra states by accident. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: extra statesnobu2013-12-241-1/+1
| | | | | | | * hash.c (rb_hash_reject): use words "extra states". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: fix infinite loopnobu2013-12-231-0/+1
| | | | | | | * hash.c (has_extra_methods): traverse ancestors, and fix infinite loop. [Bug #9275] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: fix commit missnobu2013-12-231-3/+3
| | | | | | | * hash.c (HAS_EXTRA_STATES): remove extra parenthesis. [Bug #9275] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: reduce warningnobu2013-12-231-2/+13
| | | | | | | * hash.c (HAS_EXTRA_STATES): warn extra states only when something differ. [ruby-core:59254] [Bug #9275] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: rewordnobu2013-12-231-10/+9
| | | | | | | * hash.c (HAS_EXTRA_STATES, rb_hash_reject): use words "extra states". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN intoko12013-12-201-3/+3
| | | | | | | | | | | | RB_OBJ_WRITE and RB_OBJ_WRITTEN. * array.c, class.c, compile.c, hash.c, internal.h, iseq.c, proc.c, process.c, re.c, string.c, variable.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: revertnobu2013-12-171-1/+1
| | | | | | | | * hash.c (rb_hash_reject): revert to deprecated behavior, with warnings, due to compatibility for HashWithDifferentAccess. [ruby-core:59154] [Bug #9223] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: add warningsnobu2013-12-171-12/+31
| | | | | | * hash.c (rb_hash_reject): warn attributes in detail more. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: typonobu2013-12-161-1/+1
| | | | | | * hash.c (rb_hash_reject): fix typo in macro name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: warnings in rb_hash_rejectnobu2013-12-161-4/+30
| | | | | | | | * hash.c (rb_hash_dup_empty): split from rb_hash_dup. * hash.c (rb_hash_reject): add warnings (currently suppressed). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: refactor loopnobu2013-12-161-9/+3
| | | | | | * hash.c (rb_hash): rewrite with while instead of goto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: reject should return a plain hashnobu2013-12-111-15/+20
| | | | | | | | | * hash.c (rb_hash_reject): return a plain hash, without copying the class, default value, instance variables, and taintedness. they had been copied just by accident. [ruby-core:59045] [Bug #9223] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c, hash.c: add saltnobu2013-12-101-5/+9
| | | | | | | | * array.c (rb_ary_hash): add salt to differentiate false and empty array. [ruby-core:58993] [Bug #9231] * hash.c (rb_any_hash, rb_hash_hash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: fix segv in Hash#replacetmm12013-12-091-1/+1
| | | | | | | | * hash.c (rb_hash_replace): fix segv on `{}.replace({})` introduced in r44060 [Bug #9230] [ruby-core:58991] * test/ruby/test_hash.rb: regression test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: reject shoult infectnobu2013-12-081-0/+1
| | | | | | | * hash.c (rb_hash_reject): result should be infected by the receiver. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: fix WB miss issue in Hash#replacetmm12013-12-081-16/+3
| | | | | | | * hash.c (rb_hash_replace): add a write barrier to fix GC mark miss on hashes using Hash#replace [Bug #9226] [ruby-core:58948] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: revert r43870 and add alternative parser patch for literal keystmm12013-12-081-3/+1
| | | | | | | | | * hash.c (hash_aset_str): revert r43870 due to performance issue [Bug #9188] [ruby-core:58730] * parse.y (assoc): convert literal string hash keys to fstrings * test/ruby/test_hash.rb (class TestHash): expand test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: rb_hash_reject without dupnobu2013-12-071-1/+17
| | | | | | | | * hash.c (rb_hash_reject): copy unrejected elements only to new hash, so that the change on the original receiver can affect. [ruby-core:58914] [Bug #9223] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: bail out to the outermost framenobu2013-12-051-71/+3
| | | | | | | * hash.c (rb_hash): revert r43981 and bail out to the outermost frame when recursion is detected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: same hash value for similar constructsnobu2013-12-031-2/+67
| | | | | | | | | * hash.c (rb_hash_recursive): make similar (recursive) constructs return same hash value. execute recursively, and rewind to the topmost frame with an object which .eql? to the recursive object, if recursion is detected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: detect recursion for allnobu2013-12-031-17/+11
| | | | | | | * hash.c (rb_hash): detect recursion for all `hash' methods. each `hash' methods no longer need to use rb_exec_recursive(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_hash_rehash): use hash_alloc() instead of rb_hash_new().glass2013-12-031-1/+1
| | | | | | [Bug #9187] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (w32_getenv): should be static.nobu2013-12-031-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (getenv): fixed test failures introduced by r43950.usa2013-12-021-1/+2
| | | | | | | [ruby-core:58774] [Bug #9195] reported by phasis68 (Heesob Park). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_rehash): make temporary st_table under the controlglass2013-12-021-27/+12
| | | | | | | | of GC. [Bug #9187] * test/ruby/test_hash.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (getenv): use ANSI codepage version of getenv() for minirubyusa2013-12-011-1/+11
| | | | | | | | on Windows. [ruby-core:58732] [Bug #9189] reported by phasis68 (Heesob Park). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_to_a): specify array capa.glass2013-12-011-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_rehash): fix to free new st_table when exceptionglass2013-12-011-7/+32
| | | | | | is raised in do_hash(). [Bug #9187] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c: add st_values() and st_values_check().glass2013-11-281-4/+18
| | | | | | | | | * include/ruby/st.h: add prototypes for above. * hash.c (rb_hash_values): use st_values_check() for performance improvement if VALUE and st_data_t are compatible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c (st_keys): fix not to use Qundef in st.c.glass2013-11-281-1/+1
| | | | | | | | * include/ruby/st.h: define modified prototype. * hash.c (rb_hash_keys): use modified st_keys(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c (st_keys): fix to use st_index_t for size of hash.glass2013-11-271-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c (st_keys): define st_keys(). it writes each key to buffer.glass2013-11-271-4/+18
| | | | | | | | | | | | | * hash.c (rb_hash_keys): use st_keys() for performance improvement if st_data_t and VALUE are compatible. * st.h: define macro ST_DATA_COMPATIBLE_P() to predicate whether st_data_t and passed type are compatible. * configure.in: check existence of builtin function to use in ST_DATA_COMPATIBLE_P(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c (gc_page_sweep): Fix compile warning from last commit.tmm12013-11-271-1/+1
| | | | | | | * hash.c (hash_aset_str): Re-use existing variable to avoid unnecessary pointer dereferencing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (hash_aset_str): Use rb_fstring() to de-duplicate hash stringtmm12013-11-271-1/+3
| | | | | | | keys. Patch by Eric Wong. [Bug #8998] [ruby-core:57727] * test/ruby/test_hash.rb (class TestHash): test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* should not ignore the rest of recursive constructsnobu2013-11-261-1/+1
| | | | | | | | | | | | | * array.c (rb_ary_hash): should not ignore the rest of recursive constructs. * hash.c (rb_hash_hash): ditto. * range.c (range_hash): ditto. * struct.c (rb_struct_hash): ditto. * test/-ext-/test_recursion.rb (TestRecursion): separate from test/ruby/test_thread.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: cut off if recursionnobu2013-11-261-1/+8
| | | | | | | * hash.c (rb_hash): cut off if recursion detected to get rid of stack overflow. [ruby-core:58567] [Bug #9151] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: static internal functionsnobu2013-11-171-7/+7
| | | | | | | | * hash.c (NOINSERT_UPDATE_CALLBACK): make both of noinsert and insert internal functions static. and put semicolons for etags to find the following functions properly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c : Introdule ensure rollback mechanism. Please see below.tarui2013-11-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * internal.h (ruby_register_rollback_func_for_ensure): catch up above change. Add rollback mechanism API. * vm_core.h (typedef struct rb_vm_struct): catch up above change. Introdule ensure-rollback relation table. * vm_core.h (typedef struct rb_thread_struct): catch up above change. Introdule ensure stack. * eval.c (rb_ensure): catch up above change. Introdule ensure stack. * hash.c : New function for rollback ensure, and register it to ensure-rollback relation table. [ruby-dev:47803] [Bug #9105] Ensure Rollback Mechanism: A rollback's function is a function to rollback a state before ensure's function execution. When the jump of callcc is across the scope of rb_ensure, ensure's functions and rollback's functions are executed appropriately for keeping consistency. Current API is unstable, and only internal use. ruby_register_rollback_func_for_ensure(ensure_func,rollback_func) This API create relation ensure's function to rollback's function. By registered rollback's function, it is executed When jumpping into corresponding rb_ensure scope. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert r43675 and r43683 without tests for applying rollback patch.tarui2013-11-151-15/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: iteration level with reenteringnobu2013-11-151-3/+11
| | | | | | | | | * hash.c (hash_foreach_iter, hash_foreach_ensure, rb_hash_foreach): deal with iteration level when reentering by callcc. temporary measure until rollback of ensure is introduced. [ruby-dev:47807] [Bug #9105] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: restore iter_levnobu2013-11-141-4/+8
| | | | | | | * hash.c (hash_foreach_ensure): restore iter_lev to the previous value, not just decrement. [ruby-dev:47803] [Bug #9105] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c, st.c: fix for ST_CHECKnobu2013-11-141-2/+5
| | | | | | | | * hash.c (foreach_safe_i, hash_foreach_iter): deal with error detected by ST_CHECK. * st.c (st_foreach_check): call with non-error argument in normal case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c: [DOC] Adds an example for Hash#storezzak2013-11-131-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: move common string/hash flags to include file.tmm12013-11-111-3/+0
| | | | | | | | * ext/objspace/objspace_dump.c: remove flags shared above. * hash.c: ditto. * string.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* st.c: revert st_keysnobu2013-10-101-3/+12
| | | | | | * st.c: revert st_keys() at r43238. VALUE cannot be in st.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * st.c (st_keys): define st_keys() for performance improvement ofglass2013-10-101-12/+3
| | | | | | | | | | Hash#keys and Array#uniq. * st.h: ditto. * hash.c (rb_hash_keys): use st_keys(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: use rb_hash_valuesnobu2013-10-081-1/+1
| | | | | | | | * array.c (rb_ary_uniq): use rb_hash_values(), as well as the case no block is given. * internal.h: define rb_hash_values() as internal API. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e