summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-24 05:18:47 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-24 05:18:47 +0000
commite02b469de182c1d87ead38fa82630eaaee75c379 (patch)
tree425980c3ebfb78d38067b3b01f2df97a9dc0853d
parent169300a4f8f6c704d9ef1dbed0b73f2dd7efdb68 (diff)
* eval.c (thgroup_add): no warning for terminated threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog23
-rw-r--r--eval.c4
-rw-r--r--ext/socket/extconf.rb25
-rw-r--r--gc.c12
-rw-r--r--lib/cgi.rb18
-rw-r--r--lib/irb/locale.rb23
-rw-r--r--string.c6
-rw-r--r--variable.c3
8 files changed, 88 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 56f7c90ba43..5eaffbbbeb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Jul 24 13:32:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (thgroup_add): no warning for terminated threads.
+
Thu Jul 24 13:09:26 2003 Tanaka Akira <akr@m17n.org>
* lib/pathname.rb: added.
@@ -39,6 +43,14 @@ Thu Jul 24 03:41:30 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/tcltklib/tcltklib.c (ip_init): need at least one statement after
label.
+Thu Jul 24 01:48:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi.rb (CGI::QueryExtension::[]): should return StringIO (or
+ Tempfile) for multipart/form.
+
+ * variable.c (rb_define_const): give warning for non constant
+ name. [ruby-core:01287]
+
Thu Jul 24 01:51:08 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick: imported.
@@ -58,6 +70,10 @@ Wed Jul 23 23:06:59 2003 WATANABE Hirofumi <eban@ruby-lang.org>
* file.c (DOSISH): better Cygwin support.
+Wed Jul 23 19:13:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_split_m): the receiver may be empty string.
+
Wed Jul 23 18:43:00 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/erb.rb: import erb-2.0.4b1.
@@ -23203,5 +23219,10 @@ Wed Aug 13 17:51:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
* version 1.1 alpha0 released.
Local variables:
-add-log-time-format: current-time-string
+add-log-time-format: (lambda ()
+ (let* ((time (current-time))
+ (diff (+ (cadr time) 32400))
+ (lo (% diff 65536))
+ (hi (+ (car time) (/ diff 65536))))
+ (format-time-string "%c" (list hi lo) t)))
end:
diff --git a/eval.c b/eval.c
index f84e5f0630f..13f9bec54ac 100644
--- a/eval.c
+++ b/eval.c
@@ -9024,7 +9024,6 @@ rb_thread_kill(thread)
if (th == th->next || th == main_thread) rb_exit(0);
rb_thread_ready(th);
- th->thgroup = 0;
th->status = THREAD_TO_KILL;
if (!rb_thread_critical) rb_thread_schedule();
return thread;
@@ -9965,8 +9964,7 @@ thgroup_add(group, thread)
}
if (!th->thgroup) {
- rb_warn("terminated thread");
- return group;
+ return Qnil;
}
if (OBJ_FROZEN(th->thgroup)) {
rb_raise(rb_eThreadError, "can't move from the frozen thread group");
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index b9e66f676e6..c5489a95353 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -1,7 +1,5 @@
require 'mkmf'
-$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
-
case RUBY_PLATFORM
when /bccwin32/
test_func = "WSACleanup"
@@ -150,6 +148,29 @@ main()
}
EOF
$CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS
+else # doug's fix, NOW add -Dss_family... only if required!
+$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
+ if try_link(<<EOF)
+#ifdef _WIN32
+# include <windows.h>
+# include <winsock.h>
+#else
+# include <sys/types.h>
+# include <netdb.h>
+# include <string.h>
+# include <sys/socket.h>
+#endif
+int
+main()
+{
+ struct sockaddr_storage ss;
+
+ ss.ss_family;
+ return 0;
+}
+EOF
+ $CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS
+end
end
if try_link(<<EOF)
diff --git a/gc.c b/gc.c
index b1afbb1db73..cefe86fa4a6 100644
--- a/gc.c
+++ b/gc.c
@@ -1536,20 +1536,26 @@ run_final(obj)
int status, critical_save;
VALUE args[2], table;
- critical_save = rb_thread_critical;
- rb_thread_critical = Qtrue;
args[1] = rb_ary_new3(1, rb_obj_id(obj)); /* make obj into id */
for (i=0; i<RARRAY(finalizers)->len; i++) {
args[0] = RARRAY(finalizers)->ptr[i];
+ critical_save = rb_thread_critical;
+ rb_thread_critical = Qtrue;
rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
+ rb_thread_critical = critical_save;
+ CHECK_INTS;
}
+ CHECK_INTS;
if (finalizer_table && st_delete(finalizer_table, &obj, &table)) {
for (i=0; i<RARRAY(table)->len; i++) {
args[0] = RARRAY(table)->ptr[i];
+ critical_save = rb_thread_critical;
+ rb_thread_critical = Qtrue;
rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
+ rb_thread_critical = critical_save;
+ CHECK_INTS;
}
}
- rb_thread_critical = critical_save;
}
void
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 8f522ab7c15..1327b64d340 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -800,7 +800,7 @@ convert string charset, and set language to "ja".
body = Tempfile.new("CGI")
else
begin
- require "stringio" if not defined? StringIO
+ require "stringio"
body = StringIO.new
rescue LoadError
require "tempfile"
@@ -917,6 +917,7 @@ convert string charset, and set language to "ja".
if ("POST" == env_table['REQUEST_METHOD']) and
%r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n.match(env_table['CONTENT_TYPE'])
boundary = $1.dup
+ @multipart = true
@params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH']))
else
@params = CGI::parse(
@@ -947,7 +948,6 @@ convert string charset, and set language to "ja".
super(str)
end
def [](idx)
- p caller(1)
warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']"
self
end
@@ -964,8 +964,17 @@ convert string charset, and set language to "ja".
def [](key)
params = @params[key]
value = params[0]
- value ||= ""
- Value.new(value,params)
+ if @multipart
+ if value
+ return value
+ elsif defined? StringIO
+ StringIO.new("")
+ else
+ Tempfile.new("CGI")
+ end
+ else
+ Value.new(value || "", params)
+ end
end
def keys(*args)
@@ -1931,6 +1940,7 @@ The hash keys are case sensitive. Ask the samples.
end
extend QueryExtension
+ @multipart = false
if "POST" != env_table['REQUEST_METHOD']
initialize_query() # set @params, @cookies
else
diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb
index dad6b2f0754..b2c90e38e24 100644
--- a/lib/irb/locale.rb
+++ b/lib/irb/locale.rb
@@ -21,27 +21,26 @@ module IRB
LOCALE_DIR = "/lc/"
def initialize(locale = nil)
- @lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"]
- @lang = "C" unless @lang
+ @lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C"
end
attr_reader :lang
- @@LC2KCONV = {
- # "ja" => Kconv::JIS,
- # "ja_JP" => Kconv::JIS,
- "ja_JP.ujis" => Kconv::EUC,
- "ja_JP.euc" => Kconv::EUC,
- "ja_JP.eucJP" => Kconv::EUC,
- "ja_JP.sjis" => Kconv::SJIS,
- "ja_JP.SJIS" => Kconv::SJIS,
- }
+ def lc2kconv(lang)
+ case lang
+ when "ja_JP.ujis", "ja_JP.euc", "ja_JP.eucJP"
+ Kconv::EUC
+ when "ja_JP.sjis", "ja_JP.SJIS"
+ Kconv::SJIS
+ end
+ end
+ private :lc2kconv
def String(mes)
mes = super(mes)
case @lang
when /^ja/
- mes = Kconv::kconv(mes, @@LC2KCONV[@lang])
+ mes = Kconv::kconv(mes, lc2kconv(@lang))
else
mes
end
diff --git a/string.c b/string.c
index eb7b3474470..08aa302aaf0 100644
--- a/string.c
+++ b/string.c
@@ -2557,7 +2557,11 @@ rb_str_split_m(argc, argv, str)
if (rb_scan_args(argc, argv, "02", &spat, &limit) == 2) {
lim = NUM2INT(limit);
if (lim <= 0) limit = Qnil;
- else if (lim == 1) return rb_ary_new3(1, str);
+ else if (lim == 1) {
+ if (RSTRING(str)->len == 0)
+ return rb_ary_new2(0);
+ return rb_ary_new3(1, str);
+ }
i = 1;
}
diff --git a/variable.c b/variable.c
index 77c1c372401..76c0939c46a 100644
--- a/variable.c
+++ b/variable.c
@@ -1548,6 +1548,9 @@ rb_define_const(klass, name, val)
{
ID id = rb_intern(name);
+ if (!rb_is_const_id(id)) {
+ rb_warn("rb_define_const: invalide name `%s' for constant", name);
+ }
if (klass == rb_cObject) {
rb_secure(4);
}