diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-24 07:19:34 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-24 07:19:34 +0000 |
commit | 491cfd93f758330b1c36e6797129006b776532e8 (patch) | |
tree | 94d3897c42c13bda0c5cfa1cb3de05d5cf98ba03 | |
parent | 6d19b9b4191c86968e547bd121d2472f72150cc2 (diff) |
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | configure | 1 | ||||
-rw-r--r-- | eval.c | 3 | ||||
-rw-r--r-- | ext/md5/md5init.c | 1 | ||||
-rw-r--r-- | file.c | 11 | ||||
-rw-r--r-- | hash.c | 4 | ||||
-rw-r--r-- | io.c | 61 | ||||
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | process.c | 3 | ||||
-rw-r--r-- | re.c | 4 | ||||
-rw-r--r-- | string.c | 4 | ||||
-rw-r--r-- | version.h | 8 |
12 files changed, 82 insertions, 44 deletions
@@ -1,5 +1,29 @@ +Sun Jul 23 12:55:04 2000 Dave Thomas <Dave@Thomases.com> + + * string.c (rb_str_rindex): Support negative end position. + +Fri Jul 21 17:35:01 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * process.c (proc_getpriority): getpriority(2) may return valid + negative number. use errno to detect error. + +Sat Jul 15 01:32:34 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * eval.c (Init_eval): should prohibit `include' and + `module_function' for class Class. The latter was very + dangerous. + Fri Jul 14 12:49:50 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + * io.c (argf_eof): need to check stdin, when next_p == -1. + + * io.c (read_all): use io_fread() instead of fread(3). + + * io.c (io_reopen): should clearerr FILE if fd < 3. + + * re.c (rb_reg_match_m): the result is exported, so it should be + declared as busy. + * eval.c (rb_eval): should preserve errinfo even if return, break, etc. is called in rescue clause. @@ -515,6 +515,7 @@ else > $cache_file fi +echo $CC ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' @@ -5394,6 +5394,9 @@ Init_eval() rb_define_method(rb_cModule, "module_eval", rb_mod_module_eval, -1); rb_define_method(rb_cModule, "class_eval", rb_mod_module_eval, -1); + rb_undef_method(rb_cClass, "include"); + rb_undef_method(rb_cClass, "module_function"); + rb_define_private_method(rb_cModule, "remove_method", rb_mod_remove_method, 1); rb_define_private_method(rb_cModule, "undef_method", rb_mod_undef_method, 1); rb_define_private_method(rb_cModule, "alias_method", rb_mod_alias_method, 2); diff --git a/ext/md5/md5init.c b/ext/md5/md5init.c index 7d17835a93..eeee5e358f 100644 --- a/ext/md5/md5init.c +++ b/ext/md5/md5init.c @@ -106,6 +106,7 @@ Init_md5() cMD5 = rb_define_class("MD5", rb_cObject); rb_define_singleton_method(cMD5, "new", md5_new, -1); + rb_define_singleton_method(cMD5, "md5", md5_new, -1); rb_define_method(cMD5, "update", md5_update, 1); rb_define_method(cMD5, "digest", md5_digest, 0); @@ -58,10 +58,13 @@ char *strrchr _((const char*,const char)); #include <sys/stat.h> #ifdef USE_CWGUSI - #include "macruby_missing.h" - extern int fileno(FILE *stream); - extern int utimes(); - char* strdup(char*); +#include "macruby_missing.h" +extern int fileno(FILE *stream); +extern int utimes(); +#endif + +#ifndef strdup +char *strdup(); #endif #ifdef __EMX__ @@ -22,8 +22,8 @@ char *strchr _((char*,char)); #endif -#ifdef USE_CWGUSI -char* strdup(const char*); +#ifndef strdup +char *strdup(); #endif #define HASH_FREEZE FL_USER1 @@ -382,6 +382,32 @@ rb_io_to_io(io) /* reading functions */ +static size_t +io_fread(ptr, len, f) + char *ptr; + size_t len; + FILE *f; +{ + size_t n = len; + int c; + + while (n--) { + if (!READ_DATA_PENDING(f)) { + rb_thread_wait_fd(fileno(f)); + } + TRAP_BEG; + c = getc(f); + TRAP_END; + if (c == EOF) { + *ptr = '\0'; + break; + } + *ptr++ = c; + } + + return len - n - 1; +} + #ifndef S_ISREG # define S_ISREG(m) ((m & S_IFMT) == S_IFREG) #endif @@ -421,11 +447,9 @@ read_all(port) } } str = rb_str_new(0, siz); + READ_CHECK(fptr->f); for (;;) { - READ_CHECK(fptr->f); - TRAP_BEG; - n = fread(RSTRING(str)->ptr+bytes, 1, siz-bytes, fptr->f); - TRAP_END; + n = io_fread(RSTRING(str)->ptr+bytes, siz-bytes, fptr->f); if (n == 0 && bytes == 0) { if (feof(fptr->f)) return Qnil; rb_sys_fail(fptr->path); @@ -442,32 +466,6 @@ read_all(port) return str; } -static size_t -io_fread(ptr, len, f) - char *ptr; - size_t len; - FILE *f; -{ - size_t n = len; - int c; - - while (n--) { - if (!READ_DATA_PENDING(f)) { - rb_thread_wait_fd(fileno(f)); - } - TRAP_BEG; - c = getc(f); - TRAP_END; - if (c == EOF) { - *ptr = '\0'; - break; - } - *ptr++ = c; - } - - return len - n - 1; -} - static VALUE io_read(argc, argv, io) int argc; @@ -1727,6 +1725,7 @@ rb_io_reopen(io, nfile) mode = rb_io_mode_string(fptr); fd = fileno(fptr->f); if (fd < 3) { + clearerr(fptr->f); /* need to keep stdio */ if (dup2(fileno(orig->f), fd) < 0) rb_sys_fail(orig->path); @@ -3087,8 +3086,6 @@ argf_eof() { if (init_p == 0 && !next_argv()) return Qtrue; - if (next_p == -1) - return Qtrue; if (TYPE(current_file) != T_FILE) { return argf_forward(); } @@ -2093,6 +2093,8 @@ tokadd_escape() int numlen; scan_hex(lex_p, 2, &numlen); + tokadd('\\'); + tokadd('x'); while (numlen--) tokadd(nextc()); } @@ -864,8 +864,9 @@ proc_getpriority(obj, which, who) iwhich = NUM2INT(which); iwho = NUM2INT(who); + errno = 0; prio = getpriority(iwhich, iwho); - if (prio < 0) rb_sys_fail(0); + if (errno) rb_sys_fail(0); return INT2FIX(prio); #else rb_notimplement(); @@ -907,7 +907,9 @@ rb_reg_match_method(re, str) VALUE result = rb_reg_match(re, str); if (NIL_P(result)) return Qnil; - return rb_backref_get(); + result = rb_backref_get(); + rb_match_busy(result, Qtrue); + return result; } static VALUE @@ -632,6 +632,10 @@ rb_str_rindex(argc, argv, str) if (rb_scan_args(argc, argv, "11", &sub, &position) == 2) { pos = NUM2INT(position); + if (pos < 0) { + pos += RSTRING(str)->len; + if (pos < 0) return Qnil; + } if (pos > RSTRING(str)->len) pos = RSTRING(str)->len; } else { @@ -1,4 +1,4 @@ -#define RUBY_VERSION "1.4.5" -#define RUBY_RELEASE_DATE "2000-06-26" -#define RUBY_VERSION_CODE 145 -#define RUBY_RELEASE_CODE 20000626 +#define RUBY_VERSION "1.4.6" +#define RUBY_RELEASE_DATE "2000-07-21" +#define RUBY_VERSION_CODE 146 +#define RUBY_RELEASE_CODE 20000721 |