From f9e3213f01e3c1d7b49229c8c4dcfe71c21e5ebb Mon Sep 17 00:00:00 2001 From: normal Date: Sat, 6 Dec 2014 01:10:06 +0000 Subject: [PATCH] thread.c (do_select): rename parameters to avoid shadowing Sometimes we may use write(2) syscalls for debugging inside this function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ thread.c | 37 +++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index e385a7e1fc..565ef688bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Dec 6 10:09:44 2014 Eric Wong + + * thread.c (do_select): rename parameters to avoid shadowing + Sat Dec 6 09:22:45 2014 SHIBATA Hiroshi * lib/rake: Update to rake 10.4.2 diff --git a/thread.c b/thread.c index 8708e6adc2..25cc2143e9 100644 --- a/thread.c +++ b/thread.c @@ -3412,8 +3412,8 @@ rb_fd_set(int fd, rb_fdset_t *set) #endif static int -do_select(int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, - struct timeval *timeout) +do_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds, + rb_fdset_t *exceptfds, struct timeval *timeout) { int UNINITIALIZED_VAR(result); int lerrno; @@ -3431,18 +3431,19 @@ do_select(int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, timeout = &wait_rest; } - if (read) - rb_fd_init_copy(&orig_read, read); - if (write) - rb_fd_init_copy(&orig_write, write); - if (except) - rb_fd_init_copy(&orig_except, except); + if (readfds) + rb_fd_init_copy(&orig_read, readfds); + if (writefds) + rb_fd_init_copy(&orig_write, writefds); + if (exceptfds) + rb_fd_init_copy(&orig_except, exceptfds); retry: lerrno = 0; BLOCKING_REGION({ - result = native_fd_select(n, read, write, except, timeout, th); + result = native_fd_select(n, readfds, writefds, exceptfds, + timeout, th); if (result < 0) lerrno = errno; }, ubf_select, th, FALSE); @@ -3456,12 +3457,12 @@ do_select(int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, #ifdef ERESTART case ERESTART: #endif - if (read) - rb_fd_dup(read, &orig_read); - if (write) - rb_fd_dup(write, &orig_write); - if (except) - rb_fd_dup(except, &orig_except); + if (readfds) + rb_fd_dup(readfds, &orig_read); + if (writefds) + rb_fd_dup(writefds, &orig_write); + if (exceptfds) + rb_fd_dup(exceptfds, &orig_except); if (timeout) { double d = limit - timeofday(); @@ -3478,11 +3479,11 @@ do_select(int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, } } - if (read) + if (readfds) rb_fd_term(&orig_read); - if (write) + if (writefds) rb_fd_term(&orig_write); - if (except) + if (exceptfds) rb_fd_term(&orig_except); return result;