aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Harning Jr <harningt@gmail.com>2007-09-05 23:35:31 -0400
committerThomas Harning Jr <harningt@gmail.com>2007-09-05 23:35:31 -0400
commit35c12fdb05ee081794f621688bb299a9a63ebf2c (patch)
tree542a02f63dfe675e299c84c0a5fe2266908a18fd
parentfb5f78f8c75ce907ae2796d4300c7f8053d20732 (diff)
downloadluaevent-prosody-35c12fdb05ee081794f621688bb299a9a63ebf2c.tar.gz
luaevent-prosody-35c12fdb05ee081794f621688bb299a9a63ebf2c.zip
Fixed compilation issues
-rw-r--r--src/event_callback.c5
-rw-r--r--src/luaevent.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/src/event_callback.c b/src/event_callback.c
index 4a6c04d..bbcd51c 100644
--- a/src/event_callback.c
+++ b/src/event_callback.c
@@ -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 @@ void luaevent_callback(int fd, short event, void* p) {
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 @@ void luaevent_callback(int fd, short event, void* p) {
/* 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);
diff --git a/src/luaevent.c b/src/luaevent.c
index 596e4e1..8903af1 100644
--- a/src/luaevent.c
+++ b/src/luaevent.c
@@ -46,8 +46,8 @@ int getSocketFd(lua_State* L, int idx) {
}
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 */