Permalink
Browse files

better range check

git-svn-id: http://svn.coderepos.org/share/lang/c/picoev/trunk@34996 d0d07461-0603-4401-acd4-de1884942a52
  • Loading branch information...
1 parent dacdff9 commit 37016e1796710b93e3543cf09d260ed073f47b00 kazuho committed Aug 23, 2009
Showing with 2 additions and 1 deletion.
  1. +2 −1 picoev.h
View
@@ -15,7 +15,8 @@ extern "C" {
#include <time.h>
#define PICOEV_IS_INITED (picoev.max_fd != 0)
-#define PICOEV_IS_INITED_AND_FD_IN_RANGE(fd) ((fd) < picoev.max_fd)
+#define PICOEV_IS_INITED_AND_FD_IN_RANGE(fd) \
+ (((unsigned)fd) < (unsigned)picoev.max_fd)
#define PICOEV_TOO_MANY_LOOPS (picoev.num_loops != 0) /* use after ++ */
#define PICOEV_FD_BELONGS_TO_LOOP(loop, fd) \
((loop)->loop_id == picoev.fds[fd].loop_id)

0 comments on commit 37016e1

Please sign in to comment.