From a5dcc4437e3354996f8242503d678f0eb5193809 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 26 Dec 2000 08:08:50 +0000 Subject: matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 17 +++++++++++++++++ configure.in | 27 +++++++++++++++++++++++++++ dln.h | 10 ++++------ eval.c | 20 ++++++++++++-------- gc.c | 5 +---- io.c | 4 +++- marshal.c | 2 +- pack.c | 6 +----- parse.y | 7 ++----- process.c | 2 ++ ruby.h | 28 ++++++++++++++++------------ sprintf.c | 2 +- string.c | 8 ++++++-- util.c | 36 ------------------------------------ version.h | 8 ++++---- win32/config.h.in | 2 ++ win32/config.status.in | 2 +- win32/setup.mak | 2 +- 18 files changed, 101 insertions(+), 87 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74bd40d8a4..34cb8a4d08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Tue Dec 26 16:53:55 2000 Yukihiro Matsumoto + + * eval.c (rb_f_binding): recycling should be stopped for outer + scope too. + + * eval.c (proc_new): ditto. + +Mon Dec 25 17:49:08 2000 K.Kosako + + * string.c (rb_str_replace_m): unexpected string share happens if + replace is done for associated (STR_NO_ORIG) string. + +Tue Dec 26 15:01:53 2000 Yukihiro Matsumoto + + * io.c (rb_f_p): should not call rb_io_flush() if rb_defout is not + a IO (T_FILE). + Mon Dec 25 15:52:39 2000 Yukihiro Matsumoto * stable version 1.6.2 released. diff --git a/configure.in b/configure.in index b24f492665..62a21fc750 100644 --- a/configure.in +++ b/configure.in @@ -163,6 +163,33 @@ if test "$rb_cv_have_attr_noreturn" = yes; then AC_DEFINE(HAVE_ATTR_NORETURN) fi +AC_MSG_CHECKING(for inline) +AC_CACHE_VAL(rb_cv_inline, +[AC_TRY_COMPILE([ +extern __inline__ int foo() {return 0;} +static __inline__ char* bar() {return "";} +], [], rb_cv_inline="__inline__", ) +if test "$rb_cv_inline" = ""; then + AC_TRY_COMPILE([ +extern __inline int foo() {return 0;} +static __inline char bar() {return "";} +], [], rb_cv_inline="__inline", ) +fi +if test "$rb_cv_inline" = ""; then + AC_TRY_COMPILE([ +extern inline int foo() {return 0;} +static inline char bar() {return "";} +], [], rb_cv_inline="inline", ) +fi]) +if test "$rb_cv_inline" = ""; then + AC_MSG_RESULT([not work]) + AC_DEFINE(INLINE, /*inline*/) +else + AC_MSG_RESULT($rb_cv_inline) + AC_DEFINE(HAVE_INLINE) + AC_DEFINE_UNQUOTED(INLINE, $rb_cv_inline) +fi + dnl Checks for libraries. case "$target_os" in nextstep*) ;; diff --git a/dln.h b/dln.h index 7e3ab9fabb..940d82c414 100644 --- a/dln.h +++ b/dln.h @@ -13,13 +13,11 @@ #ifndef DLN_H #define DLN_H -#ifndef _ -#ifndef __STDC__ -# define _(args) () -# define const -#else +#undef _ +#ifdef HAVE_PROTOTYPES # define _(args) args -#endif +#else +# define _(args) () #endif char *dln_find_exe _((const char*,const char*)); diff --git a/eval.c b/eval.c index ae2ce62da9..57286486e0 100644 --- a/eval.c +++ b/eval.c @@ -5980,7 +5980,7 @@ static VALUE rb_f_binding(self) VALUE self; { - struct BLOCK *data; + struct BLOCK *data, *p; struct RVarmap *vars; VALUE bind; @@ -6003,9 +6003,11 @@ rb_f_binding(self) data->prev = 0; } - for (vars = data->dyna_vars; vars; vars = vars->next) { - if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break; - FL_SET(vars, DVAR_DONT_RECYCLE); + for (p = data; p; p = p->prev) { + for (vars = p->dyna_vars; vars; vars = vars->next) { + if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break; + FL_SET(vars, DVAR_DONT_RECYCLE); + } } scope_dup(data->scope); POP_BLOCK(); @@ -6063,7 +6065,7 @@ proc_new(klass) VALUE klass; { volatile VALUE proc; - struct BLOCK *data; + struct BLOCK *data, *p; struct RVarmap *vars; if (!rb_block_given_p() && !rb_f_block_given_p()) { @@ -6085,9 +6087,11 @@ proc_new(klass) } data->flags |= BLOCK_DYNAMIC; - for (vars = data->dyna_vars; vars; vars = vars->next) { - if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break; - FL_SET(vars, DVAR_DONT_RECYCLE); + for (p = data; p; p = p->prev) { + for (vars = p->dyna_vars; vars; vars = vars->next) { + if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break; + FL_SET(vars, DVAR_DONT_RECYCLE); + } } scope_dup(data->scope); proc_save_safe_level(proc); diff --git a/gc.c b/gc.c index a3578aef2f..0460cf553c 100644 --- a/gc.c +++ b/gc.c @@ -308,10 +308,7 @@ rb_data_object_alloc(klass, datap, dmark, dfree) extern st_table *rb_class_tbl; VALUE *rb_gc_stack_start = 0; -#if defined(__GNUC__) && __GNUC__ >= 2 -__inline__ -#endif -static int +static INLINE int is_pointer_to_heap(ptr) void *ptr; { diff --git a/io.c b/io.c index a422cc0869..8dcf258af9 100644 --- a/io.c +++ b/io.c @@ -2156,7 +2156,9 @@ rb_f_p(argc, argv) for (i=0; i= 2 && !defined(RUBY_NO_INLINE) -static __inline__ int -#else -static int -#endif +static INLINE int hex2num(c) char c; { diff --git a/parse.y b/parse.y index d1f1a32321..da7bba3578 100644 --- a/parse.y +++ b/parse.y @@ -2043,10 +2043,7 @@ rb_compile_file(f, file, start) return yycompile(strdup(f), start); } -#if defined(__GNUC__) && __GNUC__ >= 2 -__inline__ -#endif -static int +static INLINE int nextc() { int c; @@ -2794,7 +2791,7 @@ arg_ambiguous() rb_warning("ambiguous first argument; make sure"); } -#ifndef strtod +#if !defined(strtod) && !defined(HAVE_STDLIB_H) double strtod (); #endif diff --git a/process.c b/process.c index 3537841d43..90153977b8 100644 --- a/process.c +++ b/process.c @@ -234,7 +234,9 @@ proc_waitpid2(argc, argv) return rb_assoc_new(pid, rb_last_status); } +#ifndef HAVE_STRING_H char *strtok(); +#endif #ifdef HAVE_SETITIMER #define before_exec() rb_thread_stop_timer() diff --git a/ruby.h b/ruby.h index ca97ee2c42..9784fc65d2 100644 --- a/ruby.h +++ b/ruby.h @@ -541,12 +541,15 @@ EXTERN VALUE rb_eNameError; EXTERN VALUE rb_eSyntaxError; EXTERN VALUE rb_eLoadError; -#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(RUBY_NO_INLINE) -extern __inline__ VALUE rb_class_of _((VALUE)); -extern __inline__ int rb_type _((VALUE)); -extern __inline__ int rb_special_const_p _((VALUE)); +extern INLINE VALUE rb_class_of _((VALUE)); +extern INLINE int rb_type _((VALUE)); +extern INLINE int rb_special_const_p _((VALUE)); -extern __inline__ VALUE +#if defined(HAVE_INLINE) || defined(RUBY_NO_INLINE) +#ifndef RUBY_NO_INLINE +extern +#endif +INLINE VALUE rb_class_of(VALUE obj) { if (FIXNUM_P(obj)) return rb_cFixnum; @@ -558,7 +561,10 @@ rb_class_of(VALUE obj) return RBASIC(obj)->klass; } -extern __inline__ int +#ifndef RUBY_NO_INLINE +extern +#endif +INLINE int rb_type(VALUE obj) { if (FIXNUM_P(obj)) return T_FIXNUM; @@ -570,17 +576,15 @@ rb_type(VALUE obj) return BUILTIN_TYPE(obj); } -extern __inline__ int +#ifndef RUBY_NO_INLINE +extern +#endif +INLINE int rb_special_const_p(VALUE obj) { if (SPECIAL_CONST_P(obj)) return Qtrue; return Qfalse; } - -#else -VALUE rb_class_of _((VALUE)); -int rb_type _((VALUE)); -int rb_special_const_p _((VALUE)); #endif #include "intern.h" diff --git a/sprintf.c b/sprintf.c index 756de87ed9..cb567315ba 100644 --- a/sprintf.c +++ b/sprintf.c @@ -18,7 +18,7 @@ #define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */ -#ifndef atof +#if !defined(atof) && !defined(HAVE_STDLIB_H) double strtod(); #endif diff --git a/string.c b/string.c index ddf50e2eed..5edac14e66 100644 --- a/string.c +++ b/string.c @@ -1316,15 +1316,19 @@ static VALUE rb_str_replace_m(str, str2) VALUE str, str2; { + if (str == str2) return str; if (TYPE(str2) != T_STRING) str2 = rb_str_to_str(str2); - rb_str_modify(str); - if (RSTRING(str2)->orig && FL_TEST(str2, STR_NO_ORIG)) { + if (RSTRING(str2)->orig && !FL_TEST(str2, STR_NO_ORIG)) { + if (str_independent(str)) { + free(RSTRING(str)->ptr); + } RSTRING(str)->len = RSTRING(str2)->len; RSTRING(str)->ptr = RSTRING(str2)->ptr; RSTRING(str)->orig = RSTRING(str2)->orig; } else { + rb_str_modify(str); rb_str_resize(str, RSTRING(str2)->len); memcpy(RSTRING(str)->ptr, RSTRING(str2)->ptr, RSTRING(str2)->len); } diff --git a/util.c b/util.c index 9cbfb5fc74..25c00ae2d6 100644 --- a/util.c +++ b/util.c @@ -19,42 +19,6 @@ #define RUBY_NO_INLINE #include "ruby.h" -VALUE -rb_class_of(obj) - VALUE obj; -{ - if (FIXNUM_P(obj)) return rb_cFixnum; - if (obj == Qnil) return rb_cNilClass; - if (obj == Qfalse) return rb_cFalseClass; - if (obj == Qtrue) return rb_cTrueClass; - if (SYMBOL_P(obj)) return rb_cSymbol; - - return RBASIC(obj)->klass; -} - -int -rb_type(obj) - VALUE obj; -{ - if (FIXNUM_P(obj)) return T_FIXNUM; - if (obj == Qnil) return T_NIL; - if (obj == Qfalse) return T_FALSE; - if (obj == Qtrue) return T_TRUE; - if (obj == Qundef) return T_UNDEF; - if (SYMBOL_P(obj)) return T_SYMBOL; - - return BUILTIN_TYPE(obj); -} - -int -rb_special_const_p(obj) - VALUE obj; -{ - if (SPECIAL_CONST_P(obj)) return Qtrue; - - return Qfalse; -} - #include "util.h" #ifndef HAVE_STRING_H char *strchr _((char*,char)); diff --git a/version.h b/version.h index 71d484b8fd..5d1bd51c61 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ -#define RUBY_VERSION "1.6.2" -#define RUBY_RELEASE_DATE "2000-12-25" -#define RUBY_VERSION_CODE 162 -#define RUBY_RELEASE_CODE 20001225 +#define RUBY_VERSION "1.7.0" +#define RUBY_RELEASE_DATE "2000-12-26" +#define RUBY_VERSION_CODE 170 +#define RUBY_RELEASE_CODE 20001226 diff --git a/win32/config.h.in b/win32/config.h.in index a7e28120e6..149faf7d8c 100644 --- a/win32/config.h.in +++ b/win32/config.h.in @@ -1,6 +1,8 @@ #define HAVE_PROTOTYPES 1 #define HAVE_STDARG_PROTOTYPES 1 /* #define HAVE_ATTR_NORETURN 1 */ +#define HAVE_INLINE 1 +#define INLINE __inline /* #define HAVE_DIRENT_H 1 */ /* #define HAVE_UNISTD_H 1 */ #define HAVE_STDLIB_H 1 diff --git a/win32/config.status.in b/win32/config.status.in index 461877b886..598eb792fe 100644 --- a/win32/config.status.in +++ b/win32/config.status.in @@ -4,7 +4,7 @@ s%@CPPFLAGS@%%g s%@CXXFLAGS@%%g s%@FFLAGS@%%g s%@DEFS@% - -DUSE_THREAD -DSIZEOF_INT=4 -DSIZEOF_SHORT=2 -DSIZEOF_LONG=4 -DSIZEOF_VOIDP=4 -DSIZEOF_FLOAT=4 -DSIZEOF_DOUBLE=8 -DHAVE_PROTOTYPES=1 -DHAVE_STDARG_PROTOTYPES=1 -DHAVE_STDLIB_H=1 -DHAVE_LIMITS_H=1 -DHAVE_FCNTL_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ST_RDEV=1 -DGETGROUPS_T=int -DRETSIGTYPE=void -DHAVE_ALLOCA=1 -DHAVE_FMOD=1 -DHAVE_WAITPID=1 -DHAVE_GETCWD=1 -DHAVE_CHSIZE=1 -DHAVE_GETGROUPS=1 -DHAVE_GETLOGIN=1 -DRSHIFT=\(x,y\)\ \(\(x\)\>\>y\) -DFILE_COUNT=_cnt -DDLEXT=\".so\" -DDLEXT2=\".dll\" -DRUBY_PLATFORM=\"i586-mswin32\" %g + -DUSE_THREAD -DSIZEOF_INT=4 -DSIZEOF_SHORT=2 -DSIZEOF_LONG=4 -DSIZEOF_VOIDP=4 -DSIZEOF_FLOAT=4 -DSIZEOF_DOUBLE=8 -DHAVE_PROTOTYPES=1 -DHAVE_STDARG_PROTOTYPES=1 -DHAVE_INLINE=1 -DINLINE=__inline -DHAVE_STDLIB_H=1 -DHAVE_LIMITS_H=1 -DHAVE_FCNTL_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ST_RDEV=1 -DGETGROUPS_T=int -DRETSIGTYPE=void -DHAVE_ALLOCA=1 -DHAVE_FMOD=1 -DHAVE_WAITPID=1 -DHAVE_GETCWD=1 -DHAVE_CHSIZE=1 -DHAVE_GETGROUPS=1 -DHAVE_GETLOGIN=1 -DRSHIFT=\(x,y\)\ \(\(x\)\>\>y\) -DFILE_COUNT=_cnt -DDLEXT=\".so\" -DDLEXT2=\".dll\" -DRUBY_PLATFORM=\"i586-mswin32\" %g s%@LDFLAGS@%-nologo%g s%@LIBS@%user32.lib advapi32.lib wsock32.lib%g s%@exec_prefix@%${prefix}%g diff --git a/win32/setup.mak b/win32/setup.mak index 6bca4419b1..dce77e896c 100644 --- a/win32/setup.mak +++ b/win32/setup.mak @@ -18,7 +18,7 @@ Makefile: @echo ### makefile for ruby $(OS) ###> $@ @echo srcdir = $(srcdir:\=/)>> $@ @echo RUBY_INSTALL_NAME = ruby>> $@ - @echo RUBY_SO_NAME = $(OS)-$$(RUBY_INSTALL_NAME)16>> $@ + @echo RUBY_SO_NAME = $(OS)-$$(RUBY_INSTALL_NAME)17>> $@ @echo !INCLUDE $$(srcdir)/win32/Makefile.sub>> $@ config.h config.status: $(srcdir)/win32/$$@.in -- cgit v1.2.3