[macruby-changes] [737] MacRuby/trunk/ext/socket/socket.c
source_changes at macosforge.org
source_changes at macosforge.org
Tue Nov 11 21:11:29 PST 2008
Revision: 737
http://trac.macosforge.org/projects/ruby/changeset/737
Author: lsansonetti at apple.com
Date: 2008-11-11 21:11:28 -0800 (Tue, 11 Nov 2008)
Log Message:
-----------
fix for #160
Modified Paths:
--------------
MacRuby/trunk/ext/socket/socket.c
Modified: MacRuby/trunk/ext/socket/socket.c
===================================================================
--- MacRuby/trunk/ext/socket/socket.c 2008-11-11 23:52:16 UTC (rev 736)
+++ MacRuby/trunk/ext/socket/socket.c 2008-11-12 05:11:28 UTC (rev 737)
@@ -1042,8 +1042,8 @@
struct wait_connectable_arg {
int fd;
- rb_fdset_t fds_w;
- rb_fdset_t fds_e;
+ rb_fdset_t *fds_w;
+ rb_fdset_t *fds_e;
};
#ifdef HAVE_RB_FD_INIT
@@ -1051,15 +1051,15 @@
try_wait_connectable(VALUE arg)
{
struct wait_connectable_arg *p = (struct wait_connectable_arg *)arg;
- return (VALUE)wait_connectable0(p->fd, &p->fds_w, &p->fds_e);
+ return (VALUE)wait_connectable0(p->fd, p->fds_w, p->fds_e);
}
static VALUE
wait_connectable_ensure(VALUE arg)
{
struct wait_connectable_arg *p = (struct wait_connectable_arg *)arg;
- rb_fd_term(&p->fds_w);
- rb_fd_term(&p->fds_e);
+ rb_fd_term(p->fds_w);
+ rb_fd_term(p->fds_e);
return Qnil;
}
#endif
@@ -1067,16 +1067,19 @@
static int
wait_connectable(int fd)
{
- struct wait_connectable_arg arg;
+ struct wait_connectable_arg *arg;
- rb_fd_init(&arg.fds_w);
- rb_fd_init(&arg.fds_e);
+ arg = (void *)xmalloc(sizeof(struct wait_connectable_arg));
+ arg->fds_w = (rb_fdset_t *)xmalloc(sizeof(rb_fdset_t));
+ arg->fds_e = (rb_fdset_t *)xmalloc(sizeof(rb_fdset_t));
+ rb_fd_init(arg->fds_w);
+ rb_fd_init(arg->fds_e);
#ifdef HAVE_RB_FD_INIT
- arg.fd = fd;
- return (int)rb_ensure(try_wait_connectable, (VALUE)&arg,
- wait_connectable_ensure,(VALUE)&arg);
+ arg->fd = fd;
+ return (int)rb_ensure(try_wait_connectable, (VALUE)arg,
+ wait_connectable_ensure,(VALUE)arg);
#else
- return wait_connectable0(fd, &arg.fds_w, &arg.fds_e);
+ return wait_connectable0(fd, arg->fds_w, arg->fds_e);
#endif
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20081111/7d4f45e1/attachment.html>
More information about the macruby-changes
mailing list