1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* class.c (rb_include_module): detect cyclic module inclusion.

* eval.c (rb_thread_schedule): should check time only if BOTH
  WAIT_SELECT and WAIT_TIME.

* 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/branches/ruby_1_6@2016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-01-25 08:23:34 +00:00
parent 8640bc4bc6
commit 3b359789b9
7 changed files with 40 additions and 20 deletions

View file

@ -1,3 +1,17 @@
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_schedule): should check time only if BOTH
WAIT_SELECT and WAIT_TIME.
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 13:27:44 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* eval.c (rb_yield_0): restore source file/line after yield.

View file

@ -324,6 +324,8 @@ rb_include_module(klass, module)
}
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 &&

3
eval.c
View file

@ -7654,7 +7654,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;

View file

@ -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 !~ "^/"
@ -68,7 +69,7 @@ if RUBY_PLATFORM == "m68k-human"
else
CFLAGS = "@CFLAGS@"
end
LINK = "@CC@ -o 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')
@ -446,7 +447,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 = []

33
regex.c
View file

@ -370,13 +370,12 @@ enum regexpcode
duplicate, /* Match a duplicate of something remembered.
Followed by one byte containing the index of the memory
register. */
fail, /* always fails. */
wordchar, /* Matches any word-constituent character. */
notwordchar, /* Matches any char that is not a word-constituent. */
wordbeg, /* Succeeds if at word beginning. */
wordend, /* Succeeds if at word end. */
wordbound, /* Succeeds if at a word boundary. */
notwordbound,/* Succeeds if not at a word boundary. */
notwordbound /* Succeeds if not at a word boundary. */
};
@ -461,7 +460,7 @@ re_set_syntax(syntax)
int n = mbclen(c) - 1; \
c &= (1<<(BYTEWIDTH-2-n)) - 1; \
while (n--) { \
c = c << 6 | *p++ & ((1<<6)-1); \
c = c << 6 | (*p++ & ((1<<6)-1)); \
} \
} \
else { \
@ -502,23 +501,28 @@ print_mbc(c)
{
if (current_mbctype == MBCTYPE_UTF8) {
if (c < 0x80)
printf("%c", c);
printf("%c", (int)c);
else if (c <= 0x7ff)
printf("%c%c", utf8_firstbyte(c), c&0x3f);
printf("%c%c", (int)utf8_firstbyte(c), (int)(c & 0x3f));
else if (c <= 0xffff)
printf("%c%c%c", utf8_firstbyte(c), (c>>6)&0x3f, c&0x3f);
printf("%c%c%c", (int)utf8_firstbyte(c), (int)((c >> 6) & 0x3f),
(int)(c & 0x3f));
else if (c <= 0x1fffff)
printf("%c%c%c%c", utf8_firstbyte(c), (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f);
printf("%c%c%c%c", (int)utf8_firstbyte(c), (int)((c >> 12) & 0x3f),
(int)((c >> 6) & 0x3f), (int)(c & 0x3f));
else if (c <= 0x3ffffff)
printf("%c%c%c%c%c", utf8_firstbyte(c), (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f);
printf("%c%c%c%c%c", (int)utf8_firstbyte(c), (int)((c >> 18) & 0x3f),
(int)((c >> 12) & 0x3f), (int)((c >> 6) & 0x3f), (int)(c & 0x3f));
else if (c <= 0x7fffffff)
printf("%c%c%c%c%c%c", utf8_firstbyte(c), (c>>24)&0x3f, (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f);
printf("%c%c%c%c%c%c", (int)utf8_firstbyte(c), (int)((c >> 24) & 0x3f),
(int)((c >> 18) & 0x3f), (int)((c >> 12) & 0x3f),
(int)((c >> 6) & 0x3f), (int)(c & 0x3f));
}
else if (c < 0xff) {
printf("\\%o", c);
printf("\\%o", (int)c);
}
else {
printf("%c%c", c>>BYTEWIDTH, c&0xff);
printf("%c%c", (int)(c >> BYTEWIDTH), (int)(c &0xff));
}
}
@ -1184,7 +1188,7 @@ re_compile_pattern(pattern, size, bufp)
register const char *p = pattern;
const char *nextp;
const char *pend = pattern + size;
register unsigned int c, c1;
register unsigned int c, c1 = 0;
const char *p0;
int numlen;
#define ERROR_MSG_MAX_SIZE 200
@ -1246,7 +1250,6 @@ re_compile_pattern(pattern, size, bufp)
int *stackb = stacka;
int *stackp = stackb;
int *stacke = stackb + 40;
int *stackt;
/* Counts ('s as they are encountered. Remembered for the matching ),
where it becomes the register number to put in the stop_memory
@ -1483,8 +1486,8 @@ re_compile_pattern(pattern, size, bufp)
case 'W':
for (c = 0; c < (1 << BYTEWIDTH); c++) {
if (SYNTAX(c) != Sword &&
(current_mbctype && !re_mbctab[c] ||
!current_mbctype && SYNTAX(c) != Sword2))
((current_mbctype && !re_mbctab[c]) ||
(!current_mbctype && SYNTAX(c) != Sword2)))
SET_LIST_BIT(c);
}
had_char_class = 1;

View file

@ -2227,7 +2227,6 @@ rb_str_split_m(argc, argv, str)
if (!NIL_P(limit) && lim <= ++i) break;
}
end++;
if (ismbchar(*ptr)) {ptr++; end++;}
}
}
}

View file

@ -1528,7 +1528,7 @@ rb_mod_remove_cvar(mod, name)
VALUE val;
if (!rb_is_class_id(id)) {
rb_raise(rb_eNameError, "wrong class variable name %s", rb_id2name(name));
rb_raise(rb_eNameError, "wrong class variable name %s", rb_id2name(id));
}
if (!OBJ_TAINTED(mod) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't remove class variable");