From d90ae30caafb82dc96148bbdf43519c5a23b537f Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 19 Oct 2020 12:19:56 +0200 Subject: mobile: Use osmo_fd_setup() in script_lua.c Change-Id: Ib6f97b9b8f3af63b81b92071b7fdb1fd55da89a5 --- src/host/layer23/src/mobile/script_lua.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/host/layer23/src/mobile') diff --git a/src/host/layer23/src/mobile/script_lua.c b/src/host/layer23/src/mobile/script_lua.c index 269c9dff..50315bdb 100644 --- a/src/host/layer23/src/mobile/script_lua.c +++ b/src/host/layer23/src/mobile/script_lua.c @@ -497,6 +497,7 @@ static int lua_fd_cb(struct osmo_fd *fd, unsigned int what) { static int lua_register_fd(lua_State *L) { struct fd_userdata *fdu; + int fd; /* fd, cb */ luaL_argcheck(L, lua_isnumber(L, -2), 1, "needs to be a filedescriptor"); @@ -510,10 +511,8 @@ static int lua_register_fd(lua_State *L) lua_setmetatable(L, -2); /* Set the filedescriptor */ - fdu->fd.fd = (int) lua_tonumber(L, -3); - fdu->fd.cb = lua_fd_cb; - fdu->fd.when = OSMO_FD_READ; - fdu->fd.data = fdu; + fd = (int) lua_tonumber(L, -3); + osmo_fd_setup(&fdu->fd, fd, OSMO_FD_READ, lua_fd_cb, fdu, 0); /* Assuming that an error here will lead to a GC */ if (osmo_fd_register(&fdu->fd) != 0) { -- cgit v1.2.3