1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

2000-03-08

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-03-08 06:25:19 +00:00
parent 58e68a3660
commit 33f7442e0f
9 changed files with 128 additions and 14 deletions

View file

@ -1,3 +1,22 @@
Wed Mar 8 02:08:43 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* parse.y: escape expansion too early.
* regex.c (re_compile_pattern): support \cX et al.
Mon Mar 6 12:28:37 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* ext/socket/socket.c (ip_addrsetup): should check length of hostname.
* ext/socket/socket.c (ip_addrsetup): check newline at the end of
hostname. These fixes suggested by Muvaw Pnazte <bugathlon@yahoo.com>.
Sun Mar 5 20:35:45 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* ext/Win32API/Win32API.c (Win32API_initialize): should call
LoadLibrary() everytime and should assign the hdll to Win32API
object(protect the hdll from GC).
Sat Feb 26 22:39:31 2000 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
* Fix String#* with huge string.

21
eval.c
View file

@ -4170,6 +4170,27 @@ rb_funcall3(recv, mid, argc, argv)
return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 0);
}
VALUE
rb_call_super(argc, argv)
int argc;
VALUE *argv;
{
VALUE result;
if (ruby_frame->last_class == 0) {
rb_raise(rb_eNameError, "superclass method `%s' must be enabled by rb_enable_super()",
rb_id2name(ruby_frame->last_func));
}
PUSH_ITER(ruby_iter->iter?ITER_PRE:ITER_NOT);
result = rb_call(RCLASS(ruby_frame->last_class)->super,
ruby_frame->self, ruby_frame->last_func,
argc, argv, 3);
POP_ITER();
return result;
}
static VALUE
backtrace(lev)
int lev;

View file

@ -52,13 +52,10 @@ Win32API_initialize(self, dllname, proc, import, export)
int len;
int ex;
hdll = GetModuleHandle(RSTRING(dllname)->ptr);
if (!hdll) {
hdll = LoadLibrary(RSTRING(dllname)->ptr);
if (!hdll)
rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
Data_Wrap_Struct(self, 0, Win32API_FreeLibrary, hdll);
}
hdll = LoadLibrary(RSTRING(dllname)->ptr);
if (!hdll)
rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
rb_iv_set(self, "__hdll__", Data_Wrap_Struct(self, 0, Win32API_FreeLibrary, hdll));
hproc = GetProcAddress(hdll, RSTRING(proc)->ptr);
if (!hproc) {
str = rb_str_new3(proc);

View file

@ -522,6 +522,9 @@ ip_addrsetup(host, port)
else if (name[0] == '<' && strcmp(name, "<broadcast>") == 0) {
mkinetaddr(INADDR_BROADCAST, hbuf, sizeof(hbuf));
}
else if (strlen(name) > sizeof(hbuf)-1) {
rb_raise(rb_eSocket, "hostname too long (%d)", strlen(name));
}
else {
strcpy(hbuf, name);
}
@ -543,6 +546,9 @@ ip_addrsetup(host, port)
hints.ai_socktype = SOCK_DGRAM;
error = getaddrinfo(hostp, portp, &hints, &res);
if (error) {
if (hostp && hostp[strlen(hostp)-1] == '\n') {
rb_raise(rb_eSocket, "newline at the end of hostname");
}
rb_raise(rb_eSocket, "%s", gai_strerror(error));
}

1
node.h
View file

@ -315,7 +315,6 @@ typedef struct RNode {
#define NEW_POSTEXE() rb_node_newnode(NODE_POSTEXE,0,0,0)
NODE *rb_node_newnode();
VALUE rb_method_booundp();
#define NOEX_PUBLIC 0
#define NOEX_UNDEF 1

13
parse.y
View file

@ -3422,9 +3422,16 @@ rb_str_extend(list, term)
tokadd(c);
goto loop_again;
case '\\':
c = read_escape();
tokadd(c);
goto loop_again;
c = nextc();
if (c == -1) return (NODE*)-1;
if (c == term) {
tokadd(c);
}
else {
tokadd('\\');
tokadd(c);
}
break;
case '{':
if (brace != -1) nest++;
case '\"':

66
regex.c
View file

@ -1048,7 +1048,7 @@ calculate_must_string(start, end)
return must;
}
static int
static unsigned int
read_backslash(c)
int c;
{
@ -1080,6 +1080,47 @@ read_backslash(c)
return c;
}
static unsigned int
read_special(p, pend, pp)
const char *p, *pend, **pp;
{
int c;
PATFETCH_RAW(c);
switch (c) {
case 'M':
PATFETCH_RAW(c);
if (c != '-') return -1;
PATFETCH_RAW(c);
*pp = p;
if (c == '\\') {
return read_special(p, pend, pp) | 0x80;
}
else if (c == -1) return ~0;
else {
return ((c & 0xff) | 0x80);
}
case 'C':
PATFETCH_RAW(c);
if (c != '-') return ~0;
case 'c':
PATFETCH_RAW(c);
*pp = p;
if (c == '\\') {
c = read_special(p, pend, pp);
}
else if (c == '?') return 0177;
else if (c == -1) return ~0;
return c & 0x9f;
default:
return read_backslash(c);
}
end_of_pattern:
return ~0;
}
/* re_compile_pattern takes a regular-expression string
and converts it into a buffer full of byte commands for matching.
@ -1451,6 +1492,16 @@ re_compile_pattern(pattern, size, bufp)
had_num_literal = 1;
break;
case 'M':
case 'C':
case 'c':
p0 = --p;
c = read_special(p, pend, &p0);
if (c > 255) goto invalid_escape;
p = p0;
had_num_literal = 1;
break;
default:
c = read_backslash(c);
if (ismbchar(c)) {
@ -2137,6 +2188,16 @@ re_compile_pattern(pattern, size, bufp)
BUFPUSH(c1);
break;
case 'M':
case 'C':
case 'c':
p0 = --p;
c = read_special(p, pend, &p0);
if (c > 255) goto invalid_escape;
p = p0;
had_num_literal = 1;
goto numeric_char;
default:
c = read_backslash(c);
goto normal_char;
@ -2299,6 +2360,9 @@ re_compile_pattern(pattern, size, bufp)
nested_meta:
FREE_AND_RETURN(stackb, "nested *?+ in regexp");
invalid_escape:
FREE_AND_RETURN(stackb, "Invalid escape character syntax");
}
void

View file

@ -262,6 +262,7 @@ rb_str_times(str, times)
long i, len;
len = NUM2LONG(times);
if (len == 0) return rb_str_new(0,0);
if (len < 0) {
rb_raise(rb_eArgError, "negative argument");
}

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.4.4"
#define RUBY_RELEASE_DATE "2000-03-02"
#define RUBY_RELEASE_DATE "2000-03-08"
#define RUBY_VERSION_CODE 144
#define RUBY_RELEASE_CODE 20000302
#define RUBY_RELEASE_CODE 20000308