Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replaced FD_* macros from select.h with equivalent assembly-free vari…

…ants.
  • Loading branch information...
commit b44a858f25b08f8269a36592d56985f3e04b1294 1 parent fe23e1d
@max99x max99x authored
Showing with 58 additions and 3 deletions.
  1. +26 −0 ruby-1.8.7/eval.c
  2. +32 −3 ruby-1.8.7/io.c
View
26 ruby-1.8.7/eval.c
@@ -209,6 +209,32 @@ int _setjmp(), _longjmp();
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
+#else
+ #undef __NFDBITS
+ #undef __FDMASK
+ #undef FD_ZERO
+ #undef FD_CLR
+ #undef FD_SET
+ #undef FD_ISSET
+
+ #define __NFDBITS (8 * (int) sizeof (long int))
+ #define __FDELT(d) ((d) / __NFDBITS)
+ #define __FDMASK(d) ((long int) 1 << ((d) % __NFDBITS))
+
+ # define FD_ZERO(set) \
+ do { \
+ unsigned int __i; \
+ fd_set *__arr = (set); \
+ for (__i = 0; __i < sizeof (fd_set) / sizeof (long int); ++__i) \
+ __FDS_BITS (__arr)[__i] = 0; \
+ } while (0)
+
+ #define FD_SET(d, set) \
+ ((void) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d)))
+ #define FD_CLR(d, set) \
+ ((void) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d)))
+ #define FD_ISSET(d, set) \
+ ((__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d)) != 0)
#endif
#include <sys/stat.h>
View
35 ruby-1.8.7/io.c
@@ -202,6 +202,38 @@ extern int ReadDataPending();
}\
} while(0)
+
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#else
+ #undef __NFDBITS
+ #undef __FDMASK
+ #undef FD_ZERO
+ #undef FD_CLR
+ #undef FD_SET
+ #undef FD_ISSET
+
+ #define __NFDBITS (8 * (int) sizeof (long int))
+ #define __FDELT(d) ((d) / __NFDBITS)
+ #define __FDMASK(d) ((long int) 1 << ((d) % __NFDBITS))
+
+ # define FD_ZERO(set) \
+ do { \
+ unsigned int __i; \
+ fd_set *__arr = (set); \
+ for (__i = 0; __i < sizeof (fd_set) / sizeof (long int); ++__i) \
+ __FDS_BITS (__arr)[__i] = 0; \
+ } while (0)
+
+ #define FD_SET(d, set) \
+ ((void) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d)))
+ #define FD_CLR(d, set) \
+ ((void) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d)))
+ #define FD_ISSET(d, set) \
+ ((__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d)) != 0)
+#endif
+
void
rb_eof_error()
{
@@ -4573,9 +4605,6 @@ rb_f_backquote(VALUE obj, VALUE str)
return result;
}
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
/*
* call-seq:
Please sign in to comment.
Something went wrong with that request. Please try again.