summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--ext/extmk.rb.nt1
-rw-r--r--ext/readline/readline.c2
-rw-r--r--ext/socket/socket.c55
-rw-r--r--lib/mkmf.rb1
-rw-r--r--regex.c16
-rw-r--r--regex.h4
7 files changed, 25 insertions, 58 deletions
diff --git a/ChangeLog b/ChangeLog
index e8751cb..ed8c56f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue May 11 08:29:28 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): .?, .+ did not work.
+
Mon May 10 00:59:33 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* lib/jcode.rb: forgot to squeeze on reverse (complement) case.
diff --git a/ext/extmk.rb.nt b/ext/extmk.rb.nt
index b5aa459..379d1bb 100644
--- a/ext/extmk.rb.nt
+++ b/ext/extmk.rb.nt
@@ -256,6 +256,7 @@ SRC
end
def arg_config(config, default=nil)
+ return default if /mswin32/i =~ PLATFORM
unless defined? $configure_args
$configure_args = {}
for arg in ENV["CONFIGURE_ARGS"].split
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 84b98f0..dbee8c7 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -79,6 +79,8 @@ readline_attempted_completion_function(char *text, int start, int end)
int i, matches;
proc = rb_iv_get(mReadline, COMPLETION_PROC);
+ if (NIL_P(proc))
+ return NULL;
rl_attempted_completion_over = 1;
case_fold = RTEST(rb_iv_get(mReadline, COMPLETION_CASE_FOLD));
ary = rb_funcall(proc, rb_intern("call"), 1, rb_str_new2(text));
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 875f6f3..1f19b05 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -518,7 +518,6 @@ thread_write_select(fd)
rb_thread_select(fd+1, 0, &fds, 0, 0);
}
-#if defined(HAVE_FCNTL)
static int
ruby_connect(fd, sockaddr, len, socks)
int fd;
@@ -529,6 +528,7 @@ ruby_connect(fd, sockaddr, len, socks)
int status;
int mode;
+#if defined(HAVE_FCNTL)
mode = fcntl(fd, F_GETFL, 0);
#ifdef O_NDELAY
@@ -541,6 +541,8 @@ ruby_connect(fd, sockaddr, len, socks)
#endif
#endif
fcntl(fd, F_SETFL, mode|NONBLOCKING);
+#endif /* HAVE_FCNTL */
+
for (;;) {
#ifdef SOCKS
if (socks) {
@@ -568,36 +570,14 @@ ruby_connect(fd, sockaddr, len, socks)
#endif
}
}
+#ifdef HAVE_FCNTL
mode &= ~NONBLOCKING;
fcntl(fd, F_SETFL, mode);
+#endif
return status;
}
}
-#else
-
-#ifdef SOCKS
-static int
-ruby_connect(fd, sockaddr, len, socks)
- int fd;
- struct sockaddr *sockaddr;
- int len;
- int socks;
-{
- if (socks) {
- return Rconnect(fd, sockaddr, len);
- }
- else {
- return connect(fd, sockaddr, len);
- }
-}
-#else
-
-#define ruby_connect(fd, sockaddr, len, socks) connect(fd, sockaddr, len)
-
-#endif /* SOCKS */
-#endif
-
static VALUE
open_inet(class, h, serv, type)
VALUE class, h, serv;
@@ -1054,23 +1034,10 @@ udp_connect(sock, host, port)
fd = fileno(fptr->f);
res0 = udp_addrsetup(fptr, host, port);
for (res = res0; res; res = res->ai_next) {
- retry:
if (ruby_connect(fd, res->ai_addr, res->ai_addrlen, 0) >= 0) {
freeaddrinfo(res0);
return INT2FIX(0);
}
- switch (errno) {
- case EINTR:
- rb_thread_schedule();
- goto retry;
-
- case EWOULDBLOCK:
-#if EAGAIN != EWOULDBLOCK
- case EAGAIN:
-#endif
- thread_write_select(fd);
- goto retry;
- }
}
freeaddrinfo(res0);
@@ -1386,19 +1353,7 @@ sock_connect(sock, addr)
GetOpenFile(sock, fptr);
fd = fileno(fptr->f);
- retry:
if (ruby_connect(fd, (struct sockaddr*)RSTRING(addr)->ptr, RSTRING(addr)->len, 0) < 0) {
- switch (errno) {
- case EINTR:
- rb_thread_schedule();
- goto retry;
- case EWOULDBLOCK:
-#if EAGAIN != EWOULDBLOCK
- case EAGAIN:
-#endif
- thread_write_select(fd);
- goto retry;
- }
rb_sys_fail("connect(2)");
}
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 7ebef9f..ad9e839 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -269,6 +269,7 @@ SRC
end
def arg_config(config, default=nil)
+ return default if /mswin32/i =~ PLATFORM
unless defined? $configure_args
$configure_args = {}
for arg in CONFIG["configure_args"].split + ARGV
diff --git a/regex.c b/regex.c
index 31d0c87..0cd01b2 100644
--- a/regex.c
+++ b/regex.c
@@ -1234,10 +1234,14 @@ re_compile_pattern(pattern, size, bufp)
if (!laststart)
break;
- if (greedy && *laststart == anychar && b - laststart < 2) {
+ if (greedy && many_times_ok && *laststart == anychar && b - laststart <= 2) {
if (b[-1] == stop_paren)
b--;
- *laststart = anychar_repeat;
+ if (zero_times_ok)
+ *laststart = anychar_repeat;
+ else {
+ BUFPUSH(anychar_repeat);
+ }
break;
}
/* Now we know whether or not zero matches is allowed
@@ -3375,7 +3379,7 @@ re_match(bufp, string_arg, size, pos, regs)
/* End of pattern means we might have succeeded. */
if (p == pend) {
/* If not end of string, try backtracking. Otherwise done. */
- if ((bufp->options & RE_OPTION_POSIXMATCH) && d != dend) {
+ if ((bufp->options & RE_OPTION_LONGEST) && d != dend) {
if (best_regs_set) /* non-greedy, no need to backtrack */
goto restore_best_regs;
while (stackp != stackb && stackp[-1] == NON_GREEDY) {
@@ -3810,9 +3814,9 @@ re_match(bufp, string_arg, size, pos, regs)
/* Jump without taking off any failure points. */
case jump:
nofinalize:
- EXTRACT_NUMBER_AND_INCR(mcnt, p);
- p += mcnt;
- continue;
+ EXTRACT_NUMBER_AND_INCR(mcnt, p);
+ p += mcnt;
+ continue;
/* We need this opcode so we can detect where alternatives end
in `group_match_null_string_p' et al. */
diff --git a/regex.h b/regex.h
index e03331b..1159201 100644
--- a/regex.h
+++ b/regex.h
@@ -66,9 +66,9 @@
/* newline will be included for . and invert charclass matches */
#define RE_OPTION_POSIXLINE (RE_OPTION_EXTENDED<<1)
/* search for longest match, in accord with POSIX regexp */
-#define RE_OPTION_POSIXMATCH (RE_OPTION_POSIXLINE<<1)
+#define RE_OPTION_LONGEST (RE_OPTION_POSIXLINE<<1)
-#define RE_MAY_IGNORECASE (RE_OPTION_POSIXMATCH<<1)
+#define RE_MAY_IGNORECASE (RE_OPTION_LONGEST<<1)
#define RE_OPTIMIZE_ANCHOR (RE_MAY_IGNORECASE<<1)
#define RE_OPTIMIZE_EXACTN (RE_OPTIMIZE_ANCHOR<<1)
#define RE_OPTIMIZE_NO_BM (RE_OPTIMIZE_EXACTN<<1)