summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--class.c2
-rw-r--r--eval.c3
-rw-r--r--ext/extmk.rb.in5
-rw-r--r--regex.c33
-rw-r--r--string.c1
-rw-r--r--variable.c2
7 files changed, 40 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e6f41a326..58d1f762c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/class.c b/class.c
index d0263bfd96..f906390246 100644
--- a/class.c
+++ b/class.c
@@ -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 &&
diff --git a/eval.c b/eval.c
index 8ec59bf534..79bc1c6703 100644
--- a/eval.c
+++ b/eval.c
@@ -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;
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index cefb5052fc..69ef6c3f8b 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -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 = []
diff --git a/regex.c b/regex.c
index 3770648e38..9115fc112c 100644
--- a/regex.c
+++ b/regex.c
@@ -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;
diff --git a/string.c b/string.c
index 8a784b2217..099f6a81d1 100644
--- a/string.c
+++ b/string.c
@@ -2227,7 +2227,6 @@ rb_str_split_m(argc, argv, str)
if (!NIL_P(limit) && lim <= ++i) break;
}
end++;
- if (ismbchar(*ptr)) {ptr++; end++;}
}
}
}
diff --git a/variable.c b/variable.c
index 65bf380efb..878d858849 100644
--- a/variable.c
+++ b/variable.c
@@ -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");