summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-02-08 00:51:16 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-02-08 00:51:16 +0000
commit46c954bfdabf5176fbd05e39da2fea61257e3392 (patch)
tree889c1d2ae92c3dbc0dc00a4e45ed2a91cc450b0c
parentb4f51b41e2de7c6c6d4124af83064624749a36dd (diff)
* lib/cgi.rb (CGI::Cookie): [ruby-talk:130040]
* object.c: [ruby-doc:818] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog35
-rw-r--r--hash.c21
-rw-r--r--lib/cgi.rb2
-rw-r--r--lib/irb/context.rb2
-rw-r--r--object.c6
-rw-r--r--parse.y2
-rw-r--r--st.c10
-rw-r--r--st.h2
8 files changed, 48 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 8bdb4bf0a9..caba6ed3e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,17 @@
+Tue Feb 8 09:30:01 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::Cookie): [ruby-talk:130040]
+
Tue Feb 8 00:19:02 2005 Tanaka Akira <akr@m17n.org>
* lib/resolv.rb (Resolv::DNS::Name#subdomain_of?): new method.
(Resolv::DNS::Name#inspect): ditto.
Suggested by Sam Roberts. [ruby-talk:129086]
+Mon Feb 7 10:06:30 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c: [ruby-doc:818]
+
Mon Feb 7 01:56:20 2005 NAKAMURA Usaku <usa@ruby-lang.org>
* instruby.rb, rubytest.rb (srcdir): no longer embed srcdir into
@@ -123,7 +131,11 @@ Mon Jan 31 13:33:21 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/remote-tk.rb: ditto
-Sat Jan 29 09:42:12 2005 Sam Roberts <sroberts@uniserve.com>
+Mon Jan 31 10:29:18 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/irb/context.rb (IRB::Context::initialize): [ruby-core:04330]
+
+ Sat Jan 29 09:42:12 2005 Sam Roberts <sroberts@uniserve.com>
* lib/resolv.rb (Resolv::DNS::Resource::IN::SRV): Added RFC2782 SRV
resource record for specifying location of services.
@@ -137,6 +149,11 @@ Fri Jan 28 17:16:55 2005 Tanaka Akira <akr@m17n.org>
(Resolv::DNS::Config#lazy_initialize): ditto.
Suggested by Sam Roberts.
+Thu Jan 27 13:18:03 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * st.c (st_foreach): report success/failure by return value.
+ [ruby-Bugs-1396]
+
Thu Jan 27 00:15:29 2005 Minero Aoki <aamine@loveruby.net>
* test/fileutils/test_fileutils.rb (setup): support BSD-style
@@ -2268,6 +2285,14 @@ Mon Oct 18 02:04:11 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
do_not_reverse_lookup for each socket if :DoNotReverseLookup
is set. [ruby-core:02357]
+Mon Oct 18 00:42:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/socket/socket.c (sock_s_getservbyaname): protocol string
+ might be altered. [ruby-dev:24503]
+
+ * string.c (rb_str_upto): check if return value from succ is a
+ string. [ruby-dev:24504]
+
Sun Oct 17 23:03:48 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/timer.rb: TkTimer#start and restart accept a block
@@ -2360,14 +2385,6 @@ Thu Oct 7 12:55:04 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
switch. [ruby-dev:24442]
* pack.c (pack_unpack): string conversion should at the top of the
-Mon Oct 18 00:42:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * ext/socket/socket.c (sock_s_getservbyaname): protocol string
- might be altered. [ruby-dev:24503]
-
- * string.c (rb_str_upto): check if return value from succ is a
- string. [ruby-dev:24504]
-
method. [ruby-dev:24439]
* io.c (io_read): buffer should be frozen only after the length
diff --git a/hash.c b/hash.c
index 641dac1b78..4697fd3e6d 100644
--- a/hash.c
+++ b/hash.c
@@ -121,17 +121,14 @@ struct foreach_safe_arg {
};
static int
-foreach_safe_i(key, value, arg, err)
+foreach_safe_i(key, value, arg)
st_data_t key, value;
struct foreach_safe_arg *arg;
{
int status;
- if (err) {
- rb_raise(rb_eRuntimeError, "hash modified during iteration");
- }
if (key == Qundef) return ST_CONTINUE;
- status = (*arg->func)(key, value, arg->arg, err);
+ status = (*arg->func)(key, value, arg->arg);
if (status == ST_CONTINUE) {
return ST_CHECK;
}
@@ -149,7 +146,9 @@ st_foreach_safe(table, func, a)
arg.tbl = table;
arg.func = func;
arg.arg = a;
- st_foreach(table, foreach_safe_i, (st_data_t)&arg);
+ if (st_foreach(table, foreach_safe_i, (st_data_t)&arg)) {
+ rb_raise(rb_eRuntimeError, "hash modified during iteration");
+ }
}
struct hash_foreach_arg {
@@ -159,17 +158,13 @@ struct hash_foreach_arg {
};
static int
-hash_foreach_iter(key, value, arg, err)
+hash_foreach_iter(key, value, arg)
VALUE key, value;
struct hash_foreach_arg *arg;
- int err;
{
int status;
st_table *tbl;
- if (err) {
- rb_raise(rb_eRuntimeError, "hash modified during iteration");
- }
tbl = RHASH(arg->hash)->tbl;
if (key == Qundef) return ST_CONTINUE;
status = (*arg->func)(key, value, arg->arg);
@@ -207,7 +202,9 @@ static VALUE
hash_foreach_call(arg)
struct hash_foreach_arg *arg;
{
- st_foreach(RHASH(arg->hash)->tbl, hash_foreach_iter, (st_data_t)arg);
+ if (st_foreach(RHASH(arg->hash)->tbl, hash_foreach_iter, (st_data_t)arg)) {
+ rb_raise(rb_eRuntimeError, "hash modified during iteration");
+ }
return Qnil;
}
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 0fd0bc7cd4..7c84f64640 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -770,7 +770,7 @@ class CGI
# cookie1.domain = 'domain'
# cookie1.expires = Time.now + 30
# cookie1.secure = true
- class Cookie < SimpleDelegator
+ class Cookie < DelegateClass(Array)
# Create a new CGI::Cookie object.
#
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index 9421608f85..01856cd2e7 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -38,7 +38,7 @@ module IRB
@inspect_mode = IRB.conf[:INSPECT_MODE]
self.math_mode = IRB.conf[:MATH_MODE] if IRB.conf[:MATH_MODE]
- self.use_tracer = IRB.conf[:USE_TRACER] if IRB.conf[:USE_TRASER]
+ self.use_tracer = IRB.conf[:USE_TRACER] if IRB.conf[:USE_TRACER]
self.use_loader = IRB.conf[:USE_LOADER] if IRB.conf[:USE_LOADER]
self.eval_history = IRB.conf[:EVAL_HISTORY] if IRB.conf[:EVAL_HISTORY]
diff --git a/object.c b/object.c
index 20f9148ca2..e259d554d4 100644
--- a/object.c
+++ b/object.c
@@ -2009,7 +2009,8 @@ rb_obj_ivar_get(obj, iv)
*
* Sets the instance variable names by <i>symbol</i> to
* <i>object</i>, thereby frustrating the efforts of the class's
- * author to attempt to provide proper encapsulation.
+ * author to attempt to provide proper encapsulation. The variable
+ * did not have to exist prior to this call.
*
* class Fred
* def initialize(p1, p2)
@@ -2018,7 +2019,8 @@ rb_obj_ivar_get(obj, iv)
* end
* fred = Fred.new('cat', 99)
* fred.instance_variable_set(:@a, 'dog') #=> "dog"
- * fred.inspect #=> "#<Fred:0x401b3da8 @a=\"dog\", @b=99>"
+ * fred.instance_variable_set(:@c, 'cat') #=> "cat"
+ * fred.inspect #=> "#<Fred:0x401b3da8 @a=\"dog\", @b=99, @c=\"cat\">"
*/
static VALUE
diff --git a/parse.y b/parse.y
index a96c6fc006..790105c85b 100644
--- a/parse.y
+++ b/parse.y
@@ -2559,7 +2559,7 @@ yycompile(f, line)
ruby_in_compile = 0;
cond_stack = 0;
cmdarg_stack = 0;
- command_start = 1;
+ command_start = 1;
class_nest = 0;
in_single = 0;
in_def = 0;
diff --git a/st.c b/st.c
index 12ed401145..69ff6ef5ae 100644
--- a/st.c
+++ b/st.c
@@ -480,7 +480,7 @@ st_cleanup_safe(table, never)
table->num_entries = num_entries;
}
-void
+int
st_foreach(table, func, arg)
st_table *table;
int (*func)();
@@ -493,7 +493,7 @@ st_foreach(table, func, arg)
for(i = 0; i < table->num_bins; i++) {
last = 0;
for(ptr = table->bins[i]; ptr != 0;) {
- retval = (*func)(ptr->key, ptr->record, arg, 0);
+ retval = (*func)(ptr->key, ptr->record, arg);
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
tmp = 0;
@@ -504,8 +504,7 @@ st_foreach(table, func, arg)
}
if (!tmp) {
/* call func with error notice */
- retval = (*func)(0, 0, arg, 1);
- return;
+ return 1;
}
/* fall through */
case ST_CONTINUE:
@@ -513,7 +512,7 @@ st_foreach(table, func, arg)
ptr = ptr->next;
break;
case ST_STOP:
- return;
+ return 0;
case ST_DELETE:
tmp = ptr;
if (last == 0) {
@@ -528,6 +527,7 @@ st_foreach(table, func, arg)
}
}
}
+ return 0;
}
static int
diff --git a/st.h b/st.h
index bc12624b90..5901bd4f80 100644
--- a/st.h
+++ b/st.h
@@ -48,7 +48,7 @@ int st_delete _((st_table *, st_data_t *, st_data_t *));
int st_delete_safe _((st_table *, st_data_t *, st_data_t *, st_data_t));
int st_insert _((st_table *, st_data_t, st_data_t));
int st_lookup _((st_table *, st_data_t, st_data_t *));
-void st_foreach _((st_table *, int (*)(ANYARGS), st_data_t));
+int st_foreach _((st_table *, int (*)(ANYARGS), st_data_t));
void st_add_direct _((st_table *, st_data_t, st_data_t));
void st_free_table _((st_table *));
void st_cleanup_safe _((st_table *, st_data_t));