several configuration options that do not change often moved out of

luaconf.h and into more internal files
This commit is contained in:
Roberto Ierusalimschy
2009-12-17 10:26:09 -02:00
parent 2af0d3b459
commit de6fc75d63
10 changed files with 215 additions and 267 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: loslib.c,v 1.26 2009/11/23 18:20:38 roberto Exp roberto $
** $Id: loslib.c,v 1.27 2009/11/24 12:05:44 roberto Exp roberto $
** Standard Operating System library
** See Copyright Notice in lua.h
*/
@@ -20,6 +20,28 @@
#include "lualib.h"
/*
** By default, Lua uses tmpnam except when POSIX is available, where it
** uses mkstemp.
*/
#if defined(LUA_USE_MKSTEMP)
#include <unistd.h>
#define LUA_TMPNAMBUFSIZE 32
#define lua_tmpnam(b,e) { \
strcpy(b, "/tmp/lua_XXXXXX"); \
e = mkstemp(b); \
if (e != -1) close(e); \
e = (e == -1); }
#elif !defined(lua_tmpnam)
#define LUA_TMPNAMBUFSIZE L_tmpnam
#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
#endif
static int os_pushresult (lua_State *L, int i, const char *filename) {
int en = errno; /* calls to Lua API may change this value */
if (i) {