diff options
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/select.c b/src/select.c index 8590b96..41bdaa4 100644 --- a/src/select.c +++ b/src/select.c | |||
@@ -21,7 +21,6 @@ static int meth_set(lua_State *L); | |||
21 | static int meth_isset(lua_State *L); | 21 | static int meth_isset(lua_State *L); |
22 | static int c_select(lua_State *L); | 22 | static int c_select(lua_State *L); |
23 | static int global_select(lua_State *L); | 23 | static int global_select(lua_State *L); |
24 | static void check_obj_tab(lua_State *L, int tabidx); | ||
25 | 24 | ||
26 | /* fd_set object methods */ | 25 | /* fd_set object methods */ |
27 | static luaL_reg set[] = { | 26 | static luaL_reg set[] = { |
@@ -68,9 +67,6 @@ static int global_select(lua_State *L) | |||
68 | fd_set *read_fd_set, *write_fd_set; | 67 | fd_set *read_fd_set, *write_fd_set; |
69 | /* make sure we have enough arguments (nil is the default) */ | 68 | /* make sure we have enough arguments (nil is the default) */ |
70 | lua_settop(L, 3); | 69 | lua_settop(L, 3); |
71 | /* check object tables */ | ||
72 | check_obj_tab(L, 1); | ||
73 | check_obj_tab(L, 2); | ||
74 | /* check timeout */ | 70 | /* check timeout */ |
75 | if (!lua_isnil(L, 3) && !lua_isnumber(L, 3)) | 71 | if (!lua_isnil(L, 3) && !lua_isnumber(L, 3)) |
76 | luaL_argerror(L, 3, "number or nil expected"); | 72 | luaL_argerror(L, 3, "number or nil expected"); |
@@ -127,24 +123,3 @@ static int c_select(lua_State *L) | |||
127 | timeout < 0 ? NULL : &tv)); | 123 | timeout < 0 ? NULL : &tv)); |
128 | return 1; | 124 | return 1; |
129 | } | 125 | } |
130 | |||
131 | static void check_obj_tab(lua_State *L, int tabidx) | ||
132 | { | ||
133 | if (tabidx < 0) tabidx = lua_gettop(L) + tabidx + 1; | ||
134 | if (lua_istable(L, tabidx)) { | ||
135 | lua_pushnil(L); | ||
136 | while (lua_next(L, tabidx) != 0) { | ||
137 | if (aux_getgroupudata(L, "select{able}", -1) == NULL) { | ||
138 | char msg[45]; | ||
139 | if (lua_isnumber(L, -2)) | ||
140 | sprintf(msg, "table entry #%g is invalid", | ||
141 | lua_tonumber(L, -2)); | ||
142 | else | ||
143 | sprintf(msg, "invalid entry found in table"); | ||
144 | luaL_argerror(L, tabidx, msg); | ||
145 | } | ||
146 | lua_pop(L, 1); | ||
147 | } | ||
148 | } else if (!lua_isnil(L, tabidx)) | ||
149 | luaL_argerror(L, tabidx, "table or nil expected"); | ||
150 | } | ||