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

ruby-changes:33307

From: nobu <ko1@a...>
Date: Sun, 23 Mar 2014 10:10:18 +0900 (JST)
Subject: [ruby-changes:33307] nobu:r45386 (trunk): hash.c: use ID_SCOPE_SHIFT

nobu	2014-03-23 10:10:12 +0900 (Sun, 23 Mar 2014)

  New Revision: 45386

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45386

  Log:
    hash.c: use ID_SCOPE_SHIFT
    
    * hash.c (rb_any_hash): use ID_SCOPE_SHIFT instead of magic number.
      [Feature #9425]

  Modified files:
    trunk/common.mk
    trunk/hash.c
Index: common.mk
===================================================================
--- common.mk	(revision 45385)
+++ common.mk	(revision 45386)
@@ -684,7 +684,7 @@ gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_IN https://github.com/ruby/ruby/blob/trunk/common.mk#L684
   {$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
   {$(VPATH)}internal.h {$(VPATH)}constant.h \
   {$(VPATH)}thread.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}debug.h
-hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h {$(VPATH)}id.h \
   $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h
 inits.$(OBJEXT): {$(VPATH)}inits.c $(RUBY_H_INCLUDES) \
   {$(VPATH)}internal.h
Index: hash.c
===================================================================
--- hash.c	(revision 45385)
+++ hash.c	(revision 45386)
@@ -18,6 +18,7 @@ https://github.com/ruby/ruby/blob/trunk/hash.c#L18
 #include "internal.h"
 #include <errno.h>
 #include "probes.h"
+#include "id.h"
 
 #ifdef __APPLE__
 # ifdef HAVE_CRT_EXTERNS_H
@@ -132,7 +133,7 @@ rb_any_hash(VALUE a) https://github.com/ruby/ruby/blob/trunk/hash.c#L133
 
     if (SPECIAL_CONST_P(a)) {
 	if (a == Qundef) return 0;
-	if (SYMBOL_P(a)) a >>= (RUBY_SPECIAL_SHIFT + 3); /* 3=ID_SCOPE_SHIFT */
+	if (SYMBOL_P(a)) a >>= (RUBY_SPECIAL_SHIFT + ID_SCOPE_SHIFT);
 	hnum = rb_objid_hash((st_index_t)a);
     }
     else if (BUILTIN_TYPE(a) == T_STRING) {

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

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