Wed, 05 Sep 2007 23:35:31 -0400
Fixed compilation issues
src/event_callback.c | file | annotate | diff | comparison | revisions | |
src/luaevent.c | file | annotate | diff | comparison | revisions |
--- a/src/event_callback.c Wed Sep 05 23:33:46 2007 -0400 +++ b/src/event_callback.c Wed Sep 05 23:35:31 2007 -0400 @@ -3,6 +3,7 @@ #include "event_callback.h" #include <assert.h> #include <lauxlib.h> +#include <string.h> #define EVENT_CALLBACK_ARG_MT "EVENT_CALLBACK_ARG_MT" @@ -31,7 +32,7 @@ if(lua_isnumber(L, -1)) { newTimeout = lua_tonumber(L, -1); if(newTimeout <= 0) { - memset(&cb->timeout, 0, sizeof(arg->timeout)); + memset(&cb->timeout, 0, sizeof(cb->timeout)); } else { load_timeval(newTimeout, &cb->timeout); } @@ -45,7 +46,7 @@ /* NOTE: Currently, even if new timeout is the same as the old, a new event is setup regardless... */ if(newEvent != event || newTimeout != -1) { // Need to hook up new event... struct timeval *ptv = &cb->timeout; - if(!cb->timeout.sec && !cb->timeout.usec) + if(!cb->timeout.tv_sec && !cb->timeout.tv_usec) ptv = NULL; event_del(ev); event_set(ev, fd, EV_PERSIST | newEvent, luaevent_callback, cb);
--- a/src/luaevent.c Wed Sep 05 23:33:46 2007 -0400 +++ b/src/luaevent.c Wed Sep 05 23:35:31 2007 -0400 @@ -46,8 +46,8 @@ } void load_timeval(double time, struct timeval *tv) { - tv->sec = (int)time; - tv->usec = (time * 1000000) % 1000000; + tv->tv_sec = (int)time; + tv->tv_usec = (int)(time * 1000000) % 1000000; } /* sock, event, callback, timeout */