From 2f0faf671dcf8eadebdd0e35a567ddb8bd95bcaa Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 29 Jan 2001 05:10:42 +0000 Subject: * string.c (str_independent): should not clear str->orig here. it's too early. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ enum.c | 2 +- error.c | 2 +- eval.c | 4 ++-- file.c | 2 +- gc.c | 24 ++++++++++++------------ io.c | 2 +- object.c | 2 +- pack.c | 2 +- parse.y | 19 ++++++++++++------- process.c | 8 ++++---- re.c | 2 +- ruby.c | 2 +- ruby.h | 2 +- sprintf.c | 2 +- string.c | 6 +++--- version.h | 4 ++-- 17 files changed, 50 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4556703c2f..0b00ac5121 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jan 29 01:40:27 2001 Yukihiro Matsumoto + + * string.c (str_independent): should not clear str->orig here. + it's too early. + Fri Jan 26 01:42:40 2001 Yukihiro Matsumoto * parse.y: clarify do ambiguity, bit more complex but natural diff --git a/enum.c b/enum.c index 11f42c48d7..19cfe913ca 100644 --- a/enum.c +++ b/enum.c @@ -6,7 +6,7 @@ $Date$ created at: Fri Oct 1 15:15:19 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto **********************************************************************/ diff --git a/error.c b/error.c index 084c395184..51b56f98a4 100644 --- a/error.c +++ b/error.c @@ -6,7 +6,7 @@ $Date$ created at: Mon Aug 9 16:11:34 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto **********************************************************************/ diff --git a/eval.c b/eval.c index e8850db6a8..e833b74f19 100644 --- a/eval.c +++ b/eval.c @@ -6,7 +6,7 @@ $Date$ created at: Thu Jun 10 14:22:17 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan @@ -5205,7 +5205,7 @@ rb_feature_p(feature, wait) while (st_lookup(loading_tbl, f, &th)) { if (th == curr_thread) { - rb_raise(rb_eLoadError, "infinite load loop -- %s", f); + return Qtrue; } CHECK_INTS; rb_thread_schedule(); diff --git a/file.c b/file.c index 3e8ec3073f..54d36c9317 100644 --- a/file.c +++ b/file.c @@ -6,7 +6,7 @@ $Date$ created at: Mon Nov 15 12:24:34 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan diff --git a/gc.c b/gc.c index abc8e69919..c40d36aed6 100644 --- a/gc.c +++ b/gc.c @@ -6,7 +6,7 @@ $Date$ created at: Tue Oct 5 09:44:46 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan @@ -149,8 +149,8 @@ static int during_gc; static int need_call_final = 0; static st_table *finalizer_table = 0; -static VALUE -gc_enable() +VALUE +rb_gc_enable() { int old = dont_gc; @@ -158,8 +158,8 @@ gc_enable() return old; } -static VALUE -gc_disable() +VALUE +rb_gc_disable() { int old = dont_gc; @@ -996,8 +996,8 @@ rb_gc() gc_sweep(); } -static VALUE -gc_start() +VALUE +rb_gc_start() { rb_gc(); return Qnil; @@ -1299,14 +1299,14 @@ Init_GC() VALUE rb_mObSpace; rb_mGC = rb_define_module("GC"); - rb_define_singleton_method(rb_mGC, "start", gc_start, 0); - rb_define_singleton_method(rb_mGC, "enable", gc_enable, 0); - rb_define_singleton_method(rb_mGC, "disable", gc_disable, 0); - rb_define_method(rb_mGC, "garbage_collect", gc_start, 0); + rb_define_singleton_method(rb_mGC, "start", rb_gc_start, 0); + rb_define_singleton_method(rb_mGC, "enable", rb_gc_enable, 0); + rb_define_singleton_method(rb_mGC, "disable", rb_gc_disable, 0); + rb_define_method(rb_mGC, "garbage_collect", rb_gc_start, 0); rb_mObSpace = rb_define_module("ObjectSpace"); rb_define_module_function(rb_mObSpace, "each_object", os_each_obj, -1); - rb_define_module_function(rb_mObSpace, "garbage_collect", gc_start, 0); + rb_define_module_function(rb_mObSpace, "garbage_collect", rb_gc_start, 0); rb_define_module_function(rb_mObSpace, "add_finalizer", add_final, 1); rb_define_module_function(rb_mObSpace, "remove_finalizer", rm_final, 1); rb_define_module_function(rb_mObSpace, "finalizers", finals, 0); diff --git a/io.c b/io.c index 03a21974a8..e0feee93dc 100644 --- a/io.c +++ b/io.c @@ -6,7 +6,7 @@ $Date$ created at: Fri Oct 15 18:08:59 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan diff --git a/object.c b/object.c index 159198f922..d0e6dc96a2 100644 --- a/object.c +++ b/object.c @@ -6,7 +6,7 @@ $Date$ created at: Thu Jul 15 12:01:24 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan diff --git a/pack.c b/pack.c index 7aeded5cbd..f7a9f414ec 100644 --- a/pack.c +++ b/pack.c @@ -6,7 +6,7 @@ $Date$ created at: Thu Feb 10 15:17:05 JST 1994 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto **********************************************************************/ diff --git a/parse.y b/parse.y index 5dbb59c388..6603f51a62 100644 --- a/parse.y +++ b/parse.y @@ -6,7 +6,7 @@ $Date$ created at: Fri May 28 18:02:42 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto **********************************************************************/ @@ -56,8 +56,16 @@ static enum lex_state { EXPR_CLASS, /* immediate after `class', no here document. */ } lex_state; +#if SIZEOF_LONG_LONG > 0 +typedef unsigned long long stack_type; +#elif SIZEOF___INT64 > 0 +typedef unsigned __int64 stack_type; +#else +typedef unsigned long stack_type; +#endif + static int cond_nest = 0; -static unsigned long cond_stack = 0; +static stack_type cond_stack = 0; #define COND_PUSH do {\ cond_nest++;\ cond_stack = (cond_stack<<1)|1;\ @@ -68,17 +76,14 @@ static unsigned long cond_stack = 0; } while (0) #define COND_P() (cond_nest > 0 && (cond_stack&1)) -static int cmdarg_nest = 0; -static unsigned long cmdarg_stack = 0; +static stack_type cmdarg_stack = 0; #define CMDARG_PUSH do {\ - cmdarg_nest++;\ cmdarg_stack = (cmdarg_stack<<1)|1;\ } while(0) #define CMDARG_POP do {\ - cmdarg_nest--;\ cmdarg_stack >>= 1;\ } while (0) -#define CMDARG_P() (cmdarg_nest > 0 && (cmdarg_stack&1)) +#define CMDARG_P() (cmdarg_stack && (cmdarg_stack&1)) static int class_nest = 0; static int in_single = 0; diff --git a/process.c b/process.c index 32c7d57874..de39744d6a 100644 --- a/process.c +++ b/process.c @@ -952,7 +952,7 @@ proc_setuid(obj, id) int uid; uid = NUM2INT(id); -#if defined HAVE_SETRESUID +#if defined(HAVE_SETRESUID) && !defined(__CHECKER__) setresuid(uid, -1, -1); #elif defined HAVE_SETREUID setreuid(uid, -1); @@ -984,7 +984,7 @@ proc_setgid(obj, id) int gid; gid = NUM2INT(id); -#if defined HAVE_SETRESGID +#if defined(HAVE_SETRESGID) && !defined(__CHECKER__) setresgid(gid, -1, -1); #elif defined HAVE_SETREGID setregid(gid, -1); @@ -1013,7 +1013,7 @@ static VALUE proc_seteuid(obj, euid) VALUE obj, euid; { -#if defined HAVE_SETRESUID +#if defined(HAVE_SETRESUID) && !defined(__CHECKER__) if (setresuid(-1, NUM2INT(euid), -1) < 0) rb_sys_fail(0); #elif defined HAVE_SETREUID if (setreuid(-1, NUM2INT(euid)) < 0) rb_sys_fail(0); @@ -1042,7 +1042,7 @@ proc_setegid(obj, egid) VALUE obj, egid; { rb_secure(2); -#if defined HAVE_SETRESGID +#if defined(HAVE_SETRESGID) && !defined(__CHECKER__) if (setresgid(-1, NUM2INT(egid), -1) < 0) rb_sys_fail(0); #elif defined HAVE_SETREGID if (setregid(-1, NUM2INT(egid)) < 0) rb_sys_fail(0); diff --git a/re.c b/re.c index 8a461705f1..865d767813 100644 --- a/re.c +++ b/re.c @@ -5,7 +5,7 @@ $Author$ created at: Mon Aug 9 18:24:49 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto **********************************************************************/ diff --git a/ruby.c b/ruby.c index 6910ff7c2b..2438bd9b99 100644 --- a/ruby.c +++ b/ruby.c @@ -6,7 +6,7 @@ $Date$ created at: Tue Aug 10 12:47:31 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan diff --git a/ruby.h b/ruby.h index 94e13d4fcb..dcbfba4b18 100644 --- a/ruby.h +++ b/ruby.h @@ -5,7 +5,7 @@ $Author$ created at: Thu Jun 10 14:26:32 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan diff --git a/sprintf.c b/sprintf.c index d6bea0c51e..2dd7812254 100644 --- a/sprintf.c +++ b/sprintf.c @@ -6,7 +6,7 @@ $Date$ created at: Fri Oct 15 10:39:26 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan diff --git a/string.c b/string.c index b5f44b9d8b..cb7e86e84c 100644 --- a/string.c +++ b/string.c @@ -6,7 +6,7 @@ $Date$ created at: Mon Aug 9 17:12:58 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan @@ -377,7 +377,6 @@ str_independent(str) rb_raise(rb_eSecurityError, "Insecure: can't modify string"); if (!RSTRING(str)->orig || FL_TEST(str, STR_NO_ORIG)) return 1; if (TYPE(RSTRING(str)->orig) != T_STRING) rb_bug("non string str->orig"); - RSTRING(str)->orig = 0; return 0; } @@ -394,6 +393,7 @@ rb_str_modify(str) } ptr[RSTRING(str)->len] = 0; RSTRING(str)->ptr = ptr; + RSTRING(str)->orig = 0; } VALUE @@ -1294,11 +1294,11 @@ str_gsub(argc, argv, str, bang) OBJSETUP(dup, rb_cString, T_STRING); OBJ_INFECT(dup, str); str = (VALUE)dup; - dup->orig = 0; } RSTRING(str)->ptr = buf; RSTRING(str)->len = len = bp - buf; RSTRING(str)->ptr[len] = '\0'; + RSTRING(str)->orig = 0; if (tainted) OBJ_TAINT(str); return str; diff --git a/version.h b/version.h index 24616540fc..a24ae36bf5 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.7.0" -#define RUBY_RELEASE_DATE "2001-01-23" +#define RUBY_RELEASE_DATE "2001-01-29" #define RUBY_VERSION_CODE 170 -#define RUBY_RELEASE_CODE 20010123 +#define RUBY_RELEASE_CODE 20010129 -- cgit v1.2.3