public
Description: ruby lang (www.ruby-lang.org) svn mirror
Homepage: http://svn.ruby-lang.org/repos/ruby/
Clone URL: git://github.com/juretta/ruby.git
* bin/erb (ERB::Main::run): typo fixed.  [ruby-core:06337]

* env.h: move struct METHOD and struct BLOCK from eval.c to
  support NodeWrap and ParseTree.

* rubysig.h (CHECK_INTS): prevent signal handler to run during
  critical section.  [ruby-core:04039]

* eval.c (load_wait): need not to call rb_thread_schedule()
  explicitly.  [ruby-core:04039]

* eval.c (rb_thread_schedule): clear rb_thread_critical.
  [ruby-core:04039]

* eval.c (rb_obj_instance_exec): create instance_exec and
  module_exec which pass arguments to the block.

* eval.c (rb_f_funcall): rename fcall to funcall to follow
  tradition.

* st.c (st_free_table): do not call free() but xfree().
  [ruby-core:06205]

* eval.c (splat_value): call rb_Array() to convert svalue to
  values.  [ruby-dev:27397]

* lib/cgi.rb (CGI::Cookie::parse): Cookies from Nokia devices may
  not be parsed correctly.  A patch from August Z. Flatby
  (augustzf) in [ruby-Patches-2595].  [ruby-core:06183]

* object.c (rb_Array): Array() to raise error for objects without
  to_ary, nor to_a.

* object.c (nil_to_a): revert NilClass#to_a.


git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9436 
b2dd03c8-39d4-4d8f-98ff-823fe69b080e
matz (author)
Fri Oct 21 02:00:02 -0700 2005
commit  6199d665e8fb2f3118e75db457d4beb00624c48d
tree    a2f8e5c4ef38a997e4cc3cc10ae136748b8890d9
parent  1cb54abea63878c65fc1397766f161ea9e526453
...
 
 
 
 
1
2
3
...
89
90
91
 
 
 
 
 
92
93
94
...
100
101
102
 
 
 
 
 
 
 
 
 
 
 
103
104
105
...
134
135
136
 
 
 
 
 
 
 
 
137
138
139
...
167
168
169
 
 
 
 
 
170
171
172
...
193
194
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
197
198
...
1
2
3
4
5
6
7
...
93
94
95
96
97
98
99
100
101
102
103
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
...
154
155
156
157
158
159
160
161
162
163
164
165
166
167
...
195
196
197
198
199
200
201
202
203
204
205
...
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
0
@@ -1,3 +1,7 @@
0
+Fri Oct 21 17:49:32 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
0
+
0
+ * bin/erb (ERB::Main::run): typo fixed. [ruby-core:06337]
0
+
0
 Fri Oct 21 15:42:28 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
0
 
0
   * intern.h, struct.c (rb_struct_iv_get): constified.
0
@@ -89,6 +93,11 @@ Mon Oct 17 09:42:50 2005 NAKAMURA Usaku <usa@ruby-lang.org>
0
 
0
   * win32/configure.bat (srcdir, target): ditto.
0
 
0
+Mon Oct 17 05:01:50 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
0
+
0
+ * env.h: move struct METHOD and struct BLOCK from eval.c to
0
+ support NodeWrap and ParseTree.
0
+
0
 Sun Oct 16 22:16:51 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
0
 
0
   * ext/extmk.rb: omit non-existing directories.
0
@@ -100,6 +109,17 @@ Sun Oct 16 14:40:54 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
0
 
0
   * test/rinda/test_rinda.rb: test it.
0
 
0
+Sun Oct 16 03:38:07 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
0
+
0
+ * rubysig.h (CHECK_INTS): prevent signal handler to run during
0
+ critical section. [ruby-core:04039]
0
+
0
+ * eval.c (load_wait): need not to call rb_thread_schedule()
0
+ explicitly. [ruby-core:04039]
0
+
0
+ * eval.c (rb_thread_schedule): clear rb_thread_critical.
0
+ [ruby-core:04039]
0
+
0
 Sun Oct 16 00:13:14 2005 NAKAMURA Usaku <usa@ruby-lang.org>
0
 
0
   * win32/configure.bat: remove unnecessary line which prevents
0
@@ -134,6 +154,14 @@ Fri Oct 14 16:39:37 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
0
    It is harmful to permit the access to ~/public_html by default.
0
    suggested by Hiroyuki Iwatsuki.
0
 
0
+Fri Oct 14 04:58:38 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
0
+
0
+ * eval.c (rb_obj_instance_exec): create instance_exec and
0
+ module_exec which pass arguments to the block.
0
+
0
+ * eval.c (rb_f_funcall): rename fcall to funcall to follow
0
+ tradition.
0
+
0
 Thu Oct 13 23:29:51 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
0
 
0
   * parse.y (HEAPCNT): bison allocates indivisible size.
0
@@ -167,6 +195,11 @@ Tue Oct 11 21:41:58 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
0
 
0
   * eval.c (rb_respond_to): conform to Object#respond_to?. [ruby-dev:27411]
0
 
0
+Tue Oct 11 00:01:21 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
0
+
0
+ * st.c (st_free_table): do not call free() but xfree().
0
+ [ruby-core:06205]
0
+
0
 Sat Oct 8 19:49:42 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
0
 
0
   * eval.c (Init_Binding): add Binding#dup method. [yarv-dev:666]
0
@@ -193,6 +226,24 @@ Sat Oct 8 19:49:42 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
0
 
0
   * test/net/http/test_http.rb: removed superfluous splatting stars.
0
 
0
+Fri Oct 7 16:41:43 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
0
+
0
+ * eval.c (splat_value): call rb_Array() to convert svalue to
0
+ values. [ruby-dev:27397]
0
+
0
+Fri Oct 7 09:54:00 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
0
+
0
+ * lib/cgi.rb (CGI::Cookie::parse): Cookies from Nokia devices may
0
+ not be parsed correctly. A patch from August Z. Flatby
0
+ (augustzf) in [ruby-Patches-2595]. [ruby-core:06183]
0
+
0
+Thu Oct 6 22:51:30 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
0
+
0
+ * object.c (rb_Array): Array() to raise error for objects without
0
+ to_ary, nor to_a.
0
+
0
+ * object.c (nil_to_a): revert NilClass#to_a.
0
+
0
 Thu Oct 6 20:10:38 2005 Minero Aoki <aamine@loveruby.net>
0
 
0
   * ext/strscan/strscan.c (strscan_free): remove useless code.
...
60
61
62
63
 
64
65
66
...
60
61
62
 
63
64
65
66
0
@@ -60,7 +60,7 @@ class ERB
0
             $DEBUG = true
0
           when '-r' # require
0
             require ARGV.req_arg
0
- when '-S' # sacurity level
0
+ when '-S' # security level
0
             arg = ARGV.req_arg
0
             raise "invalid safe_level #{arg.dump}" unless arg =~ /^[0-4]$/
0
             safe_level = arg.to_i
0
...
56
57
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
...
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
0
@@ -56,4 +56,36 @@ struct RVarmap {
0
 };
0
 RUBY_EXTERN struct RVarmap *ruby_dyna_vars;
0
 
0
+struct METHOD {
0
+ VALUE klass, rklass;
0
+ VALUE recv;
0
+ ID id, oid;
0
+ int safe_level;
0
+ struct RNode *body;
0
+};
0
+
0
+struct BLOCK {
0
+ struct RNode *var;
0
+ struct RNode *body;
0
+ VALUE self;
0
+ struct FRAME frame;
0
+ struct SCOPE *scope;
0
+ VALUE klass;
0
+ struct RNode *cref;
0
+ int iter;
0
+ int vmode;
0
+ int flags;
0
+ int uniq;
0
+ struct RVarmap *dyna_vars;
0
+ VALUE orig_thread;
0
+ VALUE wrapper;
0
+ VALUE block_obj;
0
+ struct BLOCK *outer;
0
+ struct BLOCK *prev;
0
+};
0
+
0
+#define BLOCK_D_SCOPE 1
0
+#define BLOCK_LAMBDA 2
0
+#define BLOCK_FROM_METHOD 4
0
+
0
 #endif /* ENV_H */
0
...
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
...
2641
2642
2643
2644
 
2645
2646
2647
...
5827
5828
5829
5830
 
5831
5832
5833
...
5869
5870
5871
5872
 
5873
5874
5875
5876
5877
 
5878
5879
5880
5881
 
5882
5883
5884
 
5885
5886
5887
5888
 
5889
5890
 
5891
5892
5893
...
6336
6337
6338
6339
 
6340
6341
 
 
 
 
 
 
 
6342
6343
6344
6345
6346
 
6347
6348
 
 
 
 
6349
6350
6351
...
6355
6356
6357
6358
 
6359
6360
6361
...
6424
6425
6426
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6427
6428
6429
...
6452
6453
6454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6455
6456
6457
...
6699
6700
6701
6702
6703
 
6704
6705
6706
6707
6708
...
7579
7580
7581
7582
 
7583
 
7584
7585
7586
...
7597
7598
7599
 
 
7600
7601
7602
...
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
...
10353
10354
10355
10356
 
10357
10358
10359
...
689
690
691
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
692
693
694
...
2617
2618
2619
 
2620
2621
2622
2623
...
5803
5804
5805
 
5806
5807
5808
5809
...
5845
5846
5847
 
5848
5849
5850
5851
5852
 
5853
5854
5855
5856
 
5857
5858
5859
 
5860
5861
5862
5863
 
5864
5865
 
5866
5867
5868
5869
...
6312
6313
6314
 
6315
6316
 
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
 
6328
6329
 
6330
6331
6332
6333
6334
6335
6336
...
6340
6341
6342
 
6343
6344
6345
6346
...
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
...
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
...
6742
6743
6744
 
6745
6746
6747
 
6748
6749
6750
...
7621
7622
7623
 
7624
7625
7626
7627
7628
7629
...
7640
7641
7642
7643
7644
7645
7646
7647
...
8590
8591
8592
 
 
 
 
 
 
 
 
8593
8594
8595
...
10390
10391
10392
 
10393
10394
10395
10396
0
@@ -689,30 +689,6 @@ static unsigned long frame_unique = 0;
0
     ruby_frame = _frame.prev;    \
0
 } while (0)
0
 
0
-struct BLOCK {
0
- NODE *var;
0
- NODE *body;
0
- VALUE self;
0
- struct FRAME frame;
0
- struct SCOPE *scope;
0
- VALUE klass;
0
- NODE *cref;
0
- int iter;
0
- int vmode;
0
- int flags;
0
- int uniq;
0
- struct RVarmap *dyna_vars;
0
- VALUE orig_thread;
0
- VALUE wrapper;
0
- VALUE block_obj;
0
- struct BLOCK *outer;
0
- struct BLOCK *prev;
0
-};
0
-
0
-#define BLOCK_D_SCOPE 1
0
-#define BLOCK_LAMBDA 2
0
-#define BLOCK_FROM_METHOD 4
0
-
0
 static struct BLOCK *ruby_block;
0
 static unsigned long block_unique = 0;
0
 
0
@@ -2641,7 +2617,7 @@ avalue_splat(VALUE v)
0
 static VALUE
0
 splat_value(VALUE v)
0
 {
0
- return rb_values_from_ary(rb_convert_type(v, T_ARRAY, "Array", "to_a"));
0
+ return rb_values_from_ary(rb_Array(v));
0
 }
0
 
0
 static VALUE
0
@@ -5827,7 +5803,7 @@ rb_apply(VALUE recv, ID mid, VALUE args)
0
 }
0
 
0
 static VALUE
0
-send_fcall(int argc, VALUE *argv, VALUE recv, int scope)
0
+send_funcall(int argc, VALUE *argv, VALUE recv, int scope)
0
 {
0
     VALUE vid;
0
 
0
@@ -5869,25 +5845,25 @@ rb_f_send(int argc, VALUE *argv, VALUE recv)
0
 {
0
     int scope = (ruby_frame->flags & FRAME_FUNC) ? 1 : 0;
0
 
0
- return send_fcall(argc, argv, recv, scope);
0
+ return send_funcall(argc, argv, recv, scope);
0
 }
0
 
0
 /*
0
  * call-seq:
0
- * obj.fcall(symbol [, args...]) => obj
0
+ * obj.funcall(symbol [, args...]) => obj
0
  *
0
  * Invokes the method identified by _symbol_, passing it any
0
  * arguments specified. Unlike send, which calls private methods only
0
- * when it is invoked in function call style, fcall always aware of
0
+ * when it is invoked in function call style, funcall always aware of
0
  * private methods.
0
  *
0
- * 1.fcall(:puts, "hello") # prints "foo"
0
+ * 1.funcall(:puts, "hello") # prints "foo"
0
  */
0
 
0
 static VALUE
0
-rb_f_fcall(int argc, VALUE *argv, VALUE recv)
0
+rb_f_funcall(int argc, VALUE *argv, VALUE recv)
0
 {
0
- return send_fcall(argc, argv, recv, 1);
0
+ return send_funcall(argc, argv, recv, 1);
0
 }
0
 
0
 VALUE
0
@@ -6336,16 +6312,25 @@ eval_under(VALUE under, VALUE self, VALUE src, const char *file, int line)
0
 }
0
 
0
 static VALUE
0
-yield_under_i(VALUE self)
0
+yield_under_i(VALUE arg)
0
 {
0
- return rb_yield_0(self, self, ruby_class, YIELD_PUBLIC_DEF, Qfalse);
0
+ VALUE *args = (VALUE *)arg;
0
+ VALUE avalue = Qtrue;
0
+ if (args[0] == Qundef) {
0
+ avalue = Qfalse;
0
+ args[0] = args[1];
0
+ }
0
+ return rb_yield_0(args[0], args[1], ruby_class, YIELD_PUBLIC_DEF, avalue);
0
 }
0
 
0
 /* block eval under the class/module context */
0
 static VALUE
0
-yield_under(VALUE under, VALUE self)
0
+yield_under(VALUE under, VALUE self, VALUE values)
0
 {
0
- return exec_under(yield_under_i, under, 0, self);
0
+ VALUE args[4];
0
+ args[0] = values;
0
+ args[1] = self;
0
+ return exec_under(yield_under_i, under, 0, (VALUE)args);
0
 }
0
 
0
 static VALUE
0
@@ -6355,7 +6340,7 @@ specific_eval(int argc, VALUE *argv, VALUE klass, VALUE self)
0
   if (argc > 0) {
0
    rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
0
   }
0
- return yield_under(klass, self);
0
+ return yield_under(klass, self, Qundef);
0
     }
0
     else {
0
   char *file = "(eval)";
0
@@ -6424,6 +6409,38 @@ rb_obj_instance_eval(int argc, VALUE *argv, VALUE self)
0
 
0
 /*
0
  * call-seq:
0
+ * obj.instance_exec(arg...) {|var...| block } => obj
0
+ *
0
+ * Executes the given block within the context of the receiver
0
+ * (_obj_). In order to set the context, the variable +self+ is set
0
+ * to _obj_ while the code is executing, giving the code access to
0
+ * _obj_'s instance variables. Arguments are passed as block parameters.
0
+ *
0
+ * class Klass
0
+ * def initialize
0
+ * @secret = 99
0
+ * end
0
+ * end
0
+ * k = Klass.new
0
+ * k.instance_eval(5) {|x| @secret+x } #=> 104
0
+ */
0
+
0
+VALUE
0
+rb_obj_instance_exec(int argc, VALUE *argv, VALUE self)
0
+{
0
+ VALUE klass;
0
+
0
+ if (FIXNUM_P(self) || SYMBOL_P(self)) {
0
+ klass = Qnil;
0
+ }
0
+ else {
0
+ klass = rb_singleton_class(self);
0
+ }
0
+ return yield_under(klass, self, rb_values_new2(argc, argv));
0
+}
0
+
0
+/*
0
+ * call-seq:
0
  * mod.class_eval(string [, filename [, lineno]]) => obj
0
  * mod.module_eval {|| block } => obj
0
  *
0
@@ -6452,6 +6469,32 @@ rb_mod_module_eval(int argc, VALUE *argv, VALUE mod)
0
     return specific_eval(argc, argv, mod, mod);
0
 }
0
 
0
+/*
0
+ * call-seq:
0
+ * mod.module_exec(arg...) {|var...| block } => obj
0
+ * mod.class_exec(arg...) {|var...| block } => obj
0
+ *
0
+ * Evaluates the given block in the context of the class/module.
0
+ * The method defined in the block will belong to the receiver.
0
+ *
0
+ * class Thing
0
+ * end
0
+ * Thing.class_exec{
0
+ * def hello() "Hello there!" end
0
+ * }
0
+ * puts Thing.new.hello()
0
+ *
0
+ * <em>produces:</em>
0
+ *
0
+ * Hello there!
0
+ */
0
+
0
+VALUE
0
+rb_mod_module_exec(int argc, VALUE *argv, VALUE mod)
0
+{
0
+ return yield_under(mod, mod, rb_values_new2(argc, argv));
0
+}
0
+
0
 VALUE rb_load_path;
0
 
0
 NORETURN(static void load_failed(VALUE));
0
@@ -6699,10 +6742,9 @@ load_wait(char *ftptr)
0
 
0
     if (!loading_tbl) return Qfalse;
0
     if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return Qfalse;
0
- if ((rb_thread_t)th == curr_thread) return Qtrue;
0
     do {
0
+ if ((rb_thread_t)th == curr_thread) return Qtrue;
0
   CHECK_INTS;
0
- rb_thread_schedule();
0
     } while (st_lookup(loading_tbl, (st_data_t)ftptr, &th));
0
     return Qtrue;
0
 }
0
@@ -7579,8 +7621,9 @@ Init_eval(void)
0
 
0
     rb_define_method(rb_mKernel, "send", rb_f_send, -1);
0
     rb_define_method(rb_mKernel, "__send__", rb_f_send, -1);
0
- rb_define_method(rb_mKernel, "fcall", rb_f_fcall, -1);
0
+ rb_define_method(rb_mKernel, "funcall", rb_f_funcall, -1);
0
     rb_define_method(rb_mKernel, "instance_eval", rb_obj_instance_eval, -1);
0
+ rb_define_method(rb_mKernel, "instance_exec", rb_obj_instance_exec, -1);
0
 
0
     rb_define_private_method(rb_cModule, "append_features", rb_mod_append_features, 1);
0
     rb_define_private_method(rb_cModule, "extend_object", rb_mod_extend_object, 1);
0
@@ -7597,6 +7640,8 @@ Init_eval(void)
0
     rb_define_method(rb_cModule, "private_class_method", rb_mod_private_method, -1);
0
     rb_define_method(rb_cModule, "module_eval", rb_mod_module_eval, -1);
0
     rb_define_method(rb_cModule, "class_eval", rb_mod_module_eval, -1);
0
+ rb_define_method(rb_cModule, "module_exec", rb_mod_module_exec, -1);
0
+ rb_define_method(rb_cModule, "class_exec", rb_mod_module_exec, -1);
0
 
0
     rb_undef_method(rb_cClass, "module_function");
0
 
0
@@ -8545,14 +8590,6 @@ block_pass(VALUE self, NODE *node)
0
        (VALUE)&arg, rb_eval(self, node->nd_body));
0
 }
0
 
0
-struct METHOD {
0
- VALUE klass, rklass;
0
- VALUE recv;
0
- ID id, oid;
0
- int safe_level;
0
- NODE *body;
0
-};
0
-
0
 static void
0
 bm_mark(struct METHOD *data)
0
 {
0
@@ -10353,7 +10390,7 @@ rb_thread_schedule(void)
0
   rb_bug("cross-thread violation on rb_thread_schedule()");
0
     }
0
 #endif
0
- rb_thread_pending = 0;
0
+ rb_thread_pending = rb_thread_critical = 0;
0
     if (curr_thread == curr_thread->next
0
   && curr_thread->status == THREAD_RUNNABLE)
0
   return;
...
880
881
882
883
 
884
885
886
...
880
881
882
 
883
884
885
886
0
@@ -880,7 +880,7 @@ class CGI
0
     cookies = Hash.new([])
0
     return cookies unless raw_cookie
0
 
0
- raw_cookie.split(/[;,] /).each do |pairs|
0
+ raw_cookie.split(/[;,]\s?/).each do |pairs|
0
       name, values = pairs.split('=',2)
0
       next unless name and values
0
       name = CGI::unescape(name)
...
87
88
89
90
 
91
92
93
94
 
95
96
97
...
107
108
109
110
 
111
112
113
...
125
126
127
128
 
129
130
131
...
134
135
136
137
 
138
139
140
...
172
173
174
175
 
176
177
178
...
87
88
89
 
90
91
92
93
 
94
95
96
97
...
107
108
109
 
110
111
112
113
...
125
126
127
 
128
129
130
131
...
134
135
136
 
137
138
139
140
...
172
173
174
 
175
176
177
178
0
@@ -87,11 +87,11 @@ module MonitorMixin
0
     class Timeout < Exception; end
0
     
0
     def wait(timeout = nil)
0
- @monitor.fcall(:mon_check_owner)
0
+ @monitor.funcall(:mon_check_owner)
0
       timer = create_timer(timeout)
0
       
0
       Thread.critical = true
0
- count = @monitor.fcall(:mon_exit_for_cond)
0
+ count = @monitor.funcall(:mon_exit_for_cond)
0
       @waiters.push(Thread.current)
0
 
0
       begin
0
@@ -107,7 +107,7 @@ module MonitorMixin
0
   if @waiters.include?(Thread.current) # interrupted?
0
    @waiters.delete(Thread.current)
0
   end
0
- @monitor.fcall(:mon_enter_for_cond, count)
0
+ @monitor.funcall(:mon_enter_for_cond, count)
0
   Thread.critical = false
0
       end
0
     end
0
@@ -125,7 +125,7 @@ module MonitorMixin
0
     end
0
     
0
     def signal
0
- @monitor.fcall(:mon_check_owner)
0
+ @monitor.funcall(:mon_check_owner)
0
       Thread.critical = true
0
       t = @waiters.shift
0
       t.wakeup if t
0
@@ -134,7 +134,7 @@ module MonitorMixin
0
     end
0
     
0
     def broadcast
0
- @monitor.fcall(:mon_check_owner)
0
+ @monitor.funcall(:mon_check_owner)
0
       Thread.critical = true
0
       for t in @waiters
0
   t.wakeup
0
@@ -172,7 +172,7 @@ module MonitorMixin
0
   
0
   def self.extend_object(obj)
0
     super(obj)
0
- obj.fcall(:mon_initialize)
0
+ obj.funcall(:mon_initialize)
0
   end
0
   
0
   #
...
729
730
731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
733
734
...
2236
2237
2238
2239
2240
2241
2242
 
2243
2244
2245
...
2250
2251
2252
2253
2254
2255
2256
2257
...
2433
2434
2435
 
2436
2437
2438
...
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
...
2252
2253
2254
 
 
 
 
2255
2256
2257
2258
...
2263
2264
2265
 
 
2266
2267
2268
...
2444
2445
2446
2447
2448
2449
2450
0
@@ -729,6 +729,22 @@ nil_to_s(VALUE obj)
0
 
0
 /*
0
  * call-seq:
0
+ * nil.to_a => []
0
+ *
0
+ * Always returns an empty array.
0
+ *
0
+ * nil.to_a #=> []
0
+ */
0
+
0
+static VALUE
0
+nil_to_a(obj)
0
+ VALUE obj;
0
+{
0
+ return rb_ary_new2(0);
0
+}
0
+
0
+/*
0
+ * call-seq:
0
  * nil.inspect => "nil"
0
  *
0
  * Always returns the string "nil".
0
@@ -2236,10 +2252,7 @@ rb_Array(VALUE val)
0
     VALUE tmp = rb_check_array_type(val);
0
 
0
     if (NIL_P(tmp)) {
0
- tmp = rb_check_convert_type(val, T_ARRAY, "Array", "to_a");
0
- if (NIL_P(tmp)) {
0
- return rb_ary_new3(1, val);
0
- }
0
+ return rb_convert_type(val, T_ARRAY, "Array", "to_a");
0
     }
0
     return tmp;
0
 }
0
@@ -2250,8 +2263,6 @@ rb_Array(VALUE val)
0
  *
0
  * Returns <i>arg</i> as an <code>Array</code>. First tries to call
0
  * <i>arg</i><code>.to_ary</code>, then <i>arg</i><code>.to_a</code>.
0
- * If both fail, creates a single element array containing <i>arg</i>
0
- * (unless <i>arg</i> is <code>nil</code>).
0
  *
0
  * Array(1..5) #=> [1, 2, 3, 4, 5]
0
  */
0
@@ -2433,6 +2444,7 @@ Init_Object(void)
0
     rb_define_method(rb_cNilClass, "to_i", nil_to_i, 0);
0
     rb_define_method(rb_cNilClass, "to_f", nil_to_f, 0);
0
     rb_define_method(rb_cNilClass, "to_s", nil_to_s, 0);
0
+ rb_define_method(rb_cNilClass, "to_a", nil_to_a, 0);
0
     rb_define_method(rb_cNilClass, "inspect", nil_inspect, 0);
0
     rb_define_method(rb_cNilClass, "&", false_and, 1);
0
     rb_define_method(rb_cNilClass, "|", false_or, 1);
...
82
83
84
85
 
 
86
87
88
89
90
91
...
93
94
95
96
97
98
99
100
101
102
 
 
 
 
103
104
 
105
106
107
...
82
83
84
 
85
86
87
 
 
88
89
90
...
92
93
94
 
 
 
 
 
 
 
95
96
97
98
99
100
101
102
103
104
0
@@ -82,10 +82,9 @@ void rb_thread_schedule(void);
0
 #if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE)
0
 RUBY_EXTERN int rb_thread_pending;
0
 # define CHECK_INTS do {\
0
- if (!rb_prohibit_interrupt) {\
0
+ if (!(rb_prohibit_interrupt | rb_thread_critical)) {\
0
+ if (rb_thread_pending) rb_thread_schedule();\
0
   if (rb_trap_pending) rb_trap_exec();\
0
- if (rb_thread_pending && !rb_thread_critical)\
0
- rb_thread_schedule();\
0
     }\
0
 } while (0)
0
 #else
0
@@ -93,15 +92,13 @@ RUBY_EXTERN int rb_thread_pending;
0
 RUBY_EXTERN int rb_thread_tick;
0
 #define THREAD_TICK 500
0
 #define CHECK_INTS do {\
0
- if (!rb_prohibit_interrupt) {\
0
- if (rb_trap_pending) rb_trap_exec();\
0
- if (!rb_thread_critical) {\
0
- if (rb_thread_tick-- <= 0) {\
0
- rb_thread_tick = THREAD_TICK;\
0
- rb_thread_schedule();\
0
- }\
0
+ if (!(rb_prohibit_interrupt | rb_thread_critical)) {\
0
+ if (rb_thread_tick-- <= 0) {\
0
+ rb_thread_tick = THREAD_TICK;
0
+ rb_thread_schedule();
0
   }\
0
     }\
0
+ if (rb_trap_pending) rb_trap_exec();\
0
 } while (0)
0
 #endif
0
 
0
...
4
5
6
 
7
8
9
10
11
12
 
13
14
15
...
216
217
218
219
 
220
221
222
223
224
 
 
225
226
227
...
330
331
332
333
 
334
335
336
...
352
353
354
355
 
356
357
358
...
362
363
364
365
366
 
 
367
368
369
...
395
396
397
398
 
399
400
401
...
406
407
408
409
 
410
411
412
...
496
497
498
499
 
500
501
502
...
4
5
6
7
8
 
 
 
 
9
10
11
12
13
...
214
215
216
 
217
218
219
220
 
 
221
222
223
224
225
...
328
329
330
 
331
332
333
334
...
350
351
352
 
353
354
355
356
...
360
361
362
 
 
363
364
365
366
367
...
393
394
395
 
396
397
398
399
...
404
405
406
 
407
408
409
410
...
494
495
496
 
497
498
499
500
0
@@ -4,12 +4,10 @@
0
 
0
 #include "config.h"
0
 #include <stdio.h>
0
+#ifdef HAVE_STDLIB_H
0
 #include <stdlib.h>
0
-#include <string.h>
0
-
0
-#ifdef _WIN32
0
-#include <malloc.h>
0
 #endif
0
+#include <string.h>
0
 
0
 #ifdef NOT_RUBY
0
 #include "regint.h"
0
@@ -216,12 +214,12 @@ st_free_table(st_table *table)
0
   ptr = table->bins[i];
0
   while (ptr != 0) {
0
    next = ptr->next;
0
- free(ptr);
0
+ xfree(ptr);
0
    ptr = next;
0
   }
0
     }
0
- free(table->bins);
0
- free(table);
0
+ xfree(table->bins);
0
+ xfree(table);
0
 }
0
 
0
 #define PTR_NOT_EQUAL(table, ptr, hash_val, key) \
0
@@ -330,7 +328,7 @@ rehash(register st_table *table)
0
    ptr = next;
0
   }
0
     }
0
- free(table->bins);
0
+ xfree(table->bins);
0
     table->num_bins = new_num_bins;
0
     table->bins = new_bins;
0
 }
0
@@ -352,7 +350,7 @@ st_copy(st_table *old_table)
0
   Calloc((unsigned)num_bins, sizeof(st_table_entry*));
0
 
0
     if (new_table->bins == 0) {
0
- free(new_table);
0
+ xfree(new_table);
0
   return 0;
0
     }
0
 
0
@@ -362,8 +360,8 @@ st_copy(st_table *old_table)
0
   while (ptr != 0) {
0
    entry = alloc(st_table_entry);
0
    if (entry == 0) {
0
- free(new_table->bins);
0
- free(new_table);
0
+ xfree(new_table->bins);
0
+ xfree(new_table);
0
     return 0;
0
    }
0
    *entry = *ptr;
0
@@ -395,7 +393,7 @@ st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
0
   table->num_entries--;
0
   if (value != 0) *value = ptr->record;
0
   *key = ptr->key;
0
- free(ptr);
0
+ xfree(ptr);
0
   return 1;
0
     }
0
 
0
@@ -406,7 +404,7 @@ st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
0
    table->num_entries--;
0
    if (value != 0) *value = tmp->record;
0
    *key = tmp->key;
0
- free(tmp);
0
+ xfree(tmp);
0
    return 1;
0
   }
0
     }
0
@@ -496,7 +494,7 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
0
      last->next = ptr->next;
0
     }
0
     ptr = ptr->next;
0
- free(tmp);
0
+ xfree(tmp);
0
     table->num_entries--;
0
    }
0
   }

Comments

    No one has commented yet.