Skip to content

Commit

Permalink
* vm_core.h: Introduce UNINITIALIZED_VAR() macro.
Browse files Browse the repository at this point in the history
	* thread.c (do_select): Use UNINITIALIZED_VAR() instead FAKE_FD_ZERO().
	  Also, remove FAKE_FD_ZERO completely. [Feature #3018]




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
kosaki committed Apr 6, 2010
1 parent 2bbeb4c commit 75ce784
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
Tue Apr 6 23:01:35 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>

* vm_core.h: Introduce UNINITIALIZED_VAR() macro.
* thread.c (do_select): Use UNINITIALIZED_VAR() instead FAKE_FD_ZERO().
Also, remove FAKE_FD_ZERO completely. [Feature #3018]

Tue Apr 6 21:55:25 2010 Tanaka Akira <akr@fsij.org>

* configure.in: test localtime(3) overflow. [ruby-dev:40910]
Expand Down
17 changes: 6 additions & 11 deletions thread.c
Expand Up @@ -2415,12 +2415,9 @@ do_select(int n, fd_set *read, fd_set *write, fd_set *except,
struct timeval *timeout)
{
int result, lerrno;
fd_set orig_read, orig_write, orig_except;
#if defined __GNUC__ && defined __x86_64__
#define FAKE_FD_ZERO(f) (*(int *)&(f)=0) /* suppress lots of warnings */
#else
#define FAKE_FD_ZERO(f) ((void)0)
#endif
fd_set UNINITIALIZED_VAR(orig_read);
fd_set UNINITIALIZED_VAR(orig_write);
fd_set UNINITIALIZED_VAR(orig_except);

#ifndef linux
double limit = 0;
Expand All @@ -2442,11 +2439,9 @@ do_select(int n, fd_set *read, fd_set *write, fd_set *except,
}
#endif

if (read) orig_read = *read; else FAKE_FD_ZERO(orig_read);
if (write) orig_write = *write; else FAKE_FD_ZERO(orig_write);
if (except) orig_except = *except; else FAKE_FD_ZERO(orig_except);

#undef FAKE_FD_ZERO
if (read) orig_read = *read;
if (write) orig_write = *write;
if (except) orig_except = *except;

retry:
lerrno = 0;
Expand Down
6 changes: 6 additions & 0 deletions vm_core.h
Expand Up @@ -106,6 +106,12 @@
#define UNLIKELY(x) (x)
#endif /* __GNUC__ >= 3 */

#if __GNUC__ >= 3
#define UNINITIALIZED_VAR(x) x = x
#else
#define UNINITIALIZED_VAR(x) x
#endif

typedef unsigned long rb_num_t;

/* iseq data type */
Expand Down

0 comments on commit 75ce784

Please sign in to comment.