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

* parse.y (str_extend): should check nesting parentheses in #{}.

* eval.c (rb_thread_select): tv_sec and tv_usec should not be
  negative.

* signal.c (posix_signal): do not set SA_RESTART for SIGVTALRM.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-11-21 15:36:37 +00:00
parent 904c9d27ce
commit da79585959
6 changed files with 36 additions and 15 deletions

View file

@ -1,3 +1,14 @@
Thu Nov 22 00:28:13 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (str_extend): should check nesting parentheses in #{}.
Wed Nov 21 00:17:54 2001 Ville Mattila <mulperi@iki.fi>
* eval.c (rb_thread_select): tv_sec and tv_usec should not be
negative.
* signal.c (posix_signal): do not set SA_RESTART for SIGVTALRM.
Tue Nov 20 01:07:13 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (str_extend): should not terminate string interpolation

2
eval.c
View file

@ -7818,6 +7818,8 @@ rb_thread_select(max, read, write, except, timeout)
tv.tv_sec = (unsigned int)d;
tv.tv_usec = (long)((d-(double)tv.tv_sec)*1e6);
if (tv.tv_sec < 0) tv.tv_sec = 0;
if (tv.tv_usec < 0) tv.tv_usec = 0;
}
continue;
default:

View file

@ -456,10 +456,11 @@ pty_getpty(self, command)
wfptr->f = fdopen(dup(info.fd), "w");
wfptr->path = strdup(RSTRING(command)->ptr);
res = rb_ary_new2(2);
res = rb_ary_new2(4);
rb_ary_store(res,0,(VALUE)rport);
rb_ary_store(res,1,(VALUE)wport);
rb_ary_store(res,2,INT2FIX(info.child_pid));
rb_ary_store(res,3,rb_str_new2(SlaveName));
if (rb_block_given_p()) {
rb_ensure(rb_yield, (VALUE)res, (VALUE (*)())reset_signal_action, Qnil);

View file

@ -72,7 +72,7 @@ SimpleDelegater = SimpleDelegator
#
def DelegateClass(superclass)
klass = Class.new
methods = superclass.instance_methods
methods = superclass.instance_methods(true)
methods -= ::Kernel.instance_methods
methods |= ["to_s","to_a","inspect","==","=~","==="]
klass.module_eval <<-EOS

26
parse.y
View file

@ -1878,7 +1878,7 @@ none : /* none */
static char *tokenbuf = NULL;
static int tokidx, toksiz = 0;
static NODE *str_extend();
static NODE *str_extend _((NODE*,char,char));
#define LEAVE_BS 1
@ -2346,7 +2346,7 @@ parse_regx(term, paren)
switch (c) {
case '#':
list = str_extend(list, term);
list = str_extend(list, term, paren);
if (list == (NODE*)-1) goto unterminated;
continue;
@ -2475,7 +2475,7 @@ parse_string(func, term, paren)
}
}
else if (c == '#') {
list = str_extend(list, term);
list = str_extend(list, term, paren);
if (list == (NODE*)-1) goto unterm_str;
continue;
}
@ -3689,15 +3689,16 @@ yylex()
}
static NODE*
str_extend(list, term)
str_extend(list, term, paren)
NODE *list;
char term;
char term, paren;
{
int c;
int brace = -1;
VALUE ss;
NODE *node;
int nest;
int brace_nest = 0;
int paren_nest = 0;
c = nextc();
switch (c) {
@ -3812,13 +3813,13 @@ str_extend(list, term)
case '{':
if (c == '{') brace = '}';
nest = 0;
brace_nest = 0;
do {
loop_again:
c = nextc();
switch (c) {
case -1:
if (nest > 0) {
if (brace_nest > 0) {
yyerror("bad substitution in string");
newtok();
return list;
@ -3826,8 +3827,8 @@ str_extend(list, term)
return (NODE*)-1;
case '}':
if (c == brace) {
if (nest == 0) break;
nest--;
if (brace_nest == 0) break;
brace_nest--;
}
tokadd(c);
goto loop_again;
@ -3843,9 +3844,10 @@ str_extend(list, term)
}
break;
case '{':
if (brace != -1) nest++;
if (brace != -1) brace_nest++;
default:
if (c == term) {
if (c == paren) paren_nest++;
else if (c == term && (!paren || paren_nest-- == 0)) {
pushback(c);
list_append(list, NEW_STR(rb_str_new2("#")));
rb_warning("bad substitution in string");

View file

@ -293,7 +293,12 @@ posix_signal(signum, handler)
sigemptyset(&sigact.sa_mask);
sigact.sa_flags = 0;
#ifdef SA_RESTART
sigact.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
/* All other signals but VTALRM shall restart restartable syscall
VTALRM will cause EINTR to syscall if interrupted.
*/
if (signum != SIGVTALRM) {
sigact.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
}
#endif
#ifdef SA_NOCLDWAIT
if (signum == SIGCHLD && handler == SIG_IGN)