* class.c (rb_include_module): detect cyclic module inclusion.
* eval.c (rb_thread_cleanup): need not to free thread stacks at process termination. * array.c (rb_ary_fetch): use the block to get the default value if the block is given. * eval.c (rb_thread_schedule): should check time only if BOTH WAIT_SELECT and WAIT_TIME. * eval.c (umethod_bind): should update rklass field. * hash.c (rb_hash_update): if a block is given, yields [key, value1, value2] to the block to resolve conflict. * string.c (rb_str_split_m): no need to consider KANJI characters, if the length of separator is 1 (byte). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
eb9708f386
commit
f547c1150c
27
ChangeLog
27
ChangeLog
@ -1,3 +1,30 @@
|
||||
Fri Jan 25 17:16:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* class.c (rb_include_module): detect cyclic module inclusion.
|
||||
|
||||
Fri Jan 25 02:17:56 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_thread_cleanup): need not to free thread stacks at
|
||||
process termination.
|
||||
|
||||
* array.c (rb_ary_fetch): use the block to get the default value
|
||||
if the block is given.
|
||||
|
||||
* eval.c (rb_thread_schedule): should check time only if BOTH
|
||||
WAIT_SELECT and WAIT_TIME.
|
||||
|
||||
Thu Jan 24 11:49:05 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (umethod_bind): should update rklass field.
|
||||
|
||||
* hash.c (rb_hash_update): if a block is given, yields [key,
|
||||
value1, value2] to the block to resolve conflict.
|
||||
|
||||
Thu Jan 24 05:42:01 2002 Koji Arai <jca02266@nifty.ne.jp>
|
||||
|
||||
* string.c (rb_str_split_m): no need to consider KANJI
|
||||
characters, if the length of separator is 1 (byte).
|
||||
|
||||
Wed Jan 23 16:07:31 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* array.c (Init_Array): remove Array#filter.
|
||||
|
10
array.c
10
array.c
@ -550,9 +550,17 @@ rb_ary_fetch(argc, argv, ary)
|
||||
idx += RARRAY(ary)->len;
|
||||
}
|
||||
if (idx < 0 || RARRAY(ary)->len <= idx) {
|
||||
if (argc == 2) return ifnone;
|
||||
if (rb_block_given_p()) {
|
||||
if (argc > 1) {
|
||||
rb_raise(rb_eArgError, "wrong number of arguments");
|
||||
}
|
||||
return rb_yield(pos);
|
||||
}
|
||||
if (argc == 1) {
|
||||
rb_raise(rb_eIndexError, "index %d out of array", idx);
|
||||
}
|
||||
return ifnone;
|
||||
}
|
||||
return RARRAY(ary)->ptr[idx];
|
||||
}
|
||||
|
||||
|
6
class.c
6
class.c
@ -349,10 +349,12 @@ rb_include_module(klass, module)
|
||||
OBJ_INFECT(klass, module);
|
||||
c = klass;
|
||||
while (module) {
|
||||
if (RCLASS(klass)->m_tbl == RCLASS(module)->m_tbl)
|
||||
rb_raise(rb_eArgError, "cyclic include detected");
|
||||
/* ignore if the module included already in superclasses */
|
||||
for (p = RCLASS(klass)->super; p; p = RCLASS(p)->super) {
|
||||
if (BUILTIN_TYPE(p) == T_ICLASS &&
|
||||
RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) {
|
||||
if (BUILTIN_TYPE(p) == T_ICLASS) {
|
||||
if (RCLASS(p)->m_tbl == RCLASS(module)->m_tbl)
|
||||
goto skip;
|
||||
}
|
||||
}
|
||||
|
8
doc/NEWS
8
doc/NEWS
@ -1,3 +1,11 @@
|
||||
: Array#fetch
|
||||
|
||||
takes block to get the default value.
|
||||
|
||||
: Hash#update
|
||||
|
||||
takes block to resolve key conflict.
|
||||
|
||||
: IO#fsync
|
||||
|
||||
Added.
|
||||
|
7
eval.c
7
eval.c
@ -6866,6 +6866,7 @@ umethod_bind(method, recv)
|
||||
method = Data_Make_Struct(rb_cMethod,struct METHOD,bm_mark,free,bound);
|
||||
*bound = *data;
|
||||
bound->recv = recv;
|
||||
bound->rklass = CLASS_OF(recv);
|
||||
|
||||
return method;
|
||||
}
|
||||
@ -7319,7 +7320,7 @@ static rb_thread_t
|
||||
rb_thread_check(data)
|
||||
VALUE data;
|
||||
{
|
||||
if (TYPE(data) != T_DATA || RDATA(data)->dfree != (RUBY_DATA_FUNC)thread_free) {
|
||||
if (TYPE(data) != T_DATA || RDATA(data)->dmark != (RUBY_DATA_FUNC)thread_mark) {
|
||||
rb_raise(rb_eTypeError, "wrong argument type %s (expected Thread)",
|
||||
rb_class2name(CLASS_OF(data)));
|
||||
}
|
||||
@ -7744,7 +7745,8 @@ rb_thread_schedule()
|
||||
if (select_timeout && n == 0) {
|
||||
if (now < 0.0) now = timeofday();
|
||||
FOREACH_THREAD_FROM(curr, th) {
|
||||
if ((th->wait_for & (WAIT_SELECT|WAIT_TIME)) && th->delay <= now) {
|
||||
if (((th->wait_for&(WAIT_SELECT|WAIT_TIME)) == (WAIT_SELECT|WAIT_TIME)) &&
|
||||
th->delay <= now) {
|
||||
th->status = THREAD_RUNNABLE;
|
||||
th->wait_for = 0;
|
||||
th->select_value = 0;
|
||||
@ -8664,6 +8666,7 @@ rb_thread_cleanup()
|
||||
th->gid = 0;
|
||||
th->priority = 0;
|
||||
th->status = THREAD_TO_KILL;
|
||||
RDATA(th->thread)->dfree = NULL;
|
||||
}
|
||||
}
|
||||
END_FOREACH(th);
|
||||
|
@ -26,6 +26,7 @@ SRC_EXT = ["c", "cc", "m", "cxx", "cpp", "C"]
|
||||
$extlist = []
|
||||
|
||||
$includedir = "@includedir@".gsub(/\$\{prefix\}|\$\(prefix\)/,'@prefix@')
|
||||
$libdir = "@libdir@".gsub(/\$\{exec_prefix\}|\$\(exec_prefix\)/,'@exec_prefix@')
|
||||
|
||||
$top_srcdir = "@top_srcdir@"
|
||||
if $top_srcdir !~ "^/"
|
||||
@ -73,7 +74,7 @@ if /mswin32/ =~ RUBY_PLATFORM
|
||||
else
|
||||
OUTFLAG = '-o '
|
||||
end
|
||||
LINK = "@CC@ #{OUTFLAG}conftest -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir @LDFLAGS@ %s %s %s conftest.c %s %s @LIBS@"
|
||||
LINK = "@CC@ #{OUTFLAG}conftest -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir -L#$libdir @LDFLAGS@ %s %s %s conftest.c %s %s @LIBS@"
|
||||
CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir %s %s %s conftest.c"
|
||||
|
||||
$log = open('extmk.log', 'w')
|
||||
@ -450,7 +451,7 @@ target_prefix = #{target_prefix}
|
||||
|
||||
"
|
||||
mfile.printf "LOCAL_LIBS = %s %s\n", $LOCAL_LIBS, $local_flags
|
||||
mfile.printf "LIBS = %s\n", $libs
|
||||
mfile.printf "LIBS = -L%s %s\n", $libdir, $libs
|
||||
mfile.printf "OBJS = "
|
||||
if !$objs then
|
||||
$objs = []
|
||||
|
20
hash.c
20
hash.c
@ -889,12 +889,30 @@ rb_hash_update_i(key, value, hash)
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
static int
|
||||
rb_hash_update_block_i(key, value, hash)
|
||||
VALUE key, value;
|
||||
VALUE hash;
|
||||
{
|
||||
if (key == Qundef) return ST_CONTINUE;
|
||||
if (rb_hash_has_key(hash, key)) {
|
||||
value = rb_yield(rb_ary_new3(3, key, rb_hash_aref(hash, key), value));
|
||||
}
|
||||
rb_hash_aset(hash, key, value);
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_hash_update(hash1, hash2)
|
||||
VALUE hash1, hash2;
|
||||
{
|
||||
hash2 = to_hash(hash2);
|
||||
if (rb_block_given_p()) {
|
||||
st_foreach(RHASH(hash2)->tbl, rb_hash_update_block_i, hash1);
|
||||
}
|
||||
else {
|
||||
st_foreach(RHASH(hash2)->tbl, rb_hash_update_i, hash1);
|
||||
}
|
||||
return hash1;
|
||||
}
|
||||
|
||||
@ -985,7 +1003,7 @@ env_fetch(argc, argv)
|
||||
if (!env) {
|
||||
if (rb_block_given_p()) {
|
||||
if (argc > 1) {
|
||||
rb_raise(rb_eArgError, "wrong number of arguments", argc);
|
||||
rb_raise(rb_eArgError, "wrong number of arguments");
|
||||
}
|
||||
return rb_yield(key);
|
||||
}
|
||||
|
@ -256,8 +256,7 @@ The variable ruby-indent-level controls the amount of indentation.
|
||||
(looking-at "[a-zA-Z][a-zA-z0-9_]* +%[^ \t]"))
|
||||
((eq option 'expr-re)
|
||||
(looking-at "[a-zA-Z][a-zA-z0-9_]* +/[^ \t]"))
|
||||
(t
|
||||
(looking-at "[a-zA-Z][a-zA-z0-9_]* +")))))))))
|
||||
(t nil))))))))
|
||||
|
||||
(defun ruby-forward-string (term &optional end no-error expand)
|
||||
(let ((n 1) (c (string-to-char term))
|
||||
|
Loading…
x
Reference in New Issue
Block a user