[前][次][番号順一覧][スレッド一覧]

ruby-changes:44898

From: kazu <ko1@a...>
Date: Sat, 3 Dec 2016 20:18:48 +0900 (JST)
Subject: [ruby-changes:44898] kazu:r56971 (trunk): Cleanup ruby method definitions in hash.c

kazu	2016-12-03 20:18:44 +0900 (Sat, 03 Dec 2016)

  New Revision: 56971

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56971

  Log:
    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@s...>
    
    [ruby-core:78297] [Misc #12977] [GH-1492]

  Modified files:
    trunk/hash.c
Index: hash.c
===================================================================
--- hash.c	(revision 56970)
+++ hash.c	(revision 56971)
@@ -4479,76 +4479,76 @@ Init_Hash(void) https://github.com/ruby/ruby/blob/trunk/hash.c#L4479
     rb_define_alloc_func(rb_cHash, empty_hash_alloc);
     rb_define_singleton_method(rb_cHash, "[]", rb_hash_s_create, -1);
     rb_define_singleton_method(rb_cHash, "try_convert", rb_hash_s_try_convert, 1);
-    rb_define_method(rb_cHash,"initialize", rb_hash_initialize, -1);
-    rb_define_method(rb_cHash,"initialize_copy", rb_hash_initialize_copy, 1);
-    rb_define_method(rb_cHash,"rehash", rb_hash_rehash, 0);
-
-    rb_define_method(rb_cHash,"to_hash", rb_hash_to_hash, 0);
-    rb_define_method(rb_cHash,"to_h", rb_hash_to_h, 0);
-    rb_define_method(rb_cHash,"to_a", rb_hash_to_a, 0);
-    rb_define_method(rb_cHash,"inspect", rb_hash_inspect, 0);
+    rb_define_method(rb_cHash, "initialize", rb_hash_initialize, -1);
+    rb_define_method(rb_cHash, "initialize_copy", rb_hash_initialize_copy, 1);
+    rb_define_method(rb_cHash, "rehash", rb_hash_rehash, 0);
+
+    rb_define_method(rb_cHash, "to_hash", rb_hash_to_hash, 0);
+    rb_define_method(rb_cHash, "to_h", rb_hash_to_h, 0);
+    rb_define_method(rb_cHash, "to_a", rb_hash_to_a, 0);
+    rb_define_method(rb_cHash, "inspect", rb_hash_inspect, 0);
     rb_define_alias(rb_cHash, "to_s", "inspect");
-    rb_define_method(rb_cHash,"to_proc", rb_hash_to_proc, 0);
+    rb_define_method(rb_cHash, "to_proc", rb_hash_to_proc, 0);
 
-    rb_define_method(rb_cHash,"==", rb_hash_equal, 1);
-    rb_define_method(rb_cHash,"[]", rb_hash_aref, 1);
-    rb_define_method(rb_cHash,"hash", rb_hash_hash, 0);
-    rb_define_method(rb_cHash,"eql?", rb_hash_eql, 1);
-    rb_define_method(rb_cHash,"fetch", rb_hash_fetch_m, -1);
-    rb_define_method(rb_cHash,"[]=", rb_hash_aset, 2);
-    rb_define_method(rb_cHash,"store", rb_hash_aset, 2);
-    rb_define_method(rb_cHash,"default", rb_hash_default, -1);
-    rb_define_method(rb_cHash,"default=", rb_hash_set_default, 1);
-    rb_define_method(rb_cHash,"default_proc", rb_hash_default_proc, 0);
-    rb_define_method(rb_cHash,"default_proc=", rb_hash_set_default_proc, 1);
-    rb_define_method(rb_cHash,"key", rb_hash_key, 1);
-    rb_define_method(rb_cHash,"index", rb_hash_index, 1);
-    rb_define_method(rb_cHash,"size", rb_hash_size, 0);
-    rb_define_method(rb_cHash,"length", rb_hash_size, 0);
-    rb_define_method(rb_cHash,"empty?", rb_hash_empty_p, 0);
-
-    rb_define_method(rb_cHash,"each_value", rb_hash_each_value, 0);
-    rb_define_method(rb_cHash,"each_key", rb_hash_each_key, 0);
-    rb_define_method(rb_cHash,"each_pair", rb_hash_each_pair, 0);
-    rb_define_method(rb_cHash,"each", rb_hash_each_pair, 0);
+    rb_define_method(rb_cHash, "==", rb_hash_equal, 1);
+    rb_define_method(rb_cHash, "[]", rb_hash_aref, 1);
+    rb_define_method(rb_cHash, "hash", rb_hash_hash, 0);
+    rb_define_method(rb_cHash, "eql?", rb_hash_eql, 1);
+    rb_define_method(rb_cHash, "fetch", rb_hash_fetch_m, -1);
+    rb_define_method(rb_cHash, "[]=", rb_hash_aset, 2);
+    rb_define_method(rb_cHash, "store", rb_hash_aset, 2);
+    rb_define_method(rb_cHash, "default", rb_hash_default, -1);
+    rb_define_method(rb_cHash, "default=", rb_hash_set_default, 1);
+    rb_define_method(rb_cHash, "default_proc", rb_hash_default_proc, 0);
+    rb_define_method(rb_cHash, "default_proc=", rb_hash_set_default_proc, 1);
+    rb_define_method(rb_cHash, "key", rb_hash_key, 1);
+    rb_define_method(rb_cHash, "index", rb_hash_index, 1);
+    rb_define_method(rb_cHash, "size", rb_hash_size, 0);
+    rb_define_method(rb_cHash, "length", rb_hash_size, 0);
+    rb_define_method(rb_cHash, "empty?", rb_hash_empty_p, 0);
+
+    rb_define_method(rb_cHash, "each_value", rb_hash_each_value, 0);
+    rb_define_method(rb_cHash, "each_key", rb_hash_each_key, 0);
+    rb_define_method(rb_cHash, "each_pair", rb_hash_each_pair, 0);
+    rb_define_method(rb_cHash, "each", rb_hash_each_pair, 0);
 
     rb_define_method(rb_cHash, "transform_values", rb_hash_transform_values, 0);
     rb_define_method(rb_cHash, "transform_values!", rb_hash_transform_values_bang, 0);
 
-    rb_define_method(rb_cHash,"keys", rb_hash_keys, 0);
-    rb_define_method(rb_cHash,"values", rb_hash_values, 0);
-    rb_define_method(rb_cHash,"values_at", rb_hash_values_at, -1);
-    rb_define_method(rb_cHash,"fetch_values", rb_hash_fetch_values, -1);
-
-    rb_define_method(rb_cHash,"shift", rb_hash_shift, 0);
-    rb_define_method(rb_cHash,"delete", rb_hash_delete_m, 1);
-    rb_define_method(rb_cHash,"delete_if", rb_hash_delete_if, 0);
-    rb_define_method(rb_cHash,"keep_if", rb_hash_keep_if, 0);
-    rb_define_method(rb_cHash,"select", rb_hash_select, 0);
-    rb_define_method(rb_cHash,"select!", rb_hash_select_bang, 0);
-    rb_define_method(rb_cHash,"reject", rb_hash_reject, 0);
-    rb_define_method(rb_cHash,"reject!", rb_hash_reject_bang, 0);
-    rb_define_method(rb_cHash,"clear", rb_hash_clear, 0);
-    rb_define_method(rb_cHash,"invert", rb_hash_invert, 0);
-    rb_define_method(rb_cHash,"update", rb_hash_update, 1);
-    rb_define_method(rb_cHash,"replace", rb_hash_replace, 1);
-    rb_define_method(rb_cHash,"merge!", rb_hash_update, 1);
-    rb_define_method(rb_cHash,"merge", rb_hash_merge, 1);
+    rb_define_method(rb_cHash, "keys", rb_hash_keys, 0);
+    rb_define_method(rb_cHash, "values", rb_hash_values, 0);
+    rb_define_method(rb_cHash, "values_at", rb_hash_values_at, -1);
+    rb_define_method(rb_cHash, "fetch_values", rb_hash_fetch_values, -1);
+
+    rb_define_method(rb_cHash, "shift", rb_hash_shift, 0);
+    rb_define_method(rb_cHash, "delete", rb_hash_delete_m, 1);
+    rb_define_method(rb_cHash, "delete_if", rb_hash_delete_if, 0);
+    rb_define_method(rb_cHash, "keep_if", rb_hash_keep_if, 0);
+    rb_define_method(rb_cHash, "select", rb_hash_select, 0);
+    rb_define_method(rb_cHash, "select!", rb_hash_select_bang, 0);
+    rb_define_method(rb_cHash, "reject", rb_hash_reject, 0);
+    rb_define_method(rb_cHash, "reject!", rb_hash_reject_bang, 0);
+    rb_define_method(rb_cHash, "clear", rb_hash_clear, 0);
+    rb_define_method(rb_cHash, "invert", rb_hash_invert, 0);
+    rb_define_method(rb_cHash, "update", rb_hash_update, 1);
+    rb_define_method(rb_cHash, "replace", rb_hash_replace, 1);
+    rb_define_method(rb_cHash, "merge!", rb_hash_update, 1);
+    rb_define_method(rb_cHash, "merge", rb_hash_merge, 1);
     rb_define_method(rb_cHash, "assoc", rb_hash_assoc, 1);
     rb_define_method(rb_cHash, "rassoc", rb_hash_rassoc, 1);
     rb_define_method(rb_cHash, "flatten", rb_hash_flatten, -1);
-    rb_define_method(rb_cHash,"compact", rb_hash_compact, 0);
-    rb_define_method(rb_cHash,"compact!", rb_hash_compact_bang, 0);
+    rb_define_method(rb_cHash, "compact", rb_hash_compact, 0);
+    rb_define_method(rb_cHash, "compact!", rb_hash_compact_bang, 0);
 
-    rb_define_method(rb_cHash,"include?", rb_hash_has_key, 1);
-    rb_define_method(rb_cHash,"member?", rb_hash_has_key, 1);
-    rb_define_method(rb_cHash,"has_key?", rb_hash_has_key, 1);
-    rb_define_method(rb_cHash,"has_value?", rb_hash_has_value, 1);
-    rb_define_method(rb_cHash,"key?", rb_hash_has_key, 1);
-    rb_define_method(rb_cHash,"value?", rb_hash_has_value, 1);
+    rb_define_method(rb_cHash, "include?", rb_hash_has_key, 1);
+    rb_define_method(rb_cHash, "member?", rb_hash_has_key, 1);
+    rb_define_method(rb_cHash, "has_key?", rb_hash_has_key, 1);
+    rb_define_method(rb_cHash, "has_value?", rb_hash_has_value, 1);
+    rb_define_method(rb_cHash, "key?", rb_hash_has_key, 1);
+    rb_define_method(rb_cHash, "value?", rb_hash_has_value, 1);
 
-    rb_define_method(rb_cHash,"compare_by_identity", rb_hash_compare_by_id, 0);
-    rb_define_method(rb_cHash,"compare_by_identity?", rb_hash_compare_by_id_p, 0);
+    rb_define_method(rb_cHash, "compare_by_identity", rb_hash_compare_by_id, 0);
+    rb_define_method(rb_cHash, "compare_by_identity?", rb_hash_compare_by_id_p, 0);
 
     rb_define_method(rb_cHash, "any?", rb_hash_any_p, 0);
     rb_define_method(rb_cHash, "dig", rb_hash_dig, -1);
@@ -4571,48 +4571,48 @@ Init_Hash(void) https://github.com/ruby/ruby/blob/trunk/hash.c#L4571
     envtbl = rb_obj_alloc(rb_cObject);
     rb_extend_object(envtbl, rb_mEnumerable);
 
-    rb_define_singleton_method(envtbl,"[]", rb_f_getenv, 1);
-    rb_define_singleton_method(envtbl,"fetch", env_fetch, -1);
-    rb_define_singleton_method(envtbl,"[]=", env_aset, 2);
-    rb_define_singleton_method(envtbl,"store", env_aset, 2);
-    rb_define_singleton_method(envtbl,"each", env_each_pair, 0);
-    rb_define_singleton_method(envtbl,"each_pair", env_each_pair, 0);
-    rb_define_singleton_method(envtbl,"each_key", env_each_key, 0);
-    rb_define_singleton_method(envtbl,"each_value", env_each_value, 0);
-    rb_define_singleton_method(envtbl,"delete", env_delete_m, 1);
-    rb_define_singleton_method(envtbl,"delete_if", env_delete_if, 0);
-    rb_define_singleton_method(envtbl,"keep_if", env_keep_if, 0);
-    rb_define_singleton_method(envtbl,"clear", rb_env_clear, 0);
-    rb_define_singleton_method(envtbl,"reject", env_reject, 0);
-    rb_define_singleton_method(envtbl,"reject!", env_reject_bang, 0);
-    rb_define_singleton_method(envtbl,"select", env_select, 0);
-    rb_define_singleton_method(envtbl,"select!", env_select_bang, 0);
-    rb_define_singleton_method(envtbl,"shift", env_shift, 0);
-    rb_define_singleton_method(envtbl,"invert", env_invert, 0);
-    rb_define_singleton_method(envtbl,"replace", env_replace, 1);
-    rb_define_singleton_method(envtbl,"update", env_update, 1);
-    rb_define_singleton_method(envtbl,"inspect", env_inspect, 0);
-    rb_define_singleton_method(envtbl,"rehash", env_none, 0);
-    rb_define_singleton_method(envtbl,"to_a", env_to_a, 0);
-    rb_define_singleton_method(envtbl,"to_s", env_to_s, 0);
-    rb_define_singleton_method(envtbl,"key", env_key, 1);
-    rb_define_singleton_method(envtbl,"index", env_index, 1);
-    rb_define_singleton_method(envtbl,"size", env_size, 0);
-    rb_define_singleton_method(envtbl,"length", env_size, 0);
-    rb_define_singleton_method(envtbl,"empty?", env_empty_p, 0);
-    rb_define_singleton_method(envtbl,"keys", env_keys, 0);
-    rb_define_singleton_method(envtbl,"values", env_values, 0);
-    rb_define_singleton_method(envtbl,"values_at", env_values_at, -1);
-    rb_define_singleton_method(envtbl,"include?", env_has_key, 1);
-    rb_define_singleton_method(envtbl,"member?", env_has_key, 1);
-    rb_define_singleton_method(envtbl,"has_key?", env_has_key, 1);
-    rb_define_singleton_method(envtbl,"has_value?", env_has_value, 1);
-    rb_define_singleton_method(envtbl,"key?", env_has_key, 1);
-    rb_define_singleton_method(envtbl,"value?", env_has_value, 1);
-    rb_define_singleton_method(envtbl,"to_hash", env_to_hash, 0);
-    rb_define_singleton_method(envtbl,"to_h", env_to_hash, 0);
-    rb_define_singleton_method(envtbl,"assoc", env_assoc, 1);
-    rb_define_singleton_method(envtbl,"rassoc", env_rassoc, 1);
+    rb_define_singleton_method(envtbl, "[]", rb_f_getenv, 1);
+    rb_define_singleton_method(envtbl, "fetch", env_fetch, -1);
+    rb_define_singleton_method(envtbl, "[]=", env_aset, 2);
+    rb_define_singleton_method(envtbl, "store", env_aset, 2);
+    rb_define_singleton_method(envtbl, "each", env_each_pair, 0);
+    rb_define_singleton_method(envtbl, "each_pair", env_each_pair, 0);
+    rb_define_singleton_method(envtbl, "each_key", env_each_key, 0);
+    rb_define_singleton_method(envtbl, "each_value", env_each_value, 0);
+    rb_define_singleton_method(envtbl, "delete", env_delete_m, 1);
+    rb_define_singleton_method(envtbl, "delete_if", env_delete_if, 0);
+    rb_define_singleton_method(envtbl, "keep_if", env_keep_if, 0);
+    rb_define_singleton_method(envtbl, "clear", rb_env_clear, 0);
+    rb_define_singleton_method(envtbl, "reject", env_reject, 0);
+    rb_define_singleton_method(envtbl, "reject!", env_reject_bang, 0);
+    rb_define_singleton_method(envtbl, "select", env_select, 0);
+    rb_define_singleton_method(envtbl, "select!", env_select_bang, 0);
+    rb_define_singleton_method(envtbl, "shift", env_shift, 0);
+    rb_define_singleton_method(envtbl, "invert", env_invert, 0);
+    rb_define_singleton_method(envtbl, "replace", env_replace, 1);
+    rb_define_singleton_method(envtbl, "update", env_update, 1);
+    rb_define_singleton_method(envtbl, "inspect", env_inspect, 0);
+    rb_define_singleton_method(envtbl, "rehash", env_none, 0);
+    rb_define_singleton_method(envtbl, "to_a", env_to_a, 0);
+    rb_define_singleton_method(envtbl, "to_s", env_to_s, 0);
+    rb_define_singleton_method(envtbl, "key", env_key, 1);
+    rb_define_singleton_method(envtbl, "index", env_index, 1);
+    rb_define_singleton_method(envtbl, "size", env_size, 0);
+    rb_define_singleton_method(envtbl, "length", env_size, 0);
+    rb_define_singleton_method(envtbl, "empty?", env_empty_p, 0);
+    rb_define_singleton_method(envtbl, "keys", env_keys, 0);
+    rb_define_singleton_method(envtbl, "values", env_values, 0);
+    rb_define_singleton_method(envtbl, "values_at", env_values_at, -1);
+    rb_define_singleton_method(envtbl, "include?", env_has_key, 1);
+    rb_define_singleton_method(envtbl, "member?", env_has_key, 1);
+    rb_define_singleton_method(envtbl, "has_key?", env_has_key, 1);
+    rb_define_singleton_method(envtbl, "has_value?", env_has_value, 1);
+    rb_define_singleton_method(envtbl, "key?", env_has_key, 1);
+    rb_define_singleton_method(envtbl, "value?", env_has_value, 1);
+    rb_define_singleton_method(envtbl, "to_hash", env_to_hash, 0);
+    rb_define_singleton_method(envtbl, "to_h", env_to_hash, 0);
+    rb_define_singleton_method(envtbl, "assoc", env_assoc, 1);
+    rb_define_singleton_method(envtbl, "rassoc", env_rassoc, 1);
 
     /*
      * ENV is a Hash-like accessor for environment variables.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]