1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
From 81b673a5a0cd7f96ad7c7bbc6052bbed30b0a2a5 Mon Sep 17 00:00:00 2001
From: Patrick Reynolds <patrick.reynolds@github.com>
Date: Wed, 21 Jan 2015 22:34:43 -0600
Subject: [PATCH 3/3] add comment about where the macros came from
---
ext/em.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ext/em.h b/ext/em.h
index 5b9279d..05d4310 100644
--- a/ext/em.h
+++ b/ext/em.h
@@ -62,6 +62,9 @@ See the file COPYING for complete licensing information.
#ifndef rb_fd_max
#define fd_check(n) (((n) < FD_SETSIZE) ? 1 : 0*fprintf(stderr, "fd %d too large for select\n", (n)))
+// These definitions are cribbed from include/ruby/intern.h in Ruby 1.9.3,
+// with this change: any macros that read or write the nth element of an
+// fdset first call fd_check to make sure n is in bounds.
typedef fd_set rb_fdset_t;
#define rb_fd_zero(f) FD_ZERO(f)
#define rb_fd_set(n, f) do { if (fd_check(n)) FD_SET((n), (f)); } while(0)
--
2.1.4
|