Граф коммитов

594 Коммитов

Автор SHA1 Сообщение Дата
nobu 13f5dcb9f2 error.c: KeyError#receiver and KeyError#key
* error.c: new method KeyError#receiver and KeyError#key.
  [Feature #12063]

* hash.c: make KeyError object with receiver and key.

* sprintf.c: ditto.

Author:    ksss <co000ri@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-18 08:05:53 +00:00
shyouhei 0eb7359cc7 add rb_hash_new_with_size()
Sometimes, size of a hash can be calcluated a priori.  By providing
such info to the constructor we can avoid unnecessary internal re-
allocations.  This can boost for instance creation of hash literals.
[Bug #13861]

Signed-off-by: Urabe, Shyouhei <shyouhei@ruby-lang.org>


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-05 04:48:19 +00:00
nobu 0118b98545 Update Hash#compact! documentation [ci skip]
* hash.c (rb_hash_compact_bang): [DOC] update the case if no
  changes were made.  [ruby-core:82591] [Bug #13855] [Fix GH-1692]

Author:    Lucas Buchala <lucasbuchala@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-02 01:08:27 +00:00
kazu 14638d8547 [DOC] Fix typo in rdoc of `transform_values!` [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-28 11:20:08 +00:00
nobu f9d5843fd9 hash.c: refactor env_enc_str_new
* hash.c (env_enc_str_new): convert to the expected encoding
  without intermediate string, and set econv flags if default
  internal encoding is set too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-30 02:56:30 +00:00
normal 0493b1ce3a revert r59359, r59356, r59355, r59354
These caused numerous CI failures I haven't been able to
reproduce [ruby-core:82102]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-19 01:35:04 +00:00
normal d04c085b3c hash: keep fstrings of tainted strings for string keys
The same hash keys may be loaded from tainted data sources
frequently (e.g. parsing headers from socket or loading
YAML data from a file).  If a non-tainted fstring already
exists (because the application expects the hash key),
cache and deduplicate the tainted version in the new
tainted_frozen_strings table.

For non-embedded strings, this also allows sharing with the
underlying malloc-ed data.

* vm_core.h (rb_vm_struct): add tainted_frozen_strings
* vm.c (ruby_vm_destruct): free tainted_frozen_strings
  (Init_vm_objects): initialize tainted_frozen_strings
  (rb_vm_tfstring_table): accessor for tainted_frozen_strings
* internal.h: declare rb_fstring_existing, rb_vm_tfstring_table
* hash.c (fstring_existing_str): remove (moved to string.c)
  (hash_aset_str): use rb_fstring_existing
* string.c (rb_fstring_existing): new, based on fstring_existing_str
  (tainted_fstr_update): new
  (rb_fstring_existing0): new, based on fstring_existing_str
  (rb_tainted_fstring_existing): new, special case for tainted strings
  (rb_str_free): delete from tainted_frozen_strings table
* test/ruby/test_optimization.rb (test_hash_reuse_fstring): new test
  [ruby-core:82012] [Bug #13737]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-18 02:29:59 +00:00
rhe 677751e1bc hash.c: fix possible crash in Hash#transform_keys!
Fix up r59328. It is possible that the given block abuses
ObjectSpace.each_object to shrink the temporary array.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 09:41:05 +00:00
mrkn 1405111722 hash.c: Add Hash#transform_keys and Hash#transform_keys!
* hash.c (transform_keys_i, rb_hash_transform_keys): Add Hash#transform_keys.
  [Feature #13583] [ruby-core:81290]

* hash.c (rb_hash_transform_keys_bang): Add Hash#transform_keys!.
  [Feature #13583] [ruby-core:81290]

* test/ruby/test_hash.rb: Add tests for above changes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 06:44:00 +00:00
ko1 5168fb54e3 tainted string should be tainted.
* hash.c (hash_aset_str): create frozen string for tainted objects.
  (should not use fsting table on this case).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-11 07:42:27 +00:00
nobu f1fe99b1be hash.c: prefer value cast to pointer cast
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-10 00:41:21 +00:00
normal e205304a3e Hash#[]= deduplicates string keys if (and only if) fstring exists
In typical applications, hash entries are read after being
written to.  Blindly writing to hashes which are never read
makes little sense. So, for any hash which is read from, an
fstring entry for the key should already exist for the key.

We no longer blindly create fstrings if the code is blindly
setting random hash keys, preventing the performance regression
in the reverted r43870.

Regarding <https://bugs.ruby-lang.org/issues/9188>, this has a
minimum impact on the bm_so_k_nucleotide where hash keys are set
and not reused, performance is within 1-2% of existing cases.

* hash.c: #include gc.h for rb_objspace_garbage_object_p
  (hash_aset_str): do read-only check of fstring table and
  reuse fstring if it exists and is still alive (not garbage)
  [ruby-core:81942] [Feature #13725]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-09 23:04:43 +00:00
watson1978 d0015e4ac6 Improve performance of implicit type conversion
To convert the object implicitly, it has had two parts in convert_type() which are
  1. lookink up the method's id
  2. calling the method

Seems that strncmp() and strcmp() in convert_type() are slightly heavy to look up
the method's id for type conversion.

This patch will add and use internal APIs (rb_convert_type_with_id, rb_check_convert_type_with_id)
to call the method without looking up the method's id when convert the object.

Array#flatten -> 19 % up
Array#+       ->  3 % up

[ruby-dev:50024] [Bug #13341] [Fix GH-1537]

### Before
       Array#flatten    104.119k (± 1.1%) i/s -    525.690k in   5.049517s
             Array#+      1.993M (± 1.8%) i/s -     10.010M in   5.024258s

### After
       Array#flatten    124.005k (± 1.0%) i/s -    624.240k in   5.034477s
             Array#+      2.058M (± 4.8%) i/s -     10.302M in   5.019328s

### Test Code
require 'benchmark/ips'

class Foo
  def to_ary
    [1,2,3]
  end
end

Benchmark.ips do |x|

  ary = []
  100.times { |i| ary << i }
  array = [ary]

  x.report "Array#flatten" do |i|
    i.times { array.flatten }
  end

  x.report "Array#+" do |i|
    obj = Foo.new
    i.times { array + obj }
  end

end

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-31 12:30:57 +00:00
stomar a2b4979bbb hash.c: docs for Hash#transform_values
* hash.c: [DOC] fix return value in call-seq of Hash#transform_values;
  other small fixes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25 15:14:38 +00:00
rhe 5565fed887 hash.c: [DOC] fix docs for Hash#transform_values!
Hash#transform_values! returns the receiver rather than a new Hash
object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22 07:13:06 +00:00
kazu b4c2008817 Add missing word in transform_values methods description
Explicitly says that the methods return a new hash rather than just
stating it return a new something we don't know.

[ci skip]
[Fix GH-1619]
Author:    Nicolas Cavigneaux <nico@bounga.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21 07:13:11 +00:00
watson1978 9cd66d7022 Improve Hash#merge performance
* hash.c (rb_hash_merge): use rb_hash_dup() instead of rb_obj_dup() to duplicate
    Hash object. rb_hash_dup() is faster duplicating function for Hash object
    which got rid of Hash#initialize_dup method calling.

    Hash#merge will be faster around 60%.
    [ruby-dev:50026] [Bug #13343] [Fix GH-1533]

### Before
                 user     system      total        real
Hash#merge   0.160000   0.020000   0.180000 (  0.182357)

### After
                 user     system      total        real
Hash#merge   0.110000   0.010000   0.120000 (  0.114404)

### Test code
require 'benchmark'

Benchmark.bmbm do |x|
  hash1 = {}
  100.times { |i| hash1[i.to_s] = i }
  hash2 = {}
  100.times { |i| hash2[(i*2).to_s] = i*2 }

  x.report "Hash#merge" do
    10000.times do
      hash1.merge(hash2)
    end
  end
end

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 09:23:46 +00:00
usa f4b9134842 Encoding.default_internal should affect ENV on Windows like other platforms
* hash.c (env_str_transcode): call rb_external_str_with_enc() if
  default_internal is available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-12 11:49:05 +00:00
shyouhei 29ca20de2d refactor newhash (revision 58463 another try) [fix GH-1600]
* st.c (rb_hash_bulk_insert): new API to bulk insert entries
	  into a hash. Given arguments are first inserted into the
	  table at once, then reindexed. This is faster than inserting
	  things using rb_hash_aset() one by one.

	  This arrangement (rb_ prefixed function placed in st.c) is
	  unavoidable because it both touches table internal and write
	  barrier at once.

	* internal.h: delcare the new function.

	* hash.c (rb_hash_s_create): use the new function.

	* vm.c (core_hash_merge): ditto.

	* insns.def (newhash): ditto.

	* test/ruby/test_hash.rb: more coverage on hash creation.

	* test/ruby/test_literal.rb: ditto.

-----------------------------------------------------------
benchmark results:
minimum results in each 7 measurements.
Execution time (sec)
name    before  after
loop_whileloop2  0.136  0.137
vm2_bighash*     1.249  0.623

Speedup ratio: compare with the result of `before' (greater is better)
name    after
loop_whileloop2 0.996
vm2_bighash*    2.004



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-27 04:21:04 +00:00
shyouhei a15fd1d9f2 revert newhash refactoring
We need to fix GC bug before merging this.  Revert revisions
58452, 58435, 58434, 58428, 58427 in this order.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-24 01:40:51 +00:00
ko1 a6f0ec21e9 mark Hash keys correctly.
* hash.c (rb_hash_new_from_object): same as r58434.
  Newly created frozen objects are not referred from any roots/objects.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-23 00:20:27 +00:00
nobu 0749e7be45 adjust indent
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-22 08:19:33 +00:00
ko1 5f5bc068ed insert WB correctly.
* hash.c (hash_insert_raw): should insert WB.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 15:00:30 +00:00
ko1 a7db632088 mark created frozen strings.
* hash.c (rb_hash_new_from_values_with_klass): before this fix,
  only a st table are filled with passed values. However, newly
  created frozen strings are not marked correctly only reference
  from st table. This patch marks such created frozen strings
  by Hash object which refers to the st table.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 11:02:10 +00:00
shyouhei 0c082fe658 typo fix (sorry!)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 04:42:09 +00:00
shyouhei 4ee09d914d refactor hash literal
Same as rb_ary_tmp_new_from_values(), it reduces vm_exec_core binary
size from 26,176 bytes to 26,080 bytes.  But this time, also with a
bit of optimizations:

  - Because we are allocating a new hash and no back references are
    introduced at all, we can safely skip write barriers.

  - Also, the iteration never recurs.  We can avoid complicated
    function callbacks by using st_insert instead of st_update.

----

	* hash.c (rb_hash_new_from_values): refactor
          extract the bulk insert into a function.

	* hash.c (rb_hash_new_from_object): also refactor.

	* hash.c (rb_hash_s_create): use the new functions.

	* insns.def (newhash): ditto.

	* vm.c (core_hash_from_ary): ditto.

	* iternal.h: export the new function.

-----------------------------------------------------------
benchmark results:
minimum results in each 7 measurements.
Execution time (sec)
name    before  after
loop_whileloop2  0.135  0.134
vm2_bighash*     1.236  0.687

Speedup ratio: compare with the result of `before' (greater is better)
name    after
loop_whileloop2 1.008
vm2_bighash*    1.798


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-21 04:21:14 +00:00
stomar 8b71e2532d hash.c: [DOC] fix book title in example
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-01 19:57:14 +00:00
stomar 6b82ba9e26 Fix doc for Hash#dig and Struct#dig
* hash.c (rb_hash_dig): [DOC] correct argument name
  in method description; fix formatting in examples.
* struct.c (rb_struct_dig): ditto.

[ruby-core:79221] [Bug #13148]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-27 18:07:11 +00:00
nobu 556a1352e4 backward.h: 2.2 deprecated features
* include/ruby/backward.h (DECLARE_DEPRECATED_FEATURE): move
  features deprecated at 2.2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-21 05:17:41 +00:00
kazu 9985b75940 Hash#fetch: fix grammar in documentation.
[Fix GH-1515][ci skip]
Author:    Alyssa Ross <hi+services.github@alyssa.is>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-22 03:06:17 +00:00
nobu c59e739b02 ENV#fetch: fix documentation of raised exception
[Fix GH-1514]
Author:    Misty De Meo <mistydemeo@github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-19 06:39:44 +00:00
eregon ac9f8145f1 fix optimization for hash aset/aref with fstring
Patch by Eric Wong [ruby-core:78797].
I don't like the idea of making insns.def any bigger to support
a corner case, and "test_hash_aref_fstring_identity" shows
how contrived this is.

[ruby-core:78783] [Bug #12855]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-07 11:31:53 +00:00
nobu 9a464db8a8 hash.c: split long long literals
* hash.c (prime1, prime2): split long long literals for platforms
  where LL suffix is not supported, e.g., VC6.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-24 13:21:30 +00:00
naruse 5ec23b5222 Updated documentation examples for Hash#value?
The same code is used for has_value? and value?, but according to
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/43765
has_value is deprecated. Use the non-deprecated syntax in the examples.
by Herwin Weststrate <herwin@snt.utwente.nl>
fix https://github.com/ruby/ruby/pull/1491

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10 18:34:07 +00:00
nobu f2b6e9f05f hash.c: hash should be long
* hash.c (any_hash): should return `long', because ruby assumes
  the hash value of the object id of an object is `long'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-07 04:25:50 +00:00
nobu 5714a26b90 switching hash removal
* st.h (struct st_hash_type): Remove strong_hash.
  (struct st_table): Remove inside_rebuild_p and curr_hash.
* st.c (do_hash): Use type->hash instead of curr_hash.
  (make_tab_empty): Remove setting up curr_hash.
  (st_init_table_with_size): Remove setting up inside_rebuild_p.
  (rebuild_table): Remove clearing inside_rebuild_p.
  (reset_entry_hashes, HIT_THRESHOULD_FOR_STRONG_HASH): Remove code
  recognizing a denial attack and switching to strong hash.
* hash.c (rb_dbl_long_hash, rb_objid_hash, rb_ident_hash): Use
  rb_hash_start to randomize the hash.
  (str_seed): Remove.
  (any_hash): Remove strong_p and use always rb_str_hash for
  strings.
  (any_hash_weak, rb_any_hash_weak): Remove.
  (st_hash_type objhash): Remove rb_any_hash_weak.

based on the patch by Vladimir N Makarov <vmakarov@redhat.com> at
[ruby-core:78490].  [Bug #13002]

* test/ruby/test_hash.rb (test_wrapper): objects other than special
  constants should be able to be wrapped.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-06 04:43:48 +00:00
nobu 1e95f9da88 remove unnecessary variable
* st.c (do_hash): remove unnecessary variable and cast.

* hash.c, numeric.c, st.c: adjust style and indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-06 03:36:52 +00:00
kazu 9fa8006a01 Cleanup ruby method definitions in hash.c
Always add a space between a comma and the next element. These spaces
were there sometimes, but not always. This keeps to code consistent.

Patch by: Herwin Weststrate <herwin@snt.utwente.nl>

[ruby-core:78297] [Misc #12977] [GH-1492]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-03 11:18:44 +00:00
nobu ba8006533c add cast
* hash.c (rb_objid_hash): need to cast down.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-07 03:28:57 +00:00
ko1 75775157ea Introduce table improvement by Vladimir Makarov <vmakarov@redhat.com>.
[Feature #12142]
	See header of st.c for improvment details.

	You can see all of code history here:
	<https://github.com/vnmakarov/ruby/tree/hash_tables_with_open_addressing>

	This improvement is discussed at
	<https://bugs.ruby-lang.org/issues/12142>
	with many people, especially with Yura Sokolov.

	* st.c: improve st_table.

	* include/ruby/st.h: ditto.

	* internal.h, numeric.c, hash.c (rb_dbl_long_hash): extract a function.

	* ext/-test-/st/foreach/foreach.c: catch up this change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-07 00:45:00 +00:00
nobu 4e44f6ef86 [DOC] replace Fixnum with Integer [ci skip]
* numeric.c: [DOC] update document for Integer class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-26 06:11:23 +00:00
nobu 4154b96068 hash.c: fix Hash#compact! return value
* hash.c (rb_hash_compact_bang): should return nil if no elements
  is deleted.  [ruby-core:77709] [Bug #12863]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-22 09:52:35 +00:00
nobu bbd58fa2b9 hash.c: add compact and compact! methods
* hash.c (rb_hash_compact, rb_hash_compact_bang): Removes nil
  values from the original hash, to port Active Support behavior.
  [Feature #11818]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-13 08:06:00 +00:00
usa c2dd2d268e * internal.h (ST2FIX): new macro to convert st_index_t to Fixnum.
a hash value of Object might be Bignum, but it causes many troubles
  expecially the Object is used as a key of a hash.  so I've gave up
  to do so.

* array.c (rb_ary_hash): use above macro.

* bignum.c (rb_big_hash): ditto.

* hash.c (rb_obj_hash, rb_hash_hash): ditto.

* numeric.c (rb_dbl_hash): ditto.

* proc.c (proc_hash): ditto.

* re.c (rb_reg_hash, match_hash): ditto.

* string.c (rb_str_hash_m): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-04 16:25:01 +00:00
ngoto c1dbcf9b7e * hash.c (each_pair_i_fast): Fix compile error with old version of
fcc on Solaris 10. [Bug #12768] [ruby-dev:49808]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-16 12:20:35 +00:00
naruse d51aea54d8 * hash.c (each_pair_i_fast): use rb_yield_values2 to avoid var args.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-13 22:22:14 +00:00
akr 577de1e93d replace fixnum by integer in documents.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08 04:57:49 +00:00
mrkn eaa0a27f61 hash.c: map_v -> transform_values
* hash.c (rb_hash_transform_values, rb_hash_transform_values_bang):
  Rename map_v to transform_values.
  [Feature #12512] [ruby-core:76095]

* test/ruby/test_hash.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08 02:33:18 +00:00
nobu b22b725c5d util.h: POSIX-noncompliant setenv
* include/ruby/util.h (setenv): remove POSIX-noncompliant
  definition with 2 arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 08:50:39 +00:00
mrkn ea5184b939 hash.c: implement Hash#map_v and Hash#map_v!
* hash.c (rb_hash_map_v, rb_hash_map_v_bang): impelement Hash#map_v and
  Hash#map_v! [Feature #12512] [ruby-core:76095]

* test/ruby/test_hash.rb: add tests for above change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-09 08:54:15 +00:00