Remove integer type hacks, okay jolan@

This commit is contained in:
pedro 2006-04-12 18:41:36 +00:00
parent c63ed26eb3
commit 940e135036
3 changed files with 2 additions and 56 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.7 2006/02/10 18:07:37 steven Exp $
# $OpenBSD: Makefile,v 1.8 2006/04/12 18:41:36 pedro Exp $
SHARED_ONLY= Yes
COMMENT= "network support for the lua language"
DISTNAME= luasocket-2.0
PKGNAME= ${DISTNAME}p1
PKGNAME= ${DISTNAME}p2
CATEGORIES= net
MASTER_SITES= http://luaforge.net/frs/download.php/1097/

View File

@ -1,29 +0,0 @@
$OpenBSD: patch-src_timeout_c,v 1.1 2006/01/21 01:32:40 jolan Exp $
--- src/timeout.c.orig Thu Nov 24 14:29:38 2005
+++ src/timeout.c Fri Jan 20 04:31:32 2006
@@ -15,6 +15,7 @@
#ifdef _WIN32
#include <windows.h>
#else
+#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#endif
@@ -193,6 +194,9 @@ int timeout_lua_sleep(lua_State *L)
#ifdef _WIN32
Sleep((int)(n*1000));
#else
+#if LUA_NUMBER == int
+ usleep((int)n*1000);
+#else
struct timespec t, r;
t.tv_sec = (int) n;
n -= t.tv_sec;
@@ -202,6 +206,7 @@ int timeout_lua_sleep(lua_State *L)
t.tv_sec = r.tv_sec;
t.tv_nsec = r.tv_nsec;
}
+#endif
#endif
return 0;
}

View File

@ -1,25 +0,0 @@
$OpenBSD: patch-src_usocket_c,v 1.1 2006/01/21 01:32:40 jolan Exp $
--- src/usocket.c.orig Thu Nov 24 14:29:38 2005
+++ src/usocket.c Fri Jan 20 04:30:11 2006
@@ -11,6 +11,7 @@
#include <string.h>
#include <signal.h>
+#include "lua.h"
#include "socket.h"
/*-------------------------------------------------------------------------*\
@@ -108,8 +109,13 @@ int socket_select(t_socket n, fd_set *rf
do {
struct timeval tv;
double t = timeout_getretry(tm);
+#if LUA_NUMBER == int
+ tv.tv_sec = 0;
+ tv.tv_usec = (int)t*1000;
+#else
tv.tv_sec = (int) t;
tv.tv_usec = (int) ((t - tv.tv_sec) * 1.0e6);
+#endif
/* timeout = 0 means no wait */
ret = select(n, rfds, wfds, efds, t >= 0.0 ? &tv: NULL);
} while (ret < 0 && errno == EINTR);