CVS commit: src/external/mit/lua/dist/src

2019-12-12 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Thu Dec 12 12:35:44 UTC 2019

Modified Files:
src/external/mit/lua/dist/src: lapi.c

Log Message:
Apply a fix for the bug "Joining an upvalue with itself can cause a use-after
free", documented on http://www.lua.org/bugs.html


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/mit/lua/dist/src/lapi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lapi.c
diff -u src/external/mit/lua/dist/src/lapi.c:1.11 src/external/mit/lua/dist/src/lapi.c:1.12
--- src/external/mit/lua/dist/src/lapi.c:1.11	Sat Aug  4 17:30:01 2018
+++ src/external/mit/lua/dist/src/lapi.c	Thu Dec 12 12:35:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapi.c,v 1.11 2018/08/04 17:30:01 alnsn Exp $	*/
+/*	$NetBSD: lapi.c,v 1.12 2019/12/12 12:35:43 mbalmer Exp $	*/
 
 /*
 ** Id: lapi.c,v 2.259.1.2 2017/12/06 18:35:12 roberto Exp 
@@ -1297,6 +1297,8 @@ LUA_API void lua_upvaluejoin (lua_State 
   LClosure *f1;
   UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
   UpVal **up2 = getupvalref(L, fidx2, n2, NULL);
+  if (*up1 == *up2)
+return;
   luaC_upvdeccount(L, *up1);
   *up1 = *up2;
   (*up1)->refcount++;



CVS commit: src/external/mit/lua/dist/src

2018-07-01 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun Jul  1 10:08:38 UTC 2018

Modified Files:
src/external/mit/lua/dist/src: ltable.c

Log Message:
Apply bugfix #7 from lua.org/bugs.html: Memory-allocation error when resizing
a table can leave it in an inconsistent state.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/ltable.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/ltable.c
diff -u src/external/mit/lua/dist/src/ltable.c:1.9 src/external/mit/lua/dist/src/ltable.c:1.10
--- src/external/mit/lua/dist/src/ltable.c:1.9	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/ltable.c	Sun Jul  1 10:08:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ltable.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: ltable.c,v 1.10 2018/07/01 10:08:38 mbalmer Exp $	*/
 
 /*
 ** Id: ltable.c,v 2.118 2016/11/07 12:38:35 roberto Exp 
@@ -338,17 +338,34 @@ static void setnodevector (lua_State *L,
 }
 
 
+typedef struct {
+  Table *t;
+  unsigned int nhsize;
+} AuxsetnodeT;
+
+
+static void auxsetnode (lua_State *L, void *ud) {
+  AuxsetnodeT *asn = cast(AuxsetnodeT *, ud);
+  setnodevector(L, asn->t, asn->nhsize);
+}
+
+
 void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
   unsigned int nhsize) {
   unsigned int i;
   int j;
+  AuxsetnodeT asn;
   unsigned int oldasize = t->sizearray;
   int oldhsize = allocsizenode(t);
   Node *nold = t->node;  /* save old hash ... */
   if (nasize > oldasize)  /* array part must grow? */
 setarrayvector(L, t, nasize);
   /* create new hash part with appropriate size */
-  setnodevector(L, t, nhsize);
+  asn.t = t; asn.nhsize = nhsize;
+  if (luaD_rawrunprotected(L, auxsetnode, &asn) != LUA_OK) {  /* mem. error? */
+setarrayvector(L, t, oldasize);  /* array back to its original size */
+luaD_throw(L, LUA_ERRMEM);  /* rethrow memory error */
+  }
   if (nasize < oldasize) {  /* array part must shrink? */
 t->sizearray = nasize;
 /* re-insert elements from vanishing slice */



CVS commit: src/external/mit/lua/dist/src

2018-05-26 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sat May 26 20:17:56 UTC 2018

Modified Files:
src/external/mit/lua/dist/src: luaconf.h

Log Message:
Change LUAL_BUFFERSIZE from 4-8K to 128 bytes for kernel-side Lua.

LUAL_BUFFERSIZE defines how much luaL_Buffer allocates from
the stack. Apparently, 4-8K is too much for the kernel stack.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.21 src/external/mit/lua/dist/src/luaconf.h:1.22
--- src/external/mit/lua/dist/src/luaconf.h:1.21	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/luaconf.h	Sat May 26 20:17:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: luaconf.h,v 1.21 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: luaconf.h,v 1.22 2018/05/26 20:17:56 alnsn Exp $	*/
 
 /*
 ** Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp 
@@ -757,7 +757,9 @@
 ** smaller buffer would force a memory allocation for each call to
 ** 'string.format'.)
 */
-#if LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE
+#ifdef _KERNEL
+#define LUAL_BUFFERSIZE		128
+#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE
 #define LUAL_BUFFERSIZE		8192
 #else
 #define LUAL_BUFFERSIZE   ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer)))



CVS commit: src/external/mit/lua/dist/src

2017-12-13 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Dec 13 13:00:14 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lapi.c

Log Message:
Apply a bugfix from lua.org/bugs,html:
lua_pushcclosure should not call the garbage collector when n is zero.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/lapi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lapi.c
diff -u src/external/mit/lua/dist/src/lapi.c:1.9 src/external/mit/lua/dist/src/lapi.c:1.10
--- src/external/mit/lua/dist/src/lapi.c:1.9	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/lapi.c	Wed Dec 13 13:00:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapi.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: lapi.c,v 1.10 2017/12/13 13:00:14 mbalmer Exp $	*/
 
 /*
 ** Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp 
@@ -541,6 +541,7 @@ LUA_API void lua_pushcclosure (lua_State
   lua_lock(L);
   if (n == 0) {
 setfvalue(L->top, fn);
+api_incr_top(L);
   }
   else {
 CClosure *cl;
@@ -554,9 +555,9 @@ LUA_API void lua_pushcclosure (lua_State
   /* does not need barrier because closure is white */
 }
 setclCvalue(L, L->top, cl);
+api_incr_top(L);
+luaC_checkGC(L);
   }
-  api_incr_top(L);
-  luaC_checkGC(L);
   lua_unlock(L);
 }
 



CVS commit: src/external/mit/lua/dist/src

2017-09-07 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Thu Sep  7 12:52:29 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lgc.c

Log Message:
Apply bug fix from lua.org/bugs.html (dead keys with nil values can stay
in weak tables).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/lua/dist/src/lgc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lgc.c
diff -u src/external/mit/lua/dist/src/lgc.c:1.8 src/external/mit/lua/dist/src/lgc.c:1.9
--- src/external/mit/lua/dist/src/lgc.c:1.8	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/lgc.c	Thu Sep  7 12:52:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lgc.c,v 1.8 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: lgc.c,v 1.9 2017/09/07 12:52:29 mbalmer Exp $	*/
 
 /*
 ** Id: lgc.c,v 2.215 2016/12/22 13:08:50 roberto Exp 
@@ -647,8 +647,9 @@ static void clearkeys (global_State *g, 
 for (n = gnode(h, 0); n < limit; n++) {
   if (!ttisnil(gval(n)) && (iscleared(g, gkey(n {
 setnilvalue(gval(n));  /* remove value ... */
-removeentry(n);  /* and remove entry from table */
   }
+  if (ttisnil(gval(n)))  /* is entry empty? */
+removeentry(n);  /* remove entry from table */
 }
   }
 }



CVS commit: src/external/mit/lua/dist/src

2017-08-03 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Thu Aug  3 13:40:07 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: ldebug.c

Log Message:
Apply a bug fix from lua.org/bugs.html:  Lua does not check GC when creating
error messages.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/ldebug.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/ldebug.c
diff -u src/external/mit/lua/dist/src/ldebug.c:1.9 src/external/mit/lua/dist/src/ldebug.c:1.10
--- src/external/mit/lua/dist/src/ldebug.c:1.9	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/ldebug.c	Thu Aug  3 13:40:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldebug.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: ldebug.c,v 1.10 2017/08/03 13:40:07 mbalmer Exp $	*/
 
 /*
 ** Id: ldebug.c,v 2.121 2016/10/19 12:32:10 roberto Exp 
@@ -661,6 +661,7 @@ l_noret luaG_runerror (lua_State *L, con
   CallInfo *ci = L->ci;
   const char *msg;
   va_list argp;
+  luaC_checkGC(L);  /* error message uses memory */
   va_start(argp, fmt);
   msg = luaO_pushvfstring(L, fmt, argp);  /* format message */
   va_end(argp);



CVS commit: src/external/mit/lua/dist/src

2017-05-20 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sat May 20 10:12:29 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lua.h

Log Message:
don't spam the console, just output the Lua version information as lua(1) does


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/lua.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lua.h
diff -u src/external/mit/lua/dist/src/lua.h:1.9 src/external/mit/lua/dist/src/lua.h:1.10
--- src/external/mit/lua/dist/src/lua.h:1.9	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/lua.h	Sat May 20 10:12:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua.h,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: lua.h,v 1.10 2017/05/20 10:12:29 mbalmer Exp $	*/
 
 /*
 ** Id: lua.h,v 1.332 2016/12/22 15:51:20 roberto Exp 
@@ -23,21 +23,11 @@
 #define LUA_VERSION_MAJOR	"5"
 #define LUA_VERSION_MINOR	"3"
 #define LUA_VERSION_NUM		503
-#ifndef _KERNEL
 #define LUA_VERSION_RELEASE	"4"
-#else /* _KERNEL */
-#define LUA_VERSION_RELEASE	"4 (kernel)"
-#endif /* _KERNEL */
 
 #define LUA_VERSION	"Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
 #define LUA_RELEASE	LUA_VERSION "." LUA_VERSION_RELEASE
-#ifndef _KERNEL
 #define LUA_COPYRIGHT	LUA_RELEASE "  Copyright (C) 1994-2017 Lua.org, PUC-Rio"
-#else /* _KERNEL */
-#define LUA_COPYRIGHT	LUA_RELEASE \
-	"  Copyright (c) 2016-2016, Lourival Vieira Neto ." \
-	"  Copyright (C) 1994-2017 Lua.org, PUC-Rio"
-#endif /* _KERNEL */
 #define LUA_AUTHORS	"R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
 
 



CVS commit: src/external/mit/lua/dist/src

2017-05-07 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun May  7 08:14:06 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lparser.c

Log Message:
Fix a bug that gerenates wrong code for a goto followed by a label inside an
'if' (see https://www.lua.org/bugs.html).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/lparser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lparser.c
diff -u src/external/mit/lua/dist/src/lparser.c:1.9 src/external/mit/lua/dist/src/lparser.c:1.10
--- src/external/mit/lua/dist/src/lparser.c:1.9	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/lparser.c	Sun May  7 08:14:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lparser.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: lparser.c,v 1.10 2017/05/07 08:14:06 mbalmer Exp $	*/
 
 /*
 ** Id: lparser.c,v 2.155 2016/08/01 19:51:24 roberto Exp 
@@ -1406,7 +1406,7 @@ static void test_then_block (LexState *l
 luaK_goiffalse(ls->fs, &v);  /* will jump to label if condition is true */
 enterblock(fs, &bl, 0);  /* must enter block before 'goto' */
 gotostat(ls, v.t);  /* handle goto/break */
-skipnoopstat(ls);  /* skip other no-op statements */
+while (testnext(ls, ';')) {}  /* skip colons */
 if (block_follow(ls, 0)) {  /* 'goto' is the entire block? */
   leaveblock(fs);
   return;  /* and that is it */



CVS commit: src/external/mit/lua/dist/src

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 13:53:18 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lauxlib.c

Log Message:
kernel mode lua has no floating point available


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/lauxlib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lauxlib.c
diff -u src/external/mit/lua/dist/src/lauxlib.c:1.9 src/external/mit/lua/dist/src/lauxlib.c:1.10
--- src/external/mit/lua/dist/src/lauxlib.c:1.9	Wed Apr 26 13:17:33 2017
+++ src/external/mit/lua/dist/src/lauxlib.c	Wed Apr 26 13:53:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lauxlib.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
+/*	$NetBSD: lauxlib.c,v 1.10 2017/04/26 13:53:18 mbalmer Exp $	*/
 
 /*
 ** Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp 
@@ -829,10 +829,14 @@ LUALIB_API const char *luaL_tolstring (l
   else {
 switch (lua_type(L, idx)) {
   case LUA_TNUMBER: {
+#ifndef _KERNEL
 if (lua_isinteger(L, idx))
+#endif
   lua_pushfstring(L, "%I", (LUAI_UACINT)lua_tointeger(L, idx));
+#ifndef _KERNEL
 else
   lua_pushfstring(L, "%f", (LUAI_UACNUMBER)lua_tonumber(L, idx));
+#endif
 break;
   }
   case LUA_TSTRING:
@@ -1052,8 +1056,10 @@ LUALIB_API void luaL_checkversion_ (lua_
 luaL_error(L, "core and library have incompatible numeric types");
   if (v != lua_version(NULL))
 luaL_error(L, "multiple Lua VMs detected");
+#ifndef _KERNEL
   else if (*v != ver)
 luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f",
   (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)*v);
+#endif
 }
 



CVS commit: src/external/mit/lua/dist/src

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 13:17:33 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lapi.c lapi.h lauxlib.c lbaselib.c
lbitlib.c lcode.c lcode.h lcorolib.c lctype.c lctype.h ldblib.c
ldebug.c ldebug.h ldo.c ldo.h ldump.c lfunc.c lfunc.h lgc.c lgc.h
linit.c liolib.c llex.c llex.h llimits.h lmathlib.c lmem.c lmem.h
loadlib.c lobject.c lobject.h lopcodes.c lopcodes.h loslib.c
lparser.c lparser.h lprefix.h lstate.c lstate.h lstring.c lstring.h
lstrlib.c ltable.c ltable.h ltablib.c ltm.c ltm.h lua.c lua.h
luac.c luaconf.h lualib.h lundump.c lundump.h lutf8lib.c lvm.c
lvm.h lzio.c lzio.h

Log Message:
import conflict resolution


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/lua/dist/src/lapi.c \
src/external/mit/lua/dist/src/lauxlib.c \
src/external/mit/lua/dist/src/lbaselib.c \
src/external/mit/lua/dist/src/ldebug.c \
src/external/mit/lua/dist/src/llimits.h \
src/external/mit/lua/dist/src/lobject.h \
src/external/mit/lua/dist/src/lparser.c \
src/external/mit/lua/dist/src/ltable.c \
src/external/mit/lua/dist/src/lua.h src/external/mit/lua/dist/src/luac.c \
src/external/mit/lua/dist/src/lvm.h
cvs rdiff -u -r1.7 -r1.8 src/external/mit/lua/dist/src/lapi.h \
src/external/mit/lua/dist/src/ldebug.h \
src/external/mit/lua/dist/src/ldo.c src/external/mit/lua/dist/src/ldo.h \
src/external/mit/lua/dist/src/ldump.c src/external/mit/lua/dist/src/lgc.c \
src/external/mit/lua/dist/src/linit.c \
src/external/mit/lua/dist/src/liolib.c \
src/external/mit/lua/dist/src/lmathlib.c \
src/external/mit/lua/dist/src/lmem.c \
src/external/mit/lua/dist/src/loadlib.c \
src/external/mit/lua/dist/src/lstate.c \
src/external/mit/lua/dist/src/lstate.h \
src/external/mit/lua/dist/src/lstring.c \
src/external/mit/lua/dist/src/lstring.h \
src/external/mit/lua/dist/src/ltablib.c \
src/external/mit/lua/dist/src/ltm.c src/external/mit/lua/dist/src/lua.c
cvs rdiff -u -r1.5 -r1.6 src/external/mit/lua/dist/src/lbitlib.c \
src/external/mit/lua/dist/src/lcorolib.c \
src/external/mit/lua/dist/src/lctype.c \
src/external/mit/lua/dist/src/lctype.h \
src/external/mit/lua/dist/src/lprefix.h \
src/external/mit/lua/dist/src/lualib.h \
src/external/mit/lua/dist/src/lundump.h
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/lcode.c \
src/external/mit/lua/dist/src/ldblib.c \
src/external/mit/lua/dist/src/loslib.c
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lcode.h \
src/external/mit/lua/dist/src/lfunc.c \
src/external/mit/lua/dist/src/lfunc.h src/external/mit/lua/dist/src/lgc.h \
src/external/mit/lua/dist/src/llex.h src/external/mit/lua/dist/src/lmem.h \
src/external/mit/lua/dist/src/lopcodes.c \
src/external/mit/lua/dist/src/lopcodes.h \
src/external/mit/lua/dist/src/lparser.h \
src/external/mit/lua/dist/src/ltable.h \
src/external/mit/lua/dist/src/ltm.h \
src/external/mit/lua/dist/src/lundump.c \
src/external/mit/lua/dist/src/lutf8lib.c \
src/external/mit/lua/dist/src/lzio.c src/external/mit/lua/dist/src/lzio.h
cvs rdiff -u -r1.10 -r1.11 src/external/mit/lua/dist/src/llex.c \
src/external/mit/lua/dist/src/lobject.c
cvs rdiff -u -r1.16 -r1.17 src/external/mit/lua/dist/src/lstrlib.c
cvs rdiff -u -r1.20 -r1.21 src/external/mit/lua/dist/src/luaconf.h
cvs rdiff -u -r1.12 -r1.13 src/external/mit/lua/dist/src/lvm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lapi.c
diff -u src/external/mit/lua/dist/src/lapi.c:1.8 src/external/mit/lua/dist/src/lapi.c:1.9
--- src/external/mit/lua/dist/src/lapi.c:1.8	Wed Apr 26 12:49:34 2017
+++ src/external/mit/lua/dist/src/lapi.c	Wed Apr 26 13:17:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapi.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $	*/
+/*	$NetBSD: lapi.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
 
 /*
 ** Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp 
Index: src/external/mit/lua/dist/src/lauxlib.c
diff -u src/external/mit/lua/dist/src/lauxlib.c:1.8 src/external/mit/lua/dist/src/lauxlib.c:1.9
--- src/external/mit/lua/dist/src/lauxlib.c:1.8	Wed Apr 26 12:49:34 2017
+++ src/external/mit/lua/dist/src/lauxlib.c	Wed Apr 26 13:17:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lauxlib.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $	*/
+/*	$NetBSD: lauxlib.c,v 1.9 2017/04/26 13:17:33 mbalmer Exp $	*/
 
 /*
 ** Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp 
Index: src/external/mit/lua/dist/src/lbaselib.c
diff -u src/external/mit/lua/dist/src/lbaselib.c:1.8 src/external/mit/lua/dist/src/lbaselib.c:1.9
--- src/external/mit/lua/dist/src/lbaselib.c:1.8	Wed Apr 26 12:49:34 2017
+++ src/external/mit/lua/dist/src/lbaselib.c	Wed Apr 26 13:17:33 2017
@@ -1,4 +1,4 @@

CVS commit: src/external/mit/lua/dist/src

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 13:09:12 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lauxlib.h

Log Message:
import conflict resolution


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lauxlib.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lauxlib.h
diff -u src/external/mit/lua/dist/src/lauxlib.h:1.6 src/external/mit/lua/dist/src/lauxlib.h:1.7
--- src/external/mit/lua/dist/src/lauxlib.h:1.6	Wed Apr 26 12:49:34 2017
+++ src/external/mit/lua/dist/src/lauxlib.h	Wed Apr 26 13:09:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lauxlib.h,v 1.6 2017/04/26 12:49:34 mbalmer Exp $	*/
+/*	$NetBSD: lauxlib.h,v 1.7 2017/04/26 13:09:12 mbalmer Exp $	*/
 
 /*
 ** Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp 



CVS commit: src/external/mit/lua/dist/src

2017-04-26 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Apr 26 12:49:35 UTC 2017

Modified Files:
src/external/mit/lua/dist/src: lapi.c lapi.h lauxlib.c lauxlib.h
lbaselib.c lbitlib.c lcode.c lcode.h lcorolib.c lctype.c lctype.h
ldblib.c ldebug.c ldebug.h ldo.c ldo.h ldump.c lfunc.c lfunc.h
lgc.c lgc.h linit.c liolib.c llex.c llex.h llimits.h lmathlib.c
lmem.c lmem.h loadlib.c lobject.c lobject.h lopcodes.c lopcodes.h
loslib.c lparser.c lparser.h lprefix.h lstate.c lstate.h lstring.c
lstring.h lstrlib.c ltable.c ltable.h ltablib.c ltm.c ltm.h lua.c
lua.h luac.c luaconf.h lualib.h lundump.c lundump.h lutf8lib.c
lvm.c lvm.h lzio.c lzio.h

Log Message:
resolve import conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/mit/lua/dist/src/lapi.c \
src/external/mit/lua/dist/src/lauxlib.c \
src/external/mit/lua/dist/src/lbaselib.c \
src/external/mit/lua/dist/src/ldebug.c \
src/external/mit/lua/dist/src/llimits.h \
src/external/mit/lua/dist/src/lobject.h \
src/external/mit/lua/dist/src/lparser.c \
src/external/mit/lua/dist/src/ltable.c \
src/external/mit/lua/dist/src/lua.h src/external/mit/lua/dist/src/luac.c \
src/external/mit/lua/dist/src/lvm.h
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lapi.h \
src/external/mit/lua/dist/src/ldebug.h \
src/external/mit/lua/dist/src/ldo.c src/external/mit/lua/dist/src/ldo.h \
src/external/mit/lua/dist/src/ldump.c src/external/mit/lua/dist/src/lgc.c \
src/external/mit/lua/dist/src/linit.c \
src/external/mit/lua/dist/src/liolib.c \
src/external/mit/lua/dist/src/lmathlib.c \
src/external/mit/lua/dist/src/lmem.c \
src/external/mit/lua/dist/src/loadlib.c \
src/external/mit/lua/dist/src/lstate.c \
src/external/mit/lua/dist/src/lstate.h \
src/external/mit/lua/dist/src/lstring.c \
src/external/mit/lua/dist/src/lstring.h \
src/external/mit/lua/dist/src/ltablib.c \
src/external/mit/lua/dist/src/ltm.c src/external/mit/lua/dist/src/lua.c
cvs rdiff -u -r1.5 -r1.6 src/external/mit/lua/dist/src/lauxlib.h \
src/external/mit/lua/dist/src/lcode.h \
src/external/mit/lua/dist/src/lfunc.c \
src/external/mit/lua/dist/src/lfunc.h src/external/mit/lua/dist/src/lgc.h \
src/external/mit/lua/dist/src/llex.h src/external/mit/lua/dist/src/lmem.h \
src/external/mit/lua/dist/src/lopcodes.c \
src/external/mit/lua/dist/src/lopcodes.h \
src/external/mit/lua/dist/src/lparser.h \
src/external/mit/lua/dist/src/ltable.h \
src/external/mit/lua/dist/src/ltm.h \
src/external/mit/lua/dist/src/lundump.c \
src/external/mit/lua/dist/src/lutf8lib.c \
src/external/mit/lua/dist/src/lzio.c src/external/mit/lua/dist/src/lzio.h
cvs rdiff -u -r1.4 -r1.5 src/external/mit/lua/dist/src/lbitlib.c \
src/external/mit/lua/dist/src/lcorolib.c \
src/external/mit/lua/dist/src/lctype.c \
src/external/mit/lua/dist/src/lctype.h \
src/external/mit/lua/dist/src/lprefix.h \
src/external/mit/lua/dist/src/lualib.h \
src/external/mit/lua/dist/src/lundump.h
cvs rdiff -u -r1.8 -r1.9 src/external/mit/lua/dist/src/lcode.c \
src/external/mit/lua/dist/src/ldblib.c \
src/external/mit/lua/dist/src/loslib.c
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/llex.c \
src/external/mit/lua/dist/src/lobject.c
cvs rdiff -u -r1.15 -r1.16 src/external/mit/lua/dist/src/lstrlib.c
cvs rdiff -u -r1.19 -r1.20 src/external/mit/lua/dist/src/luaconf.h
cvs rdiff -u -r1.11 -r1.12 src/external/mit/lua/dist/src/lvm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lapi.c
diff -u src/external/mit/lua/dist/src/lapi.c:1.7 src/external/mit/lua/dist/src/lapi.c:1.8
--- src/external/mit/lua/dist/src/lapi.c:1.7	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/src/lapi.c	Wed Apr 26 12:49:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapi.c,v 1.7 2016/09/08 02:21:31 salazar Exp $	*/
+/*	$NetBSD: lapi.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $	*/
 
 /*
 ** Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp 
Index: src/external/mit/lua/dist/src/lauxlib.c
diff -u src/external/mit/lua/dist/src/lauxlib.c:1.7 src/external/mit/lua/dist/src/lauxlib.c:1.8
--- src/external/mit/lua/dist/src/lauxlib.c:1.7	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/src/lauxlib.c	Wed Apr 26 12:49:34 2017
@@ -1,7 +1,7 @@
-/*	$NetBSD: lauxlib.c,v 1.7 2016/09/08 02:21:31 salazar Exp $	*/
+/*	$NetBSD: lauxlib.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $	*/
 
 /*
-** Id: lauxlib.c,v 1.286 2016/01/08 15:33:09 roberto Exp 
+** Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp 
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 */
@@ -75,12 +75,11 @@ static int findfield (lua_State *L, int 
 
 /*
 ** Search for a name for a function in

CVS commit: src/external/mit/lua/dist/src

2016-09-10 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sat Sep 10 09:31:24 UTC 2016

Modified Files:
src/external/mit/lua/dist/src: luaconf.h

Log Message:
Remove a typo, %i is not conversion specification.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.18 src/external/mit/lua/dist/src/luaconf.h:1.19
--- src/external/mit/lua/dist/src/luaconf.h:1.18	Sat Sep 10 09:29:13 2016
+++ src/external/mit/lua/dist/src/luaconf.h	Sat Sep 10 09:31:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: luaconf.h,v 1.18 2016/09/10 09:29:13 mbalmer Exp $	*/
+/*	$NetBSD: luaconf.h,v 1.19 2016/09/10 09:31:24 mbalmer Exp $	*/
 
 /*
 ** Id: luaconf.h,v 1.255 2016/05/01 20:06:09 roberto Exp 
@@ -770,7 +770,7 @@
 
 #ifdef __NetBSD__
 
-#define LUA_STRFTIMEOPTIONS "aAbBcCdDeFgGhHIjklmMnprRsStTuUvVwWxXyYzZi%"
+#define LUA_STRFTIMEOPTIONS "aAbBcCdDeFgGhHIjklmMnprRsStTuUvVwWxXyYzZ%"
 
 /* Integer types */
 #undef LUA_INTEGER



CVS commit: src/external/mit/lua/dist/src

2016-09-10 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sat Sep 10 09:29:14 UTC 2016

Modified Files:
src/external/mit/lua/dist/src: luaconf.h

Log Message:
Define LUA_STRFTIMEOPTIONS so that the conversion specifications of the Lua
os.date() function match the conversion specifications of the underlying
strftime() function.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.17 src/external/mit/lua/dist/src/luaconf.h:1.18
--- src/external/mit/lua/dist/src/luaconf.h:1.17	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/src/luaconf.h	Sat Sep 10 09:29:13 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: luaconf.h,v 1.17 2016/09/08 02:21:31 salazar Exp $	*/
+/*	$NetBSD: luaconf.h,v 1.18 2016/09/10 09:29:13 mbalmer Exp $	*/
 
 /*
 ** Id: luaconf.h,v 1.255 2016/05/01 20:06:09 roberto Exp 
@@ -770,6 +770,8 @@
 
 #ifdef __NetBSD__
 
+#define LUA_STRFTIMEOPTIONS "aAbBcCdDeFgGhHIjklmMnprRsStTuUvVwWxXyYzZi%"
+
 /* Integer types */
 #undef LUA_INTEGER
 #undef LUA_INTEGER_FRMLEN



CVS commit: src/external/mit/lua/dist/src

2016-09-08 Thread Guilherme Salazar
Module Name:src
Committed By:   salazar
Date:   Thu Sep  8 21:19:44 UTC 2016

Modified Files:
src/external/mit/lua/dist/src: loslib.c

Log Message:
fix code style issue


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/mit/lua/dist/src/loslib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/loslib.c
diff -u src/external/mit/lua/dist/src/loslib.c:1.7 src/external/mit/lua/dist/src/loslib.c:1.8
--- src/external/mit/lua/dist/src/loslib.c:1.7	Thu Sep  8 02:55:50 2016
+++ src/external/mit/lua/dist/src/loslib.c	Thu Sep  8 21:19:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: loslib.c,v 1.7 2016/09/08 02:55:50 salazar Exp $	*/
+/*	$NetBSD: loslib.c,v 1.8 2016/09/08 21:19:44 salazar Exp $	*/
 
 /*
 ** Id: loslib.c,v 1.64 2016/04/18 13:06:55 roberto Exp 
@@ -264,7 +264,7 @@ static const char *checkoption (lua_Stat
   int oplen = 1;
   int convlen = (int)strlen(conv);
   for (option = LUA_STRFTIMEOPTIONS; *option != '\0' && oplen <= convlen; option += oplen) {
-  if (*option == '|')  /* next block? */
+if (*option == '|')  /* next block? */
   oplen++;  /* next length */
 else if (memcmp(conv, option, oplen) == 0) {  /* match? */
   memcpy(buff, conv, oplen);  /* copy valid option to buffer */



CVS commit: src/external/mit/lua/dist/src

2016-09-08 Thread Guilherme Salazar
Module Name:src
Committed By:   salazar
Date:   Thu Sep  8 20:57:20 UTC 2016

Modified Files:
src/external/mit/lua/dist/src: lcode.c llex.c lstrlib.c

Log Message:
fix kernel Lua code style issues


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/mit/lua/dist/src/lcode.c
cvs rdiff -u -r1.8 -r1.9 src/external/mit/lua/dist/src/llex.c
cvs rdiff -u -r1.14 -r1.15 src/external/mit/lua/dist/src/lstrlib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lcode.c
diff -u src/external/mit/lua/dist/src/lcode.c:1.7 src/external/mit/lua/dist/src/lcode.c:1.8
--- src/external/mit/lua/dist/src/lcode.c:1.7	Thu Sep  8 02:57:32 2016
+++ src/external/mit/lua/dist/src/lcode.c	Thu Sep  8 20:57:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lcode.c,v 1.7 2016/09/08 02:57:32 salazar Exp $	*/
+/*	$NetBSD: lcode.c,v 1.8 2016/09/08 20:57:20 salazar Exp $	*/
 
 /*
 ** Id: lcode.c,v 2.109 2016/05/13 19:09:21 roberto Exp 
@@ -775,7 +775,7 @@ int luaK_exp2RK (FuncState *fs, expdesc 
 case VKINT: e->u.info = luaK_intK(fs, e->u.ival); goto vk;
 #ifndef _KERNEL
 case VKFLT: e->u.info = luaK_numberK(fs, e->u.nval); goto vk;
-#endif
+#endif /* _KERNEL */
 case VK:
  vk:
   e->k = VK;

Index: src/external/mit/lua/dist/src/llex.c
diff -u src/external/mit/lua/dist/src/llex.c:1.8 src/external/mit/lua/dist/src/llex.c:1.9
--- src/external/mit/lua/dist/src/llex.c:1.8	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/src/llex.c	Thu Sep  8 20:57:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: llex.c,v 1.8 2016/09/08 02:21:31 salazar Exp $	*/
+/*	$NetBSD: llex.c,v 1.9 2016/09/08 20:57:20 salazar Exp $	*/
 
 /*
 ** Id: llex.c,v 2.96 2016/05/02 14:02:12 roberto Exp 
@@ -213,6 +213,7 @@ static int check_next2 (LexState *ls, co
   else return 0;
 }
 
+
 #ifndef _KERNEL
 /* LUA_NUMBER */
 /*

Index: src/external/mit/lua/dist/src/lstrlib.c
diff -u src/external/mit/lua/dist/src/lstrlib.c:1.14 src/external/mit/lua/dist/src/lstrlib.c:1.15
--- src/external/mit/lua/dist/src/lstrlib.c:1.14	Thu Sep  8 02:51:53 2016
+++ src/external/mit/lua/dist/src/lstrlib.c	Thu Sep  8 20:57:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lstrlib.c,v 1.14 2016/09/08 02:51:53 salazar Exp $	*/
+/*	$NetBSD: lstrlib.c,v 1.15 2016/09/08 20:57:20 salazar Exp $	*/
 
 /*
 ** Id: lstrlib.c,v 1.251 2016/05/20 14:13:21 roberto Exp 
@@ -942,7 +942,7 @@ static void checkdp (char *buff, int nb)
 if (ppoint) *ppoint = '.';  /* change it to a dot */
   }
 }
-#endif
+#endif /* _KERNEL */
 
 
 static void addliteral (lua_State *L, luaL_Buffer *b, int arg) {
@@ -961,7 +961,7 @@ static void addliteral (lua_State *L, lu
 lua_Number n = lua_tonumber(L, arg);  /* write as hexa ('%a') */
 nb = lua_number2strx(L, buff, MAX_ITEM, "%" LUA_NUMBER_FRMLEN "a", n);
 checkdp(buff, nb);  /* ensure it uses a dot */
-#endif
+#endif /* _KERNEL */
   }
   else {  /* integers */
 lua_Integer n = lua_tointeger(L, arg);



CVS commit: src/external/mit/lua/dist/src

2016-09-07 Thread Guilherme Salazar
Module Name:src
Committed By:   salazar
Date:   Thu Sep  8 02:57:32 UTC 2016

Modified Files:
src/external/mit/lua/dist/src: lcode.c

Log Message:
fix bug 3 (for Lua.5.3.3) reported on www.lua.org/bugs.html


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lcode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lcode.c
diff -u src/external/mit/lua/dist/src/lcode.c:1.6 src/external/mit/lua/dist/src/lcode.c:1.7
--- src/external/mit/lua/dist/src/lcode.c:1.6	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/src/lcode.c	Thu Sep  8 02:57:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lcode.c,v 1.6 2016/09/08 02:21:31 salazar Exp $	*/
+/*	$NetBSD: lcode.c,v 1.7 2016/09/08 02:57:32 salazar Exp $	*/
 
 /*
 ** Id: lcode.c,v 2.109 2016/05/13 19:09:21 roberto Exp 
@@ -1046,8 +1046,8 @@ static void codeunexpval (FuncState *fs,
 */
 static void codebinexpval (FuncState *fs, OpCode op,
expdesc *e1, expdesc *e2, int line) {
-  int rk1 = luaK_exp2RK(fs, e1);  /* both operands are "RK" */
-  int rk2 = luaK_exp2RK(fs, e2);
+  int rk2 = luaK_exp2RK(fs, e2);  /* both operands are "RK" */
+  int rk1 = luaK_exp2RK(fs, e1);
   freeexps(fs, e1, e2);
   e1->u.info = luaK_codeABC(fs, op, 0, rk1, rk2);  /* generate opcode */
   e1->k = VRELOCABLE;  /* all those operations are relocatable */



CVS commit: src/external/mit/lua/dist/src

2016-09-07 Thread Guilherme Salazar
Module Name:src
Committed By:   salazar
Date:   Thu Sep  8 02:55:50 UTC 2016

Modified Files:
src/external/mit/lua/dist/src: loslib.c

Log Message:
fix bug 2 (for Lua.5.3.3) reported on www.lua.org/bugs.html


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/loslib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/loslib.c
diff -u src/external/mit/lua/dist/src/loslib.c:1.6 src/external/mit/lua/dist/src/loslib.c:1.7
--- src/external/mit/lua/dist/src/loslib.c:1.6	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/src/loslib.c	Thu Sep  8 02:55:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: loslib.c,v 1.6 2016/09/08 02:21:31 salazar Exp $	*/
+/*	$NetBSD: loslib.c,v 1.7 2016/09/08 02:55:50 salazar Exp $	*/
 
 /*
 ** Id: loslib.c,v 1.64 2016/04/18 13:06:55 roberto Exp 
@@ -262,8 +262,9 @@ static int getfield (lua_State *L, const
 static const char *checkoption (lua_State *L, const char *conv, char *buff) {
   const char *option;
   int oplen = 1;
-  for (option = LUA_STRFTIMEOPTIONS; *option != '\0'; option += oplen) {
-if (*option == '|')  /* next block? */
+  int convlen = (int)strlen(conv);
+  for (option = LUA_STRFTIMEOPTIONS; *option != '\0' && oplen <= convlen; option += oplen) {
+  if (*option == '|')  /* next block? */
   oplen++;  /* next length */
 else if (memcmp(conv, option, oplen) == 0) {  /* match? */
   memcpy(buff, conv, oplen);  /* copy valid option to buffer */



CVS commit: src/external/mit/lua/dist/src

2016-09-07 Thread Guilherme Salazar
Module Name:src
Committed By:   salazar
Date:   Thu Sep  8 02:53:39 UTC 2016

Modified Files:
src/external/mit/lua/dist/src: lparser.c

Log Message:
fix bug 1 reported on www.lua.org/bugs.html


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lparser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lparser.c
diff -u src/external/mit/lua/dist/src/lparser.c:1.6 src/external/mit/lua/dist/src/lparser.c:1.7
--- src/external/mit/lua/dist/src/lparser.c:1.6	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/src/lparser.c	Thu Sep  8 02:53:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lparser.c,v 1.6 2016/09/08 02:21:31 salazar Exp $	*/
+/*	$NetBSD: lparser.c,v 1.7 2016/09/08 02:53:39 salazar Exp $	*/
 
 /*
 ** Id: lparser.c,v 2.153 2016/05/13 19:10:16 roberto Exp 
@@ -327,6 +327,8 @@ static void adjust_assign (LexState *ls,
   luaK_nil(fs, reg, extra);
 }
   }
+  if (nexps > nvars)
+ls->fs->freereg -= nexps - nvars;  /* remove extra values */
 }
 
 
@@ -1174,11 +1176,8 @@ static void assignment (LexState *ls, st
 int nexps;
 checknext(ls, '=');
 nexps = explist(ls, &e);
-if (nexps != nvars) {
+if (nexps != nvars)
   adjust_assign(ls, nvars, nexps, &e);
-  if (nexps > nvars)
-ls->fs->freereg -= nexps - nvars;  /* remove extra values */
-}
 else {
   luaK_setoneret(ls->fs, &e);  /* close last expression */
   luaK_storevar(ls->fs, &lh->v, &e);



CVS commit: src/external/mit/lua/dist/src

2016-09-07 Thread Guilherme Salazar
Module Name:src
Committed By:   salazar
Date:   Thu Sep  8 02:51:53 UTC 2016

Modified Files:
src/external/mit/lua/dist/src: lstrlib.c

Log Message:
fix misplaced kernel Lua ifndef


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/mit/lua/dist/src/lstrlib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lstrlib.c
diff -u src/external/mit/lua/dist/src/lstrlib.c:1.13 src/external/mit/lua/dist/src/lstrlib.c:1.14
--- src/external/mit/lua/dist/src/lstrlib.c:1.13	Thu Sep  8 02:21:31 2016
+++ src/external/mit/lua/dist/src/lstrlib.c	Thu Sep  8 02:51:53 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lstrlib.c,v 1.13 2016/09/08 02:21:31 salazar Exp $	*/
+/*	$NetBSD: lstrlib.c,v 1.14 2016/09/08 02:51:53 salazar Exp $	*/
 
 /*
 ** Id: lstrlib.c,v 1.251 2016/05/20 14:13:21 roberto Exp 
@@ -956,22 +956,20 @@ static void addliteral (lua_State *L, lu
 case LUA_TNUMBER: {
   char *buff = luaL_prepbuffsize(b, MAX_ITEM);
   int nb;
-#ifndef _KERNEL
   if (!lua_isinteger(L, arg)) {  /* float? */
+#ifndef _KERNEL
 lua_Number n = lua_tonumber(L, arg);  /* write as hexa ('%a') */
 nb = lua_number2strx(L, buff, MAX_ITEM, "%" LUA_NUMBER_FRMLEN "a", n);
 checkdp(buff, nb);  /* ensure it uses a dot */
+#endif
   }
   else {  /* integers */
-#else
-  {
 lua_Integer n = lua_tointeger(L, arg);
 const char *format = (n == LUA_MININTEGER)  /* corner case? */
? "0x%" LUA_INTEGER_FRMLEN "x"  /* use hexa */
: LUA_INTEGER_FMT;  /* else use default format */
 nb = l_sprintf(buff, MAX_ITEM, format, n);
   }
-#endif
   luaL_addsize(b, nb);
   break;
 }



CVS commit: src/external/mit/lua/dist/src

2016-03-25 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Fri Mar 25 08:15:20 UTC 2016

Modified Files:
src/external/mit/lua/dist/src: lparser.c lstrlib.c

Log Message:
Apply second and third patch from http://lua.org/bugs.html.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/mit/lua/dist/src/lparser.c
cvs rdiff -u -r1.11 -r1.12 src/external/mit/lua/dist/src/lstrlib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lparser.c
diff -u src/external/mit/lua/dist/src/lparser.c:1.4 src/external/mit/lua/dist/src/lparser.c:1.5
--- src/external/mit/lua/dist/src/lparser.c:1.4	Thu Jan 28 14:41:39 2016
+++ src/external/mit/lua/dist/src/lparser.c	Fri Mar 25 08:15:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lparser.c,v 1.4 2016/01/28 14:41:39 lneto Exp $	*/
+/*	$NetBSD: lparser.c,v 1.5 2016/03/25 08:15:20 mbalmer Exp $	*/
 
 /*
 ** Id: lparser.c,v 2.149 2015/11/02 16:09:30 roberto Exp 
@@ -1240,7 +1240,7 @@ static void labelstat (LexState *ls, TSt
   checkrepeated(fs, ll, label);  /* check for repeated labels */
   checknext(ls, TK_DBCOLON);  /* skip double colon */
   /* create new entry for this label */
-  l = newlabelentry(ls, ll, label, line, fs->pc);
+  l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs));
   skipnoopstat(ls);  /* skip other no-op statements */
   if (block_follow(ls, 0)) {  /* label is last no-op statement in the block? */
 /* assume that locals are already out of scope */

Index: src/external/mit/lua/dist/src/lstrlib.c
diff -u src/external/mit/lua/dist/src/lstrlib.c:1.11 src/external/mit/lua/dist/src/lstrlib.c:1.12
--- src/external/mit/lua/dist/src/lstrlib.c:1.11	Thu Jan 28 14:41:39 2016
+++ src/external/mit/lua/dist/src/lstrlib.c	Fri Mar 25 08:15:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lstrlib.c,v 1.11 2016/01/28 14:41:39 lneto Exp $	*/
+/*	$NetBSD: lstrlib.c,v 1.12 2016/03/25 08:15:20 mbalmer Exp $	*/
 
 /*
 ** Id: lstrlib.c,v 1.239 2015/11/25 16:28:17 roberto Exp 
@@ -692,6 +692,7 @@ typedef struct GMatchState {
 static int gmatch_aux (lua_State *L) {
   GMatchState *gm = (GMatchState *)lua_touserdata(L, lua_upvalueindex(3));
   const char *src;
+  gm->ms.L = L;
   for (src = gm->src; src <= gm->ms.src_end; src++) {
 const char *e;
 reprepstate(&gm->ms);



CVS commit: src/external/mit/lua/dist/src

2016-01-28 Thread Lourival Pereira Vieira Neto
Module Name:src
Committed By:   lneto
Date:   Thu Jan 28 17:23:21 UTC 2016

Modified Files:
src/external/mit/lua/dist/src: lvm.c

Log Message:
fixed metatable access to deallocated field

author: Lua.org 
see: http://www.lua.org/bugs.html#5.3.2-1


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/lvm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lvm.c
diff -u src/external/mit/lua/dist/src/lvm.c:1.9 src/external/mit/lua/dist/src/lvm.c:1.10
--- src/external/mit/lua/dist/src/lvm.c:1.9	Thu Jan 28 14:41:39 2016
+++ src/external/mit/lua/dist/src/lvm.c	Thu Jan 28 17:23:21 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lvm.c,v 1.9 2016/01/28 14:41:39 lneto Exp $	*/
+/*	$NetBSD: lvm.c,v 1.10 2016/01/28 17:23:21 lneto Exp $	*/
 
 /*
 ** Id: lvm.c,v 2.265 2015/11/23 11:30:45 roberto Exp 
@@ -203,18 +203,19 @@ void luaV_finishset (lua_State *L, const
   for (loop = 0; loop < MAXTAGLOOP; loop++) {
 const TValue *tm;
 if (oldval != NULL) {
-  lua_assert(ttistable(t) && ttisnil(oldval));
+  Table *h = hvalue(t);  /* save 't' table */
+  lua_assert(ttisnil(oldval));
   /* must check the metamethod */
-  if ((tm = fasttm(L, hvalue(t)->metatable, TM_NEWINDEX)) == NULL &&
+  if ((tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL &&
  /* no metamethod; is there a previous entry in the table? */
  (oldval != luaO_nilobject ||
  /* no previous entry; must create one. (The next test is
 always true; we only need the assignment.) */
- (oldval = luaH_newkey(L, hvalue(t), key), 1))) {
+ (oldval = luaH_newkey(L, h, key), 1))) {
 /* no metamethod and (now) there is an entry with given key */
 setobj2t(L, cast(TValue *, oldval), val);
-invalidateTMcache(hvalue(t));
-luaC_barrierback(L, hvalue(t), val);
+invalidateTMcache(h);
+luaC_barrierback(L, h, val);
 return;
   }
   /* else will try the metamethod */



CVS commit: src/external/mit/lua/dist/src

2015-10-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 14 01:49:46 UTC 2015

Modified Files:
src/external/mit/lua/dist/src: lobject.h

Log Message:
Add a coverity annotation; string bytes follow the struct. It would be
better to add a char bytes[]; at the end of the struct.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/mit/lua/dist/src/lobject.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lobject.h
diff -u src/external/mit/lua/dist/src/lobject.h:1.4 src/external/mit/lua/dist/src/lobject.h:1.5
--- src/external/mit/lua/dist/src/lobject.h:1.4	Thu Oct  8 09:21:00 2015
+++ src/external/mit/lua/dist/src/lobject.h	Tue Oct 13 21:49:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lobject.h,v 1.4 2015/10/08 13:21:00 mbalmer Exp $	*/
+/*	$NetBSD: lobject.h,v 1.5 2015/10/14 01:49:46 christos Exp $	*/
 
 /*
 ** Id: lobject.h,v 2.111 2015/06/09 14:21:42 roberto Exp 
@@ -343,7 +343,7 @@ typedef union UTString {
 ** Get the actual string (array of bytes) from a 'TString'.
 ** (Access to 'extra' ensures that value is really a 'TString'.)
 */
-#define getaddrstr(ts)	(cast(char *, (ts)) + sizeof(UTString))
+#define getaddrstr(ts)	(/*coverity[overrun]*/cast(char *, (ts)) + sizeof(UTString))
 #define getstr(ts)  \
   check_exp(sizeof((ts)->extra), cast(const char*, getaddrstr(ts)))
 



CVS commit: src/external/mit/lua/dist/src

2015-10-11 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun Oct 11 09:21:15 UTC 2015

Modified Files:
src/external/mit/lua/dist/src: lvm.c

Log Message:
no floating point in the kernel, also make sure we always return an int


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/mit/lua/dist/src/lvm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lvm.c
diff -u src/external/mit/lua/dist/src/lvm.c:1.7 src/external/mit/lua/dist/src/lvm.c:1.8
--- src/external/mit/lua/dist/src/lvm.c:1.7	Thu Oct  8 13:40:16 2015
+++ src/external/mit/lua/dist/src/lvm.c	Sun Oct 11 09:21:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lvm.c,v 1.7 2015/10/08 13:40:16 mbalmer Exp $	*/
+/*	$NetBSD: lvm.c,v 1.8 2015/10/11 09:21:15 mbalmer Exp $	*/
 
 /*
 ** Id: lvm.c,v 2.245 2015/06/09 15:53:35 roberto Exp 
@@ -315,16 +315,17 @@ static int LEintfloat (lua_Integer i, lu
 ** Return 'l < r', for numbers.
 */
 static int LTnum (const TValue *l, const TValue *r) {
+#ifdef _KERNEL
+lua_Integer li = ivalue(l);
+return li < ivalue(r);  /* both must be integers */
+#else
   if (ttisinteger(l)) {
 lua_Integer li = ivalue(l);
 if (ttisinteger(r))
   return li < ivalue(r);  /* both are integers */
-#ifndef _KERNEL
 else  /* 'l' is int and 'r' is float */
   return LTintfloat(li, fltvalue(r));  /* l < r ? */
-#endif
   }
-#ifndef _KERNEL
   else {
 lua_Number lf = fltvalue(l);  /* 'l' must be float */
 if (ttisfloat(r))
@@ -342,16 +343,17 @@ static int LTnum (const TValue *l, const
 ** Return 'l <= r', for numbers.
 */
 static int LEnum (const TValue *l, const TValue *r) {
+#ifdef _KERNEL
+lua_Integer li = ivalue(l);
+return li <= ivalue(r);  /* both must be integers */
+#else
   if (ttisinteger(l)) {
 lua_Integer li = ivalue(l);
 if (ttisinteger(r))
   return li <= ivalue(r);  /* both are integers */
-#ifndef _KERNEL
 else  /* 'l' is int and 'r' is float */
   return LEintfloat(li, fltvalue(r));  /* l <= r ? */
-#endif
   }
-#ifndef _KERNEL
   else {
 lua_Number lf = fltvalue(l);  /* 'l' must be float */
 if (ttisfloat(r))



CVS commit: src/external/mit/lua/dist/src

2015-10-11 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun Oct 11 09:06:21 UTC 2015

Modified Files:
src/external/mit/lua/dist/src: lobject.c

Log Message:
fix macro usage


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lobject.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lobject.c
diff -u src/external/mit/lua/dist/src/lobject.c:1.6 src/external/mit/lua/dist/src/lobject.c:1.7
--- src/external/mit/lua/dist/src/lobject.c:1.6	Sun Oct 11 01:01:45 2015
+++ src/external/mit/lua/dist/src/lobject.c	Sun Oct 11 09:06:21 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lobject.c,v 1.6 2015/10/11 01:01:45 christos Exp $	*/
+/*	$NetBSD: lobject.c,v 1.7 2015/10/11 09:06:21 mbalmer Exp $	*/
 
 /*
 ** Id: lobject.c,v 2.104 2015/04/11 18:30:08 roberto Exp 
@@ -370,7 +370,7 @@ void luaO_tostring (lua_State *L, StkId 
   }
 #else /* _KERNEL */
   lua_assert(ttisinteger(obj));
-  len = lua_integer2str(buff, ivalue(obj));
+  len = lua_integer2str(buff, sizeof(buff), ivalue(obj));
 #endif
   setsvalue2s(L, obj, luaS_newlstr(L, buff, len));
 }



CVS commit: src/external/mit/lua/dist/src

2015-10-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 11 01:01:46 UTC 2015

Modified Files:
src/external/mit/lua/dist/src: lobject.c lstrlib.c luac.c luaconf.h

Log Message:
Get rid of the sprintf() bogus macro and use lengths explicitly when buffers
are involved.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/mit/lua/dist/src/lobject.c
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/lstrlib.c
cvs rdiff -u -r1.4 -r1.5 src/external/mit/lua/dist/src/luac.c
cvs rdiff -u -r1.14 -r1.15 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lobject.c
diff -u src/external/mit/lua/dist/src/lobject.c:1.5 src/external/mit/lua/dist/src/lobject.c:1.6
--- src/external/mit/lua/dist/src/lobject.c:1.5	Thu Oct  8 09:21:00 2015
+++ src/external/mit/lua/dist/src/lobject.c	Sat Oct 10 21:01:45 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lobject.c,v 1.5 2015/10/08 13:21:00 mbalmer Exp $	*/
+/*	$NetBSD: lobject.c,v 1.6 2015/10/11 01:01:45 christos Exp $	*/
 
 /*
 ** Id: lobject.c,v 2.104 2015/04/11 18:30:08 roberto Exp 
@@ -358,9 +358,9 @@ void luaO_tostring (lua_State *L, StkId 
   lua_assert(ttisnumber(obj));
 #ifndef _KERNEL
   if (ttisinteger(obj))
-len = lua_integer2str(buff, ivalue(obj));
+len = lua_integer2str(buff, sizeof(buff), ivalue(obj));
   else {
-len = lua_number2str(buff, fltvalue(obj));
+len = lua_number2str(buff, sizeof(buff), fltvalue(obj));
 #if !defined(LUA_COMPAT_FLOATSTRING)
 if (buff[strspn(buff, "-0123456789")] == '\0') {  /* looks like an int? */
   buff[len++] = lua_getlocaledecpoint();
@@ -424,7 +424,7 @@ const char *luaO_pushvfstring (lua_State
 #endif
   case 'p': {
 char buff[4*sizeof(void *) + 8]; /* should be enough space for a '%p' */
-int l = sprintf(buff, "%p", va_arg(argp, void *));
+int l = snprintf(buff, sizeof(buff), "%p", va_arg(argp, void *));
 pushstr(L, buff, l);
 break;
   }

Index: src/external/mit/lua/dist/src/lstrlib.c
diff -u src/external/mit/lua/dist/src/lstrlib.c:1.9 src/external/mit/lua/dist/src/lstrlib.c:1.10
--- src/external/mit/lua/dist/src/lstrlib.c:1.9	Thu Oct  8 09:40:16 2015
+++ src/external/mit/lua/dist/src/lstrlib.c	Sat Oct 10 21:01:45 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lstrlib.c,v 1.9 2015/10/08 13:40:16 mbalmer Exp $	*/
+/*	$NetBSD: lstrlib.c,v 1.10 2015/10/11 01:01:45 christos Exp $	*/
 
 /*
 ** Id: lstrlib.c,v 1.229 2015/05/20 17:39:23 roberto Exp 
@@ -834,12 +834,12 @@ static lua_Number adddigit (char *buff, 
 }
 
 
-static int num2straux (char *buff, lua_Number x) {
+static int num2straux (char *buff, size_t len, lua_Number x) {
   if (x != x || x == HUGE_VAL || x == -HUGE_VAL)  /* inf or NaN? */
-return sprintf(buff, LUA_NUMBER_FMT, x);  /* equal to '%g' */
+return snprintf(buff, len, LUA_NUMBER_FMT, x);  /* equal to '%g' */
   else if (x == 0) {  /* can be -0... */
-sprintf(buff, LUA_NUMBER_FMT, x);
-strcat(buff, "x0p+0");  /* reuses '0/-0' from 'sprintf'... */
+snprintf(buff, len, LUA_NUMBER_FMT, x);
+strlcat(buff, "x0p+0", len);  /* reuses '0/-0' from 'snprintf'... */
 return strlen(buff);
   }
   else {
@@ -859,7 +859,8 @@ static int num2straux (char *buff, lua_N
 m = adddigit(buff, n++, m * 16);
   } while (m > 0);
 }
-n += sprintf(buff + n, "p%+d", e);  /* add exponent */
+if (len > (size_t)n)
+	n += snprintf(buff + n, len - n, "p%+d", e);  /* add exponent */
 return n;
   }
 }
@@ -913,9 +914,9 @@ static void addquoted (lua_State *L, lua
 else if (*s == '\0' || iscntrl(uchar(*s))) {
   char buff[10];
   if (!isdigit(uchar(*(s+1
-sprintf(buff, "\\%d", (int)uchar(*s));
+snprintf(buff, sizeof(buff), "\\%d", (int)uchar(*s));
   else
-sprintf(buff, "\\%03d", (int)uchar(*s));
+snprintf(buff, sizeof(buff), "\\%03d", (int)uchar(*s));
   luaL_addstring(b, buff);
 }
 else
@@ -982,25 +983,25 @@ static int str_format (lua_State *L) {
   strfrmt = scanformat(L, strfrmt, form);
   switch (*strfrmt++) {
 case 'c': {
-  nb = sprintf(buff, form, (int)luaL_checkinteger(L, arg));
+  nb = snprintf(buff, MAX_ITEM, form, (int)luaL_checkinteger(L, arg));
   break;
 }
 case 'd': case 'i':
 case 'o': case 'u': case 'x': case 'X': {
   lua_Integer n = luaL_checkinteger(L, arg);
   addlenmod(form, LUA_INTEGER_FRMLEN);
-  nb = sprintf(buff, form, n);
+  nb = snprintf(buff, MAX_ITEM, form, n);
   break;
 }
 #ifndef _KERNEL
 case 'a': case 'A':
   addlenmod(form, LUA_NUMBER_FRMLEN);
-  nb = lua_number2strx(L, buff, form, luaL_checknumber(L, arg));
+  nb = lua_number2strx(L, buff, MAX_ITEM, form, luaL_checknumber(L, arg));
   break;
 case 'e

CVS commit: src/external/mit/lua/dist/src

2015-10-08 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Thu Oct  8 13:40:16 UTC 2015

Modified Files:
src/external/mit/lua/dist/src: llex.c lstrlib.c ltable.c lvm.c lvm.h

Log Message:
fix kernel module build


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/mit/lua/dist/src/llex.c
cvs rdiff -u -r1.8 -r1.9 src/external/mit/lua/dist/src/lstrlib.c
cvs rdiff -u -r1.4 -r1.5 src/external/mit/lua/dist/src/ltable.c \
src/external/mit/lua/dist/src/lvm.h
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lvm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/llex.c
diff -u src/external/mit/lua/dist/src/llex.c:1.5 src/external/mit/lua/dist/src/llex.c:1.6
--- src/external/mit/lua/dist/src/llex.c:1.5	Thu Oct  8 13:21:00 2015
+++ src/external/mit/lua/dist/src/llex.c	Thu Oct  8 13:40:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: llex.c,v 1.5 2015/10/08 13:21:00 mbalmer Exp $	*/
+/*	$NetBSD: llex.c,v 1.6 2015/10/08 13:40:16 mbalmer Exp $	*/
 
 /*
 ** Id: llex.c,v 2.93 2015/05/22 17:45:56 roberto Exp 
@@ -227,7 +227,7 @@ static void buffreplace (LexState *ls, c
   if (p[n] == from) p[n] = to;
   }
 }
-
+#endif
 
 #define buff2num(b,o)	(luaO_str2num(luaZ_buffer(b), o) != 0)
 

Index: src/external/mit/lua/dist/src/lstrlib.c
diff -u src/external/mit/lua/dist/src/lstrlib.c:1.8 src/external/mit/lua/dist/src/lstrlib.c:1.9
--- src/external/mit/lua/dist/src/lstrlib.c:1.8	Thu Oct  8 13:21:00 2015
+++ src/external/mit/lua/dist/src/lstrlib.c	Thu Oct  8 13:40:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lstrlib.c,v 1.8 2015/10/08 13:21:00 mbalmer Exp $	*/
+/*	$NetBSD: lstrlib.c,v 1.9 2015/10/08 13:40:16 mbalmer Exp $	*/
 
 /*
 ** Id: lstrlib.c,v 1.229 2015/05/20 17:39:23 roberto Exp 
@@ -886,8 +886,11 @@ static int lua_number2strx (lua_State *L
 ** by format('%.99f', minfloat), and is equal to 99 + 2 ('-' and '.') +
 ** number of decimal digits to represent minfloat.
 */
+#ifndef _KERNEL
 #define MAX_ITEM	(120 + l_mathlim(MAX_10_EXP))
-
+#else
+#define MAX_ITEM	(120)
+#endif
 
 /* valid flags in a format specification */
 #define FLAGS	"-+ #0"

Index: src/external/mit/lua/dist/src/ltable.c
diff -u src/external/mit/lua/dist/src/ltable.c:1.4 src/external/mit/lua/dist/src/ltable.c:1.5
--- src/external/mit/lua/dist/src/ltable.c:1.4	Thu Oct  8 13:21:00 2015
+++ src/external/mit/lua/dist/src/ltable.c	Thu Oct  8 13:40:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ltable.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $	*/
+/*	$NetBSD: ltable.c,v 1.5 2015/10/08 13:40:16 mbalmer Exp $	*/
 
 /*
 ** Id: ltable.c,v 2.111 2015/06/09 14:21:13 roberto Exp 
@@ -116,7 +116,7 @@ static int l_hashfloat (lua_Number n) {
   }
 }
 #endif
-
+#endif /*_KERNEL */
 
 /*
 ** returns the 'main' position of an element in a table (that is, the index
Index: src/external/mit/lua/dist/src/lvm.h
diff -u src/external/mit/lua/dist/src/lvm.h:1.4 src/external/mit/lua/dist/src/lvm.h:1.5
--- src/external/mit/lua/dist/src/lvm.h:1.4	Thu Oct  8 13:21:00 2015
+++ src/external/mit/lua/dist/src/lvm.h	Thu Oct  8 13:40:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lvm.h,v 1.4 2015/10/08 13:21:00 mbalmer Exp $	*/
+/*	$NetBSD: lvm.h,v 1.5 2015/10/08 13:40:16 mbalmer Exp $	*/
 
 /*
 ** Id: lvm.h,v 2.35 2015/02/20 14:27:53 roberto Exp 
@@ -29,7 +29,6 @@
 #endif
 
 
-#ifndef _KERNEL
 /*
 ** You can define LUA_FLOORN2I if you want to convert floats to integers
 ** by flooring them (instead of raising an error if they are not
@@ -40,6 +39,7 @@
 #endif
 
 
+#ifndef _KERNEL
 #define tonumber(o,n) \
 	(ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n))
 #else /* _KERNEL */

Index: src/external/mit/lua/dist/src/lvm.c
diff -u src/external/mit/lua/dist/src/lvm.c:1.6 src/external/mit/lua/dist/src/lvm.c:1.7
--- src/external/mit/lua/dist/src/lvm.c:1.6	Thu Oct  8 13:21:00 2015
+++ src/external/mit/lua/dist/src/lvm.c	Thu Oct  8 13:40:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lvm.c,v 1.6 2015/10/08 13:21:00 mbalmer Exp $	*/
+/*	$NetBSD: lvm.c,v 1.7 2015/10/08 13:40:16 mbalmer Exp $	*/
 
 /*
 ** Id: lvm.c,v 2.245 2015/06/09 15:53:35 roberto Exp 
@@ -39,7 +39,7 @@
 #define MAXTAGLOOP	2000
 
 
-
+#ifndef _KERNEL
 /*
 ** 'l_intfitsf' checks whether a given integer can be converted to a
 ** float without rounding. Used in comparisons. Left undefined if
@@ -66,6 +66,7 @@
 #endif
 
 #endif
+#endif /*_KERNEL */
 
 #ifndef _KERNEL
 /*
@@ -126,8 +127,8 @@ int luaV_tointeger (const TValue *obj, l
 }
 
 
-/*
 #ifndef _KERNEL
+/*
 ** Try to convert a 'for' limit to an integer, preserving the
 ** semantics of the loop.
 ** (The following explanation assumes a non-negative step; it is valid
@@ -318,9 +319,12 @@ static int LTnum (const TValue *l, const
 lua_Integer li = ivalue(l);
 if (ttisinteger(r))
   return li < ivalue(r);  /* both are integers */
+#ifndef _KERNEL
 else  /* 'l' is int and 'r' is float */
   return LTintfloat(li, fltvalue(r));  /* l < r ? */
+#endi

CVS commit: src/external/mit/lua/dist/src

2015-10-08 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Thu Oct  8 12:40:05 UTC 2015

Modified Files:
src/external/mit/lua/dist/src: ldblib.c

Log Message:
Resolve conflicts.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/mit/lua/dist/src/ldblib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/ldblib.c
diff -u src/external/mit/lua/dist/src/ldblib.c:1.5 src/external/mit/lua/dist/src/ldblib.c:1.6
--- src/external/mit/lua/dist/src/ldblib.c:1.5	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/ldblib.c	Thu Oct  8 12:40:05 2015
@@ -1,7 +1,7 @@
-/*	$NetBSD: ldblib.c,v 1.5 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: ldblib.c,v 1.6 2015/10/08 12:40:05 mbalmer Exp $	*/
 
 /*
-** Id: ldblib.c,v 1.148 2015/01/02 12:52:22 roberto Exp 
+** Id: ldblib.c,v 1.149 2015/02/19 17:06:21 roberto Exp 
 ** Interface from Lua to its debug API
 ** See Copyright Notice in lua.h
 */
@@ -31,6 +31,17 @@
 static const int HOOKKEY = 0;
 
 
+/*
+** If L1 != L, L1 can be in any state, and therefore there is no
+** garanties about its stack space; any push in L1 must be
+** checked.
+*/
+static void checkstack (lua_State *L, lua_State *L1, int n) {
+  if (L != L1 && !lua_checkstack(L1, n))
+luaL_error(L, "stack overflow");
+}
+
+
 static int db_getregistry (lua_State *L) {
   lua_pushvalue(L, LUA_REGISTRYINDEX);
   return 1;
@@ -131,12 +142,16 @@ static void treatstackoption (lua_State 
 
 /*
 ** Calls 'lua_getinfo' and collects all results in a new table.
+** L1 needs stack space for an optional input (function) plus
+** two optional outputs (function and line table) from function
+** 'lua_getinfo'.
 */
 static int db_getinfo (lua_State *L) {
   lua_Debug ar;
   int arg;
   lua_State *L1 = getthread(L, &arg);
   const char *options = luaL_optstring(L, arg+2, "flnStu");
+  checkstack(L, L1, 3);
   if (lua_isfunction(L, arg + 1)) {  /* info about a function? */
 options = lua_pushfstring(L, ">%s", options);  /* add '>' to 'options' */
 lua_pushvalue(L, arg + 1);  /* move function to 'L1' stack */
@@ -194,6 +209,7 @@ static int db_getlocal (lua_State *L) {
 int level = (int)luaL_checkinteger(L, arg + 1);
 if (!lua_getstack(L1, level, &ar))  /* out of range? */
   return luaL_argerror(L, arg+1, "level out of range");
+checkstack(L, L1, 1);
 name = lua_getlocal(L1, &ar, nvar);
 if (name) {
   lua_xmove(L1, L, 1);  /* move local value */
@@ -220,6 +236,7 @@ static int db_setlocal (lua_State *L) {
 return luaL_argerror(L, arg+1, "level out of range");
   luaL_checkany(L, arg+3);
   lua_settop(L, arg+3);
+  checkstack(L, L1, 1);
   lua_xmove(L, L1, 1);
   name = lua_setlocal(L1, &ar, nvar);
   if (name == NULL)
@@ -354,6 +371,7 @@ static int db_sethook (lua_State *L) {
 lua_pushvalue(L, -1);
 lua_setmetatable(L, -2);  /* setmetatable(hooktable) = hooktable */
   }
+  checkstack(L, L1, 1);
   lua_pushthread(L1); lua_xmove(L1, L, 1);  /* key (thread) */
   lua_pushvalue(L, arg + 1);  /* value (hook function) */
   lua_rawset(L, -3);  /* hooktable[L1] = new Lua hook */
@@ -374,6 +392,7 @@ static int db_gethook (lua_State *L) {
 lua_pushliteral(L, "external hook");
   else {  /* hook table must exist */
 lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY);
+checkstack(L, L1, 1);
 lua_pushthread(L1); lua_xmove(L1, L, 1);
 lua_rawget(L, -2);   /* 1st result = hooktable[L1] */
 lua_remove(L, -2);  /* remove hook table */



CVS commit: src/external/mit/lua/dist/src

2015-02-18 Thread Lourival Pereira Vieira Neto
Module Name:src
Committed By:   lneto
Date:   Thu Feb 19 04:46:22 UTC 2015

Modified Files:
src/external/mit/lua/dist/src: lapi.c ldebug.c llex.c llimits.h
lstrlib.c lua.h luaconf.h lvm.c

Log Message:
lua(4): small fixes in kernel Lua

* fixed hex parsing
* restored lua_isnumber
* removed unwanted macros from luaconf.h
* restored  include in ldebug.c
* removed doubles from unions
* removed unused functions


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/mit/lua/dist/src/lapi.c \
src/external/mit/lua/dist/src/ldebug.c \
src/external/mit/lua/dist/src/llex.c \
src/external/mit/lua/dist/src/llimits.h \
src/external/mit/lua/dist/src/lua.h
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/lstrlib.c
cvs rdiff -u -r1.12 -r1.13 src/external/mit/lua/dist/src/luaconf.h
cvs rdiff -u -r1.4 -r1.5 src/external/mit/lua/dist/src/lvm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lapi.c
diff -u src/external/mit/lua/dist/src/lapi.c:1.3 src/external/mit/lua/dist/src/lapi.c:1.4
--- src/external/mit/lua/dist/src/lapi.c:1.3	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/lapi.c	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapi.c,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: lapi.c,v 1.4 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: lapi.c,v 2.244 2014/12/26 14:43:45 roberto Exp 
@@ -276,13 +276,11 @@ LUA_API int lua_isinteger (lua_State *L,
 }
 
 
-#ifndef _KERNEL
 LUA_API int lua_isnumber (lua_State *L, int idx) {
   lua_Number n;
   const TValue *o = index2addr(L, idx);
   return tonumber(o, &n);
 }
-#endif
 
 
 LUA_API int lua_isstring (lua_State *L, int idx) {
Index: src/external/mit/lua/dist/src/ldebug.c
diff -u src/external/mit/lua/dist/src/ldebug.c:1.3 src/external/mit/lua/dist/src/ldebug.c:1.4
--- src/external/mit/lua/dist/src/ldebug.c:1.3	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/ldebug.c	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldebug.c,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: ldebug.c,v 1.4 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: ldebug.c,v 2.110 2015/01/02 12:52:22 roberto Exp 
@@ -12,8 +12,8 @@
 #include "lprefix.h"
 
 
-#ifndef _KERNEL
 #include 
+#ifndef _KERNEL
 #include 
 #include 
 #endif
Index: src/external/mit/lua/dist/src/llex.c
diff -u src/external/mit/lua/dist/src/llex.c:1.3 src/external/mit/lua/dist/src/llex.c:1.4
--- src/external/mit/lua/dist/src/llex.c:1.3	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/llex.c	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: llex.c,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: llex.c,v 1.4 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: llex.c,v 2.89 2014/11/14 16:06:09 roberto Exp 
@@ -202,7 +202,6 @@ static int check_next1 (LexState *ls, in
 }
 
 
-#ifndef _KERNEL
 /*
 ** Check whether current char is in set 'set' (with two chars) and
 ** saves it
@@ -217,6 +216,7 @@ static int check_next2 (LexState *ls, co
 }
 
 
+#ifndef _KERNEL
 /*
 ** change all characters 'from' in buffer to 'to'
 */
@@ -296,8 +296,11 @@ static int read_numeral (LexState *ls, S
 
 static int read_numeral (LexState *ls, SemInfo *seminfo) {
   TValue obj;
+  int first = ls->current;
   lua_assert(lisdigit(ls->current));
   save_and_next(ls);
+  if (first == '0')
+check_next2(ls, "xX");  /* hexadecimal? */
   for (;;) {
 if (lisxdigit(ls->current))
   save_and_next(ls);
Index: src/external/mit/lua/dist/src/llimits.h
diff -u src/external/mit/lua/dist/src/llimits.h:1.3 src/external/mit/lua/dist/src/llimits.h:1.4
--- src/external/mit/lua/dist/src/llimits.h:1.3	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/llimits.h	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: llimits.h,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: llimits.h,v 1.4 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: llimits.h,v 1.125 2014/12/19 13:30:23 roberto Exp 
@@ -68,13 +68,19 @@ typedef unsigned char lu_byte;
 #if defined(LUAI_USER_ALIGNMENT_T)
 typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
 #else
+#ifndef _KERNEL
 typedef union { double u; void *s; lua_Integer i; long l; } L_Umaxalign;
+#else /* _KERNEL */
+typedef union { void *s; lua_Integer i; long l; } L_Umaxalign;
+#endif
 #endif
 
 
 
 /* types of 'usual argument conversions' for lua_Number and lua_Integer */
+#ifndef _KERNEL
 typedef LUAI_UACNUMBER l_uacNumber;
+#endif
 typedef LUAI_UACINT l_uacInt;
 
 
Index: src/external/mit/lua/dist/src/lua.h
diff -u src/external/mit/lua/dist/src/lua.h:1.3 src/external/mit/lua/dist/src/lua.h:1.4
--- src/external/mit/lua/dist/src/lua.h:1.3	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/lua.h	Thu Feb 19 04:46:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua.h,v 1.3 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: lua.h,v 1.4 2015/02/19 04:46:22 lneto Exp $	*/
 
 /*
 ** Id: lua.h,v 1.325 2014/12/

CVS commit: src/external/mit/lua/dist/src

2015-02-03 Thread Lourival Pereira Vieira Neto
Module Name:src
Committed By:   lneto
Date:   Wed Feb  4 04:47:57 UTC 2015

Modified Files:
src/external/mit/lua/dist/src: luaconf.h

Log Message:
lua: fixed LUA_ROOT, LUA_PATH_DEFAULT and LUA_CPATH_DEFAULT

* reverted from r1.8 (mbalmer)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.11 src/external/mit/lua/dist/src/luaconf.h:1.12
--- src/external/mit/lua/dist/src/luaconf.h:1.11	Mon Feb  2 14:03:05 2015
+++ src/external/mit/lua/dist/src/luaconf.h	Wed Feb  4 04:47:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: luaconf.h,v 1.11 2015/02/02 14:03:05 lneto Exp $	*/
+/*	$NetBSD: luaconf.h,v 1.12 2015/02/04 04:47:57 lneto Exp $	*/
 
 /*
 ** Id: luaconf.h,v 1.238 2014/12/29 13:27:55 roberto Exp 
@@ -753,6 +753,18 @@
 #define LUA_MAXINTEGER		INTMAX_MAX
 #define LUA_MININTEGER		INTMAX_MIN
 
+/* Path */
+#undef LUA_ROOT
+#undef LUA_PATH_DEFAULT
+#undef LUA_CPATH_DEFAULT
+
+#define LUA_ROOT	"/usr/"
+#define LUA_PATH_DEFAULT  \
+		LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
+		LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua"
+#define LUA_CPATH_DEFAULT \
+		LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
+
 #ifndef _KERNEL
 
 #include 



CVS commit: src/external/mit/lua/dist/src

2014-11-30 Thread Lourival Pereira Vieira Neto
Module Name:src
Committed By:   lneto
Date:   Sun Nov 30 19:00:46 UTC 2014

Modified Files:
src/external/mit/lua/dist/src: luaconf.h

Log Message:
lua(4): fixed Lua stack size


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.9 src/external/mit/lua/dist/src/luaconf.h:1.10
--- src/external/mit/lua/dist/src/luaconf.h:1.9	Sat Jul 19 18:38:34 2014
+++ src/external/mit/lua/dist/src/luaconf.h	Sun Nov 30 19:00:46 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: luaconf.h,v 1.9 2014/07/19 18:38:34 lneto Exp $	*/
+/*	$NetBSD: luaconf.h,v 1.10 2014/11/30 19:00:46 lneto Exp $	*/
 
 /*
-** $Id: luaconf.h,v 1.9 2014/07/19 18:38:34 lneto Exp $
+** $Id: luaconf.h,v 1.10 2014/11/30 19:00:46 lneto Exp $
 ** Configuration file for Lua
 ** See Copyright Notice in lua.h
 */
@@ -13,6 +13,10 @@
 #ifndef _KERNEL
 #include 
 #include 
+#else
+/* limits.h */
+#include 
+#include 
 #endif
 
 
@@ -696,7 +700,6 @@
 #ifndef _KERNEL
 #include 
 #else
-#include 
 
 #undef LUA_NUMBER
 #undef LUA_NUMBER_FMT
@@ -723,9 +726,6 @@
 #define BUFSIZ			(1024)
 #define sprintf(s,fmt,...)	snprintf(s, sizeof(s), fmt, __VA_ARGS__)
 
-/* limits.h */
-#include 
-
 /* string.h */
 #define strcoll strcmp
 



CVS commit: src/external/mit/lua/dist/src

2014-07-19 Thread Lourival Pereira Vieira Neto
Module Name:src
Committed By:   lneto
Date:   Sat Jul 19 19:37:31 UTC 2014

Modified Files:
src/external/mit/lua/dist/src: ldblib.c

Log Message:
lua(4): fixed ldblib.c

* for some reason it wasn't added on my last commit


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/mit/lua/dist/src/ldblib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/ldblib.c
diff -u src/external/mit/lua/dist/src/ldblib.c:1.3 src/external/mit/lua/dist/src/ldblib.c:1.4
--- src/external/mit/lua/dist/src/ldblib.c:1.3	Sat Jul 19 18:38:34 2014
+++ src/external/mit/lua/dist/src/ldblib.c	Sat Jul 19 19:37:31 2014
@@ -1,15 +1,17 @@
-/*	$NetBSD: ldblib.c,v 1.3 2014/07/19 18:38:34 lneto Exp $	*/
+/*	$NetBSD: ldblib.c,v 1.4 2014/07/19 19:37:31 lneto Exp $	*/
 
 /*
-** $Id: ldblib.c,v 1.3 2014/07/19 18:38:34 lneto Exp $
+** $Id: ldblib.c,v 1.4 2014/07/19 19:37:31 lneto Exp $
 ** Interface from Lua to its debug API
 ** See Copyright Notice in lua.h
 */
 
 
+#ifndef _KERNEL
 #include 
 #include 
 #include 
+#endif
 
 #define ldblib_c
 #define LUA_LIB



CVS commit: src/external/mit/lua/dist/src

2014-07-19 Thread Lourival Pereira Vieira Neto
Module Name:src
Committed By:   lneto
Date:   Sat Jul 19 17:11:53 UTC 2014

Modified Files:
src/external/mit/lua/dist/src: luaconf.h

Log Message:
lua(4): preventing division by zero

* note: we should raise an error instead of return INTMAX_MAX


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.7 src/external/mit/lua/dist/src/luaconf.h:1.8
--- src/external/mit/lua/dist/src/luaconf.h:1.7	Wed Mar 26 22:03:26 2014
+++ src/external/mit/lua/dist/src/luaconf.h	Sat Jul 19 17:11:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: luaconf.h,v 1.7 2014/03/26 22:03:26 christos Exp $	*/
+/*	$NetBSD: luaconf.h,v 1.8 2014/07/19 17:11:52 lneto Exp $	*/
 
 /*
 ** Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
@@ -553,10 +553,13 @@
 */
 #if defined(LUA_CORE)
 #ifdef _KERNEL
+/* XXX: we should raise an error instead of return INTMAX_MAX */
+#define luai_numdiv(a,b)	((b) != 0 ? (a)/(b) : INTMAX_MAX)
 #define luai_nummod(a,b)	((a)%(b))
 #define luai_numpow(a,b)	luai_nummul(a,b)
 #else
 #include 
+#define luai_numdiv(a,b)	((a)/(b))
 #define luai_nummod(a,b)	((a) - floor((a)/(b))*(b))
 #define luai_numpow(a,b)	(pow(a,b))
 #endif
@@ -564,7 +567,6 @@
 #define luai_numadd(a,b)	((a)+(b))
 #define luai_numsub(a,b)	((a)-(b))
 #define luai_nummul(a,b)	((a)*(b))
-#define luai_numdiv(a,b)	((a)/(b))
 #define luai_numunm(a)		(-(a))
 #define luai_numeq(a,b)		((a)==(b))
 #define luai_numlt(a,b)		((a)<(b))



CVS commit: src/external/mit/lua/dist/src

2014-03-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 26 22:03:26 UTC 2014

Modified Files:
src/external/mit/lua/dist/src: lobject.c lstrlib.c luaconf.h lvm.c

Log Message:
kill sprintf


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/mit/lua/dist/src/lobject.c \
src/external/mit/lua/dist/src/lvm.c
cvs rdiff -u -r1.3 -r1.4 src/external/mit/lua/dist/src/lstrlib.c
cvs rdiff -u -r1.6 -r1.7 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lobject.c
diff -u src/external/mit/lua/dist/src/lobject.c:1.1.1.2 src/external/mit/lua/dist/src/lobject.c:1.2
--- src/external/mit/lua/dist/src/lobject.c:1.1.1.2	Wed Mar 14 20:08:09 2012
+++ src/external/mit/lua/dist/src/lobject.c	Wed Mar 26 18:03:26 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: lobject.c,v 1.1.1.2 2012/03/15 00:08:09 alnsn Exp $	*/
+/*	$NetBSD: lobject.c,v 1.2 2014/03/26 22:03:26 christos Exp $	*/
 
 /*
-** $Id: lobject.c,v 1.1.1.2 2012/03/15 00:08:09 alnsn Exp $
+** $Id: lobject.c,v 1.2 2014/03/26 22:03:26 christos Exp $
 ** Some generic functions over Lua objects
 ** See Copyright Notice in lua.h
 */
@@ -144,7 +144,7 @@ const char *luaO_pushvfstring (lua_State
   }
   case 'p': {
 char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */
-sprintf(buff, "%p", va_arg(argp, void *));
+snprintf(buff, sizeof(buff), "%p", va_arg(argp, void *));
 pushstr(L, buff);
 break;
   }
Index: src/external/mit/lua/dist/src/lvm.c
diff -u src/external/mit/lua/dist/src/lvm.c:1.1.1.2 src/external/mit/lua/dist/src/lvm.c:1.2
--- src/external/mit/lua/dist/src/lvm.c:1.1.1.2	Wed Mar 14 20:08:05 2012
+++ src/external/mit/lua/dist/src/lvm.c	Wed Mar 26 18:03:26 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: lvm.c,v 1.1.1.2 2012/03/15 00:08:05 alnsn Exp $	*/
+/*	$NetBSD: lvm.c,v 1.2 2014/03/26 22:03:26 christos Exp $	*/
 
 /*
-** $Id: lvm.c,v 1.1.1.2 2012/03/15 00:08:05 alnsn Exp $
+** $Id: lvm.c,v 1.2 2014/03/26 22:03:26 christos Exp $
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -52,7 +52,7 @@ int luaV_tostring (lua_State *L, StkId o
   else {
 char s[LUAI_MAXNUMBER2STR];
 lua_Number n = nvalue(obj);
-lua_number2str(s, n);
+lua_number2str(s, sizeof(s), n);
 setsvalue2s(L, obj, luaS_new(L, s));
 return 1;
   }

Index: src/external/mit/lua/dist/src/lstrlib.c
diff -u src/external/mit/lua/dist/src/lstrlib.c:1.3 src/external/mit/lua/dist/src/lstrlib.c:1.4
--- src/external/mit/lua/dist/src/lstrlib.c:1.3	Mon Dec 16 18:25:56 2013
+++ src/external/mit/lua/dist/src/lstrlib.c	Wed Mar 26 18:03:26 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: lstrlib.c,v 1.3 2013/12/16 23:25:56 lneto Exp $	*/
+/*	$NetBSD: lstrlib.c,v 1.4 2014/03/26 22:03:26 christos Exp $	*/
 
 /*
-** $Id: lstrlib.c,v 1.3 2013/12/16 23:25:56 lneto Exp $
+** $Id: lstrlib.c,v 1.4 2014/03/26 22:03:26 christos Exp $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -776,27 +776,27 @@ static int str_format (lua_State *L) {
   strfrmt = scanformat(L, strfrmt, form);
   switch (*strfrmt++) {
 case 'c': {
-  sprintf(buff, form, (int)luaL_checknumber(L, arg));
+  snprintf(buff, sizeof(buff), form, (int)luaL_checknumber(L, arg));
   break;
 }
 case 'd':  case 'i': {
   addintlen(form);
-  sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg));
+  snprintf(buff, sizeof(buff), form, (LUA_INTFRM_T)luaL_checknumber(L, arg));
   break;
 }
 case 'o':  case 'u':  case 'x':  case 'X': {
   addintlen(form);
 #ifndef _KERNEL
-  sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
+  snprintf(buff, sizeof(buff), form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
 #else
-  sprintf(buff, form, (LUA_UINTFRM_T)luaL_checknumber(L, arg));
+  snprintf(buff, sizeof(buff), form, (LUA_UINTFRM_T)luaL_checknumber(L, arg));
 #endif
   break;
 }
 #ifndef _KERNEL
 case 'e':  case 'E': case 'f':
 case 'g': case 'G': {
-  sprintf(buff, form, (double)luaL_checknumber(L, arg));
+  snprintf(buff, sizeof(buff), form, (double)luaL_checknumber(L, arg));
   break;
 }
 #endif
@@ -815,7 +815,7 @@ static int str_format (lua_State *L) {
 continue;  /* skip the `addsize' at the end */
   }
   else {
-sprintf(buff, form, s);
+snprintf(buff, sizeof(buff), form, s);
 break;
   }
 }

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.6 src/external/mit/lua/dist/src/luaconf.h:1.7
--- src/external/mit/lua/dist/src/luaconf.h:1.6	Mon Dec 16 18:25:56 2013
+++ src/external/mit/lua/dist/src/luaconf

CVS commit: src/external/mit/lua/dist/src

2013-12-16 Thread Lourival Pereira Vieira Neto
Module Name:src
Committed By:   lneto
Date:   Mon Dec 16 23:25:56 UTC 2013

Modified Files:
src/external/mit/lua/dist/src: lstrlib.c luaconf.h

Log Message:
changed lua_Number and lua_Integer to intmax_t in lua(4)
*


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/mit/lua/dist/src/lstrlib.c
cvs rdiff -u -r1.5 -r1.6 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lstrlib.c
diff -u src/external/mit/lua/dist/src/lstrlib.c:1.2 src/external/mit/lua/dist/src/lstrlib.c:1.3
--- src/external/mit/lua/dist/src/lstrlib.c:1.2	Mon Dec  2 23:06:35 2013
+++ src/external/mit/lua/dist/src/lstrlib.c	Mon Dec 16 23:25:56 2013
@@ -1,7 +1,7 @@
-/*	$NetBSD: lstrlib.c,v 1.2 2013/12/02 23:06:35 lneto Exp $	*/
+/*	$NetBSD: lstrlib.c,v 1.3 2013/12/16 23:25:56 lneto Exp $	*/
 
 /*
-** $Id: lstrlib.c,v 1.2 2013/12/02 23:06:35 lneto Exp $
+** $Id: lstrlib.c,v 1.3 2013/12/16 23:25:56 lneto Exp $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -786,7 +786,11 @@ static int str_format (lua_State *L) {
 }
 case 'o':  case 'u':  case 'x':  case 'X': {
   addintlen(form);
+#ifndef _KERNEL
   sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
+#else
+  sprintf(buff, form, (LUA_UINTFRM_T)luaL_checknumber(L, arg));
+#endif
   break;
 }
 #ifndef _KERNEL

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.5 src/external/mit/lua/dist/src/luaconf.h:1.6
--- src/external/mit/lua/dist/src/luaconf.h:1.5	Mon Dec  2 06:07:22 2013
+++ src/external/mit/lua/dist/src/luaconf.h	Mon Dec 16 23:25:56 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: luaconf.h,v 1.5 2013/12/02 06:07:22 lneto Exp $	*/
+/*	$NetBSD: luaconf.h,v 1.6 2013/12/16 23:25:56 lneto Exp $	*/
 
 /*
 ** Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
@@ -149,7 +149,11 @@
 ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
 ** machines, ptrdiff_t gives a good choice between int or long.)
 */
+#ifdef _KERNEL
+#define LUA_INTEGER	LUA_NUMBER
+#else
 #define LUA_INTEGER	ptrdiff_t
+#endif
 
 
 /*
@@ -511,7 +515,8 @@
 */
 
 #ifdef _KERNEL
-#define LUA_NUMBER	int64_t
+#include 
+#define LUA_NUMBER	intmax_t
 #else
 #define LUA_NUMBER_DOUBLE
 #define LUA_NUMBER	double
@@ -531,9 +536,9 @@
 @@ lua_str2number converts a string to a number.
 */
 #ifdef _KERNEL
-#define LUA_NUMBER_SCAN		"%" SCNd64
-#define LUA_NUMBER_FMT		"%" PRId64
-#define lua_str2number(s,p)	((int64_t) strtoimax((s), (p), 10))
+#define LUA_NUMBER_SCAN		"%jd"
+#define LUA_NUMBER_FMT		"%jd"
+#define lua_str2number(s,p)	strtoimax((s), (p), 10)
 #else
 #define LUA_NUMBER_SCAN		"%lf"
 #define LUA_NUMBER_FMT		"%.14g"
@@ -766,7 +771,13 @@ union luai_Cast { double l_d; long l_l; 
 ** CHANGE them if your system supports long long or does not support long.
 */
 
-#if defined(LUA_USELONGLONG)
+#ifdef _KERNEL
+
+#define LUA_INTFRMLEN		"j"
+#define LUA_INTFRM_T		intmax_t
+#define LUA_UINTFRM_T		uintmax_t
+
+#elif defined(LUA_USELONGLONG)
 
 #define LUA_INTFRMLEN		"ll"
 #define LUA_INTFRM_T		long long



CVS commit: src/external/mit/lua/dist/src

2013-12-02 Thread Lourival Pereira Vieira Neto
Module Name:src
Committed By:   lneto
Date:   Mon Dec  2 23:06:35 UTC 2013

Modified Files:
src/external/mit/lua/dist/src: lstrlib.c

Log Message:
fixed lua(4) build (added _KERNEL guard into lstrlib.c to avoid double usage)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/mit/lua/dist/src/lstrlib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lstrlib.c
diff -u src/external/mit/lua/dist/src/lstrlib.c:1.1.1.2 src/external/mit/lua/dist/src/lstrlib.c:1.2
--- src/external/mit/lua/dist/src/lstrlib.c:1.1.1.2	Thu Mar 15 00:08:12 2012
+++ src/external/mit/lua/dist/src/lstrlib.c	Mon Dec  2 23:06:35 2013
@@ -1,7 +1,7 @@
-/*	$NetBSD: lstrlib.c,v 1.1.1.2 2012/03/15 00:08:12 alnsn Exp $	*/
+/*	$NetBSD: lstrlib.c,v 1.2 2013/12/02 23:06:35 lneto Exp $	*/
 
 /*
-** $Id: lstrlib.c,v 1.1.1.2 2012/03/15 00:08:12 alnsn Exp $
+** $Id: lstrlib.c,v 1.2 2013/12/02 23:06:35 lneto Exp $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -789,11 +789,13 @@ static int str_format (lua_State *L) {
   sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
   break;
 }
+#ifndef _KERNEL
 case 'e':  case 'E': case 'f':
 case 'g': case 'G': {
   sprintf(buff, form, (double)luaL_checknumber(L, arg));
   break;
 }
+#endif
 case 'q': {
   addquoted(L, &b, arg);
   continue;  /* skip the 'addsize' at the end */



CVS commit: src/external/mit/lua/dist/src

2012-03-14 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Thu Mar 15 01:02:20 UTC 2012

Modified Files:
src/external/mit/lua/dist/src: luaconf.h

Log Message:
Don't overwrite Roberto's external $Id.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.3 src/external/mit/lua/dist/src/luaconf.h:1.4
--- src/external/mit/lua/dist/src/luaconf.h:1.3	Thu Mar 15 00:17:22 2012
+++ src/external/mit/lua/dist/src/luaconf.h	Thu Mar 15 01:02:19 2012
@@ -1,7 +1,7 @@
-/*	$NetBSD: luaconf.h,v 1.3 2012/03/15 00:17:22 alnsn Exp $	*/
+/*	$NetBSD: luaconf.h,v 1.4 2012/03/15 01:02:19 alnsn Exp $	*/
 
 /*
-** $Id: luaconf.h,v 1.3 2012/03/15 00:17:22 alnsn Exp $
+** Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
 ** Configuration file for Lua
 ** See Copyright Notice in lua.h
 */



CVS commit: src/external/mit/lua/dist/src

2012-03-14 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Thu Mar 15 00:17:22 UTC 2012

Modified Files:
src/external/mit/lua/dist/src: luaconf.h

Log Message:
Resolve conflicts.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.2 src/external/mit/lua/dist/src/luaconf.h:1.3
--- src/external/mit/lua/dist/src/luaconf.h:1.2	Sun Oct 31 11:19:42 2010
+++ src/external/mit/lua/dist/src/luaconf.h	Thu Mar 15 00:17:22 2012
@@ -1,7 +1,7 @@
-/*	$NetBSD: luaconf.h,v 1.2 2010/10/31 11:19:42 mbalmer Exp $ */
+/*	$NetBSD: luaconf.h,v 1.3 2012/03/15 00:17:22 alnsn Exp $	*/
 
 /*
-** Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
+** $Id: luaconf.h,v 1.3 2012/03/15 00:17:22 alnsn Exp $
 ** Configuration file for Lua
 ** See Copyright Notice in lua.h
 */



CVS commit: src/external/mit/lua/dist/src

2010-10-31 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun Oct 31 11:19:43 UTC 2010

Modified Files:
src/external/mit/lua/dist/src: luaconf.h

Log Message:
adjust the Lua configuration to our needs


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/mit/lua/dist/src/luaconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/luaconf.h
diff -u src/external/mit/lua/dist/src/luaconf.h:1.1.1.1 src/external/mit/lua/dist/src/luaconf.h:1.2
--- src/external/mit/lua/dist/src/luaconf.h:1.1.1.1	Sun Oct 31 11:16:54 2010
+++ src/external/mit/lua/dist/src/luaconf.h	Sun Oct 31 11:19:42 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: luaconf.h,v 1.1.1.1 2010/10/31 11:16:54 mbalmer Exp $ */
+/*	$NetBSD: luaconf.h,v 1.2 2010/10/31 11:19:42 mbalmer Exp $ */
 
 /*
 ** Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
@@ -96,14 +96,21 @@
 	".\\?.dll;"  LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
 
 #else
-#define LUA_ROOT	"/usr/local/"
+#define LUA_ROOT	"/usr/"
 #define LUA_LDIR	LUA_ROOT "share/lua/5.1/"
 #define LUA_CDIR	LUA_ROOT "lib/lua/5.1/"
+
+/*
+ * The original Lua distribution contain "./?.lua" at the beginning
+ * of LUA_PATH_DEFAULT and "./?.so" at the beginning of LUA_CPATH_DEFAULT.
+ * These path elements have been removed for the NetBSD version of Lua
+ * to avoid potential security problems.
+ */
 #define LUA_PATH_DEFAULT  \
-		"./?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
-		LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua"
+	LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
+	LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua"
 #define LUA_CPATH_DEFAULT \
-	"./?.so;"  LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
+	LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
 #endif