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

ruby-changes:10959

From: yugui <ko1@a...>
Date: Sun, 22 Feb 2009 21:49:49 +0900 (JST)
Subject: [ruby-changes:10959] Ruby:r22535 (ruby_1_9_1): merges r22322 from trunk into ruby_1_9_1.

yugui	2009-02-22 21:49:36 +0900 (Sun, 22 Feb 2009)

  New Revision: 22535

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

  Log:
    merges r22322 from trunk into ruby_1_9_1.
    * variable.c (rb_define_hooked_variable): suppress false assertion
      with VC9.  [ruby-core:22115]

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/variable.c

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 22534)
+++ ruby_1_9_1/ChangeLog	(revision 22535)
@@ -1,3 +1,8 @@
+Sun Feb 15 11:45:29 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* variable.c (rb_define_hooked_variable): suppress false assertion
+	  with VC9.  [ruby-core:22115]
+
 Fri Feb 13 15:11:11 2009  Koichi Sasada  <ko1@a...>
 
 	* vm_eval.c (eval_string_with_cref): use rb_vm_get_ruby_level_next_cfp() 
Index: ruby_1_9_1/variable.c
===================================================================
--- ruby_1_9_1/variable.c	(revision 22534)
+++ ruby_1_9_1/variable.c	(revision 22535)
@@ -169,7 +169,7 @@
 /*
  *  call-seq:
  *     mod.name    => string
- *  
+ *
  *  Returns the name of the module <i>mod</i>.  Returns nil for anonymous modules.
  */
 
@@ -470,15 +470,10 @@
     VALUE (*getter)(ANYARGS),
     void  (*setter)(ANYARGS))
 {
-    struct global_variable *gvar;
-    ID id;
-    VALUE tmp;
-    
-    if (var)
-        tmp = *var;
+    volatile VALUE tmp = var ? *var : Qnil;
+    ID id = global_id(name);
+    struct global_variable *gvar = rb_global_entry(id)->var;
 
-    id = global_id(name);
-    gvar = rb_global_entry(id)->var;
     gvar->data = (void*)var;
     gvar->getter = getter?(gvar_getter_t *)getter:var_getter;
     gvar->setter = setter?(gvar_setter_t *)setter:var_setter;
@@ -520,7 +515,7 @@
  *  call-seq:
  *     trace_var(symbol, cmd )             => nil
  *     trace_var(symbol) {|val| block }    => nil
- *  
+ *
  *  Controls tracing of assignments to global variables. The parameter
  *  +symbol_ identifies the variable (as either a string name or a
  *  symbol identifier). _cmd_ (which may be a string or a
@@ -528,13 +523,13 @@
  *  is assigned. The block or +Proc+ object receives the
  *  variable's new value as a parameter. Also see
  *  <code>Kernel::untrace_var</code>.
- *     
+ *
  *     trace_var :$_, proc {|v| puts "$_ is now '#{v}'" }
  *     $_ = "hello"
  *     $_ = ' there'
- *     
+ *
  *  <em>produces:</em>
- *     
+ *
  *     $_ is now 'hello'
  *     $_ is now ' there'
  */
@@ -592,7 +587,7 @@
 /*
  *  call-seq:
  *     untrace_var(symbol [, cmd] )   => array or nil
- *  
+ *
  *  Removes tracing for the specified command on the given global
  *  variable and returns +nil+. If no command is specified,
  *  removes all tracing for that variable and returns an array
@@ -728,9 +723,9 @@
 /*
  *  call-seq:
  *     global_variables    => array
- *  
+ *
  *  Returns an array of the names of global variables.
- *     
+ *
  *     global_variables.grep /std/   #=> [:$stdin, :$stdout, :$stderr]
  */
 
@@ -966,7 +961,7 @@
         len = ROBJECT_NUMIV(obj);
         ptr = ROBJECT_IVPTR(obj);
         iv_index_tbl = ROBJECT_IV_INDEX_TBL(obj);
-        if (!iv_index_tbl) break; 
+        if (!iv_index_tbl) break;
         if (!st_lookup(iv_index_tbl, id, &index)) break;
         if (len <= index) break;
         val = ptr[index];
@@ -1176,11 +1171,11 @@
 /*
  *  call-seq:
  *     obj.instance_variables    => array
- *  
+ *
  *  Returns an array of instance variable names for the receiver. Note
  *  that simply defining an accessor does not create the corresponding
  *  instance variable.
- *     
+ *
  *     class Fred
  *       attr_accessor :a1
  *       def initialize
@@ -1203,10 +1198,10 @@
 /*
  *  call-seq:
  *     obj.remove_instance_variable(symbol)    => obj
- *  
+ *
  *  Removes the named instance variable from <i>obj</i>, returning that
  *  variable's value.
- *     
+ *
  *     class Dummy
  *       attr_reader :var
  *       def initialize
@@ -1302,7 +1297,7 @@
  *  assumed to be in file <code>fred.rb</code>). If found, it returns the
  *  value of the loaded class. It therefore implements a perverse
  *  kind of autoload facility.
- *  
+ *
  *    def Object.const_missing(name)
  *      @looked_for ||= {}
  *      str_name = name.to_s
@@ -1314,7 +1309,7 @@
  *      return klass if klass
  *      raise "Class not found: #{name}"
  *    end
- *  
+ *
  */
 
 VALUE
@@ -1519,7 +1514,7 @@
 /*
  *  call-seq:
  *     remove_const(sym)   => obj
- *  
+ *
  *  Removes the definition of the given constant, returning that
  *  constant's value. Predefined classes and singleton objects (such as
  *  <i>true</i>) cannot be removed.
@@ -1619,7 +1614,7 @@
 /*
  *  call-seq:
  *     mod.constants(inherit=true)    => array
- *  
+ *
  *  Returns an array of the names of the constants accessible in
  *  <i>mod</i>. This includes the names of constants in any included
  *  modules (example at start of section), unless the <i>all</i>
@@ -1902,9 +1897,9 @@
 /*
  *  call-seq:
  *     mod.class_variables   => array
- *  
+ *
  *  Returns an array of the names of class variables in <i>mod</i>.
- *     
+ *
  *     class One
  *       @@var1 = 1
  *     end
@@ -1929,19 +1924,19 @@
 /*
  *  call-seq:
  *     remove_class_variable(sym)    => obj
- *  
+ *
  *  Removes the definition of the <i>sym</i>, returning that
  *  constant's value.
- *     
+ *
  *     class Dummy
  *       @@var = 99
  *       puts @@var
  *       remove_class_variable(:@@var)
  *       p(defined? @@var)
  *     end
- *     
+ *
  *  <em>produces:</em>
- *     
+ *
  *     99
  *     nil
  */

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

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