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

* parse.y (tokadd_string): ignore backslashed spaces in %w.

* enum.c (enum_find): do not use rb_eval_cmd(); should not accept
  a string for if_none.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-08-01 09:42:38 +00:00
parent 2b98e10419
commit 5e6634ce67
5 changed files with 23 additions and 6 deletions

View file

@ -1,3 +1,12 @@
Thu Aug 1 17:47:15 2002 Tachino Nobuhiro <tachino@jp.fujitsu.com>
* parse.y (tokadd_string): ignore backslashed spaces in %w.
Thu Aug 1 14:14:15 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* enum.c (enum_find): do not use rb_eval_cmd(); should not accept
a string for if_none.
Wed Jul 31 14:11:43 2002 Yukihiro Matsumoto <matz@ruby-lang.org> Wed Jul 31 14:11:43 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_undef): undef should be done for klass, not ruby_class. * eval.c (rb_undef): undef should be done for klass, not ruby_class.

View file

@ -308,7 +308,7 @@ AC_CHECK_FUNCS(ftello)
AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\ AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\
strchr strstr strtoul crypt flock vsnprintf\ strchr strstr strtoul crypt flock vsnprintf\
isinf isnan finite hypot acosh) isinf isnan finite hypot acosh)
AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall chroot fsync\ AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync\
truncate chsize times utimes fcntl lockf lstat symlink readlink\ truncate chsize times utimes fcntl lockf lstat symlink readlink\
setitimer setruid seteuid setreuid setresuid setproctitle\ setitimer setruid seteuid setreuid setresuid setproctitle\
setrgid setegid setregid setresgid pause lchown lchmod\ setrgid setegid setregid setresgid pause lchown lchmod\

2
enum.c
View file

@ -90,7 +90,7 @@ enum_find(argc, argv, obj)
} }
rb_gc_force_recycle((VALUE)memo); rb_gc_force_recycle((VALUE)memo);
if (!NIL_P(if_none)) { if (!NIL_P(if_none)) {
rb_eval_cmd(if_none, rb_ary_new2(0), 0); return rb_funcall(if_none, rb_intern("call"), 0, 0);
} }
return Qnil; return Qnil;
} }

View file

@ -434,6 +434,7 @@ s_recvfrom(sock, argc, argv, from)
char buf[1024]; char buf[1024];
socklen_t alen = sizeof buf; socklen_t alen = sizeof buf;
VALUE len, flg; VALUE len, flg;
long slen;
int fd, flags; int fd, flags;
rb_scan_args(argc, argv, "11", &len, &flg); rb_scan_args(argc, argv, "11", &len, &flg);
@ -447,16 +448,16 @@ s_recvfrom(sock, argc, argv, from)
} }
fd = fileno(fptr->f); fd = fileno(fptr->f);
str = rb_tainted_str_new(0, NUM2INT(len)); slen = NUM2INT(len);
str = rb_tainted_str_new(0, slen);
retry: retry:
rb_thread_wait_fd(fd); rb_thread_wait_fd(fd);
TRAP_BEG; TRAP_BEG;
RSTRING(str)->len = recvfrom(fd, RSTRING(str)->ptr, RSTRING(str)->len, flags, slen = recvfrom(fd, RSTRING(str)->ptr, slen, flags, (struct sockaddr*)buf, &alen);
(struct sockaddr*)buf, &alen);
TRAP_END; TRAP_END;
if (RSTRING(str)->len < 0) { if (slen < 0) {
switch (errno) { switch (errno) {
case EINTR: case EINTR:
rb_thread_schedule(); rb_thread_schedule();
@ -464,6 +465,10 @@ s_recvfrom(sock, argc, argv, from)
} }
rb_sys_fail("recvfrom(2)"); rb_sys_fail("recvfrom(2)");
} }
if (slen < RSTRING(str)->len) {
RSTRING(str)->len = slen;
RSTRING(str)->ptr[slen] = '\0';
}
rb_obj_taint(str); rb_obj_taint(str);
switch (from) { switch (from) {
case RECV_RECV: case RECV_RECV:

View file

@ -2836,6 +2836,9 @@ tokadd_string(func, term, paren)
if (func & STR_FUNC_ESCAPE) tokadd('\\'); if (func & STR_FUNC_ESCAPE) tokadd('\\');
c = read_escape(); c = read_escape();
} }
else if ((func & STR_FUNC_QWORDS) && ISSPACE(c)) {
/* ignore backslashed spaces in %w */
}
else if (c != term && !(paren && c == paren)) { else if (c != term && !(paren && c == paren)) {
tokadd('\\'); tokadd('\\');
} }