summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--configure.in19
-rw-r--r--eval.c2
-rw-r--r--ext/dbm/dbm.c9
-rw-r--r--ext/gdbm/gdbm.c9
-rw-r--r--ext/sdbm/init.c9
-rw-r--r--io.c1
-rw-r--r--re.c2
-rw-r--r--string.c6
-rw-r--r--time.c16
-rw-r--r--version.h4
11 files changed, 71 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 31640b724da..d7fcb7f0abf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+Fri Jun 16 05:18:45 2000 Yasuhiro Fukuma <yasuf@bsdclub.org>
+
+ * configure.in: FreeBSD: do not link dummy libxpg4 which was
+ merged into libc.
+
+Fri Jun 16 03:17:36 2000 Satoshi Nojo <nojo@t-samukawa.or.jp>
+
+ * ext/dbm/dbm.c (fdbm_length): use GetDBM. empty?, [] too.
+
+ * ext/gdbm/gdbm.c (fgdbm_length): ditto.
+
+ * ext/sdbm/init.c (fsdbm_length): ditto.
+
+Fri Jun 16 01:57:31 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_sleep_forever): pause(2) instead of sleep(3).
+
+Thu Jun 15 10:46:36 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * string.c (rb_str_sub_bang): should probagate taintness from
+ replacement string.
+
Wed Jun 14 17:01:41 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
* rubytest.rb: add CONFIG['EXEEXT'] to the executable file name.
diff --git a/configure.in b/configure.in
index 03d8f7980e6..6cb2b47b142 100644
--- a/configure.in
+++ b/configure.in
@@ -168,14 +168,29 @@ mingw*) LIBS="-lwsock32 -lmsvcrt $LIBS"
ac_cv_header_sys_select_h=no
ac_cv_header_sys_times_h=no;;
os2_emx*) LIBS="-lm $LIBS"
- ac_cv_lib_xpg4_setlocale=no
ac_cv_lib_dir_opendir=no;;
+freebsd*) LIBS="-lm $LIBS"
+ AC_CACHE_CHECK([whether -lxpg4 has to be linked],
+ rb_cv_lib_xpg4_needed,
+ [AC_TRY_CPP([
+#include <osreldate.h>
+#if __FreeBSD_version < 400020 || \
+ (__FreeBSD_version >= 500000 && __FreeBSD_version < 500005)
+#error needs libxpg4
+#endif
+ ],
+ rb_cv_lib_xpg4_needed=no,
+ rb_cv_lib_xpg4_needed=yes,
+ rb_cv_lib_xpg4_needed=yes)])
+ if test "$rb_cv_lib_xpg4_needed" = yes; then
+ AC_CHECK_LIB(xpg4, setlocale)
+ fi
+ ;;
*) LIBS="-lm $LIBS";;
esac
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
-AC_CHECK_LIB(xpg4, setlocale) # FreeBSD needs this
dnl Checks for header files.
AC_HEADER_DIRENT
diff --git a/eval.c b/eval.c
index f886db1215c..fab7a9ee57b 100644
--- a/eval.c
+++ b/eval.c
@@ -7251,7 +7251,7 @@ rb_thread_sleep_forever()
{
if (curr_thread == curr_thread->next) {
TRAP_BEG;
- sleep((32767L<<16)+32767);
+ pause();
TRAP_END;
return;
}
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index c9566847571..3bf674bc93e 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -98,8 +98,7 @@ fdbm_close(obj)
{
struct dbmdata *dbmp;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
- if (dbmp->di_dbm == 0) closed_dbm();
+ GetDBM(obj, dbmp);
dbm_close(dbmp->di_dbm);
dbmp->di_dbm = 0;
@@ -321,7 +320,7 @@ fdbm_store(obj, keystr, valstr)
val.dptr = RSTRING(valstr)->ptr;
val.dsize = RSTRING(valstr)->len;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
dbmp->di_size = -1;
dbm = dbmp->di_dbm;
if (dbm_store(dbm, key, val, DBM_REPLACE)) {
@@ -344,7 +343,7 @@ fdbm_length(obj)
DBM *dbm;
int i = 0;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
if (dbmp->di_size > 0) return INT2FIX(dbmp->di_size);
dbm = dbmp->di_dbm;
@@ -365,7 +364,7 @@ fdbm_empty_p(obj)
DBM *dbm;
int i = 0;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
if (dbmp->di_size < 0) {
dbm = dbmp->di_dbm;
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index 044a9908b6e..6385e487690 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -95,8 +95,7 @@ fgdbm_close(obj)
{
struct dbmdata *dbmp;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
- if (dbmp->di_dbm == 0) closed_dbm();
+ GetDBM(obj, dbmp);
gdbm_close(dbmp->di_dbm);
dbmp->di_dbm = 0;
@@ -319,7 +318,7 @@ fgdbm_store(obj, keystr, valstr)
val.dptr = RSTRING(valstr)->ptr;
val.dsize = RSTRING(valstr)->len;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
dbmp->di_size = -1;
dbm = dbmp->di_dbm;
if (gdbm_store(dbm, key, val, GDBM_REPLACE)) {
@@ -339,7 +338,7 @@ fgdbm_length(obj)
GDBM_FILE dbm;
int i = 0;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
if (dbmp->di_size > 0) return INT2FIX(dbmp->di_size);
dbm = dbmp->di_dbm;
@@ -360,7 +359,7 @@ fgdbm_empty_p(obj)
GDBM_FILE dbm;
int i = 0;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
if (dbmp->di_size < 0) {
dbm = dbmp->di_dbm;
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c
index 1e1d5a5868d..ddbf384b24f 100644
--- a/ext/sdbm/init.c
+++ b/ext/sdbm/init.c
@@ -92,8 +92,7 @@ fsdbm_close(obj)
{
struct dbmdata *dbmp;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
- if (dbmp->di_dbm == 0) closed_sdbm();
+ GetDBM(obj, dbmp);
sdbm_close(dbmp->di_dbm);
dbmp->di_dbm = 0;
@@ -322,7 +321,7 @@ fsdbm_store(obj, keystr, valstr)
val.dptr = RSTRING(valstr)->ptr;
val.dsize = RSTRING(valstr)->len;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
dbmp->di_size = -1;
dbm = dbmp->di_dbm;
if (sdbm_store(dbm, key, val, DBM_REPLACE)) {
@@ -345,7 +344,7 @@ fsdbm_length(obj)
DBM *dbm;
int i = 0;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
if (dbmp->di_size > 0) return INT2FIX(dbmp->di_size);
dbm = dbmp->di_dbm;
@@ -366,7 +365,7 @@ fsdbm_empty_p(obj)
DBM *dbm;
int i = 0;
- Data_Get_Struct(obj, struct dbmdata, dbmp);
+ GetDBM(obj, dbmp);
if (dbmp->di_size < 0) {
dbm = dbmp->di_dbm;
diff --git a/io.c b/io.c
index a2dca1a4a01..9f6631dfbf9 100644
--- a/io.c
+++ b/io.c
@@ -1799,6 +1799,7 @@ io_reopen(io, nfile)
fptr->f = rb_fdopen(fd, mode);
if (orig->mode & FMODE_READABLE && pos >= 0) {
fseek(fptr->f, pos, SEEK_SET);
+ fseek(orig->f, pos, SEEK_SET);
}
}
diff --git a/re.c b/re.c
index 57bbb7207d4..6f4dcc2ff21 100644
--- a/re.c
+++ b/re.c
@@ -1355,6 +1355,7 @@ Init_Regexp()
rb_define_singleton_method(rb_cRegexp, "compile", rb_reg_s_new, -1);
rb_define_singleton_method(rb_cRegexp, "quote", rb_reg_s_quote, -1);
rb_define_singleton_method(rb_cRegexp, "escape", rb_reg_s_quote, -1);
+ rb_define_singleton_method(rb_cRegexp, "last_match", match_getter, 0);
rb_define_method(rb_cRegexp, "initialize", rb_reg_initialize_m, -1);
rb_define_method(rb_cRegexp, "clone", rb_reg_clone, 0);
@@ -1367,7 +1368,6 @@ Init_Regexp()
rb_define_method(rb_cRegexp, "source", rb_reg_source, 0);
rb_define_method(rb_cRegexp, "casefold?", rb_reg_casefold_p, 0);
rb_define_method(rb_cRegexp, "kcode", rb_reg_kcode_m, 0);
- rb_define_method(rb_cRegexp, "last_match", match_getter, 0);
rb_define_const(rb_cRegexp, "IGNORECASE", INT2FIX(RE_OPTION_IGNORECASE));
rb_define_const(rb_cRegexp, "EXTENDED", INT2FIX(RE_OPTION_EXTENDED));
diff --git a/string.c b/string.c
index d5de27864f8..f547323a58b 100644
--- a/string.c
+++ b/string.c
@@ -1087,6 +1087,7 @@ rb_str_sub_bang(argc, argv, str)
VALUE pat, repl, match;
struct re_registers *regs;
int iter = 0;
+ int tainted = 0;
long plen;
if (argc == 1 && rb_block_given_p()) {
@@ -1094,6 +1095,7 @@ rb_str_sub_bang(argc, argv, str)
}
else if (argc == 2) {
repl = rb_obj_as_string(argv[1]);;
+ if (OBJ_TAINTED(repl)) tainted = 1;
}
else {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)", argc);
@@ -1113,6 +1115,7 @@ rb_str_sub_bang(argc, argv, str)
else {
repl = rb_reg_regsub(repl, str, regs);
}
+ if (OBJ_TAINTED(repl)) tainted = 1;
plen = END(0) - BEG(0);
if (RSTRING(repl)->len > plen) {
REALLOC_N(RSTRING(str)->ptr, char,
@@ -1127,7 +1130,8 @@ rb_str_sub_bang(argc, argv, str)
RSTRING(repl)->ptr, RSTRING(repl)->len);
RSTRING(str)->len += RSTRING(repl)->len - plen;
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
- OBJ_INFECT(str, repl);
+ if (tainted) OBJ_TAINT(str);
+
return str;
}
return Qnil;
diff --git a/time.c b/time.c
index 6fd2fee19b0..5c3dcaebf50 100644
--- a/time.c
+++ b/time.c
@@ -314,17 +314,22 @@ make_time_t(tptr, utc_or_local)
if (!utc_or_local) { /* localtime zone adjust */
#if defined(HAVE_TM_ZONE)
tm = localtime(&guess);
+ if (!tm) goto error;
guess -= tm->tm_gmtoff;
#else
struct tm gt, lt;
long tzsec;
t = 0;
- gt = *gmtime(&guess);
- lt = *localtime(&guess);
+ tm = gmtime(&guess);
+ if (!tm) goto error;
+ gt = *tm;
+ tm = localtime(&guess);
+ if (!tm) goto error;
+ lt = *tm;
tzsec = (gt.tm_min-lt.tm_min)*60 + (gt.tm_hour-lt.tm_hour)*3600;
- if(lt.tm_year > gt.tm_year) {
+ if (lt.tm_year > gt.tm_year) {
tzsec -= 24*3600;
}
else if(gt.tm_year > lt.tm_year) {
@@ -334,18 +339,17 @@ make_time_t(tptr, utc_or_local)
tzsec += (gt.tm_yday - lt.tm_yday)*24*3600;
}
- if (lt.tm_isdst) tzsec += 3600;
-
+ if (lt.tm_isdst) guess += 3600;
guess += tzsec;
if (guess < 0) {
goto out_of_range;
}
+#endif
tm = localtime(&guess);
if (!tm) goto error;
if (tm->tm_hour != tptr->tm_hour) {
guess -= 3600;
}
-#endif
if (guess < 0) {
goto out_of_range;
}
diff --git a/version.h b/version.h
index 22df0521806..c60e74ae9c7 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.4"
-#define RUBY_RELEASE_DATE "2000-06-14"
+#define RUBY_RELEASE_DATE "2000-06-16"
#define RUBY_VERSION_CODE 154
-#define RUBY_RELEASE_CODE 20000614
+#define RUBY_RELEASE_CODE 20000616