зеркало из https://github.com/github/ruby.git
* include/ruby/intern.h: resurrect old rb_fd_copy().
* thread.c (rb_fd_copy): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
2b7996e839
Коммит
d734c9dea2
|
@ -1,3 +1,8 @@
|
|||
Sun May 15 23:53:31 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* include/ruby/intern.h: resurrect old rb_fd_copy().
|
||||
* thread.c (rb_fd_copy): ditto.
|
||||
|
||||
Sun May 15 23:45:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* include/ruby/intern.h: remove rb_fd_copy() to rb_fd_dup() and
|
||||
|
|
|
@ -250,6 +250,7 @@ void rb_fd_zero(rb_fdset_t *);
|
|||
void rb_fd_set(int, rb_fdset_t *);
|
||||
void rb_fd_clr(int, rb_fdset_t *);
|
||||
int rb_fd_isset(int, const rb_fdset_t *);
|
||||
void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
|
||||
void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
|
||||
int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
|
||||
|
||||
|
@ -284,6 +285,7 @@ typedef fd_set rb_fdset_t;
|
|||
#define rb_fd_set(n, f) FD_SET((n), (f))
|
||||
#define rb_fd_clr(n, f) FD_CLR((n), (f))
|
||||
#define rb_fd_isset(n, f) FD_ISSET((n), (f))
|
||||
#define rb_fd_copy(d, s, n) (*(d) = *(s))
|
||||
#define rb_fd_dup(d, s) (*(d) = *(s))
|
||||
#define rb_fd_resize(n, f) ((void)(f))
|
||||
#define rb_fd_ptr(f) (f)
|
||||
|
|
11
thread.c
11
thread.c
|
@ -2391,6 +2391,17 @@ rb_fd_isset(int n, const rb_fdset_t *fds)
|
|||
return FD_ISSET(n, fds->fdset) != 0; /* "!= 0" avoids FreeBSD PR 91421 */
|
||||
}
|
||||
|
||||
void
|
||||
rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max)
|
||||
{
|
||||
size_t size = howmany(max, NFDBITS) * sizeof(fd_mask);
|
||||
|
||||
if (size < sizeof(fd_set)) size = sizeof(fd_set);
|
||||
dst->maxfd = max;
|
||||
dst->fdset = xrealloc(dst->fdset, size);
|
||||
memcpy(dst->fdset, src, size);
|
||||
}
|
||||
|
||||
void
|
||||
rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче