about summary refs log tree commit diff
path: root/bits/select.h
diff options
context:
space:
mode:
Diffstat (limited to 'bits/select.h')
-rw-r--r--bits/select.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/bits/select.h b/bits/select.h
index 613919577c..7803335499 100644
--- a/bits/select.h
+++ b/bits/select.h
@@ -21,9 +21,16 @@
 #endif
 
 
-/* This line MUST be split!  Otherwise m4 will not change it.  */
-#define __FD_ZERO(set)  \
-  ((void) memset ((__ptr_t) (set), 0, sizeof (fd_set)))
+/* This line MUST be split!  Otherwise m4 will not change it.
+
+   We don't use `memset' because this would require a prototype and
+   the array isn't too big.  */
+#define __FD_ZERO(set) \
+  do {									      \
+    unsigned int __i;							      \
+    for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i)	      \
+      ((__fd_mask *) set)[__i] = '\0';					      \
+  } while (0)
 #define __FD_SET(d, set)	((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
 #define __FD_CLR(d, set)	((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
 #define __FD_ISSET(d, set)	((set)->fds_bits[__FDELT(d)] & __FDMASK(d))