Update to Lua 5.2.
authorMahlon E. Smith <mahlon@martini.nu>
Tue, 09 Jun 2015 12:01:57 -0700
changeset 32 6dc2d52e4b13
parent 31 9c66c159a3a6
child 33 ba41bfbe87a2
Update to Lua 5.2.
LICENSE
Makefile
accept_loop.c
db.c
db.h
lua.c
lua.h
main.c
process.c
util.c
volta.h
--- a/LICENSE	Wed Jul 25 11:49:11 2012 -0700
+++ b/LICENSE	Tue Jun 09 12:01:57 2015 -0700
@@ -1,5 +1,5 @@
 
-Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
--- a/Makefile	Wed Jul 25 11:49:11 2012 -0700
+++ b/Makefile	Tue Jun 09 12:01:57 2015 -0700
@@ -29,28 +29,28 @@
 # and LIBS to the 'make' command line for your platform.
 #
 # The following works for OSX with macports or homebrew (10.6/10.7),
-# FreeBSD 8.x and 9.x, and Ubuntu 11.10 and 12.04.
+# FreeBSD 8.x through 10.x, and Ubuntu 11.10 through 14.04.
 
 # Ubuntu
 #  - perftools doesn't currently register a .pc file at all
-#  - lua is called 'lua5.1'
+#  - lua is called 'lua5.2'
 ifeq ($(UNAME), Linux)
 volta: CFLAGS += -L/usr/lib -I/usr/include
-volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua5.1)
-volta: LIBS   += $(shell pkg-config --libs-only-l lua5.1)
+volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua5.2)
+volta: LIBS   += $(shell pkg-config --libs-only-l lua5.2)
 debug: CFLAGS += $(CFLAGS_DEBUG)\
-	$(shell pkg-config --cflags-only-I --libs-only-L lua5.1)
-debug: LIBS   += $(shell pkg-config --libs-only-l lua5.1) -lprofiler
+	$(shell pkg-config --cflags-only-I --libs-only-L lua5.2)
+debug: LIBS   += $(shell pkg-config --libs-only-l lua5.2) -lprofiler
 
 # FreeBSD
-# - lua is called 'lua-5.1'
+# - lua is called 'lua-5.2'
 else ifeq ($(UNAME), FreeBSD)
 volta: CFLAGS += -L/usr/local/lib -I/usr/local/include
-volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua-5.1)
-volta: LIBS   += $(shell pkg-config --libs-only-l lua-5.1)
+volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua-5.2)
+volta: LIBS   += $(shell pkg-config --libs-only-l lua-5.2)
 debug: CFLAGS += $(CFLAGS_DEBUG)\
-    $(shell pkg-config --cflags-only-I --libs-only-L lua-5.1 $(DEPS_DEBUG))
-debug: LIBS += $(shell pkg-config --libs-only-l lua-5.1 $(DEPS_DEBUG))
+    $(shell pkg-config --cflags-only-I --libs-only-L lua-5.2 $(DEPS_DEBUG))
+debug: LIBS += $(shell pkg-config --libs-only-l lua-5.2 $(DEPS_DEBUG))
 
 # Darwin, everyone else (best guess?)
 # - lua is called 'lua', hopefully!
--- a/accept_loop.c	Wed Jul 25 11:49:11 2012 -0700
+++ b/accept_loop.c	Tue Jun 09 12:01:57 2015 -0700
@@ -1,6 +1,6 @@
 /* vim: set noet nosta sw=4 ts=4 ft=c : */
 /*
-Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
--- a/db.c	Wed Jul 25 11:49:11 2012 -0700
+++ b/db.c	Tue Jun 09 12:01:57 2015 -0700
@@ -1,6 +1,6 @@
 /* vim: set noet nosta sw=4 ts=4 ft=c : */
 /*
-Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
--- a/db.h	Wed Jul 25 11:49:11 2012 -0700
+++ b/db.h	Tue Jun 09 12:01:57 2015 -0700
@@ -1,6 +1,6 @@
 /* vim: set noet nosta sw=4 ts=4 ft=c : */
 /*
-Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
--- a/lua.c	Wed Jul 25 11:49:11 2012 -0700
+++ b/lua.c	Tue Jun 09 12:01:57 2015 -0700
@@ -1,6 +1,6 @@
 /* vim: set noet nosta sw=4 ts=4 ft=c : */
 /*
-Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -79,25 +79,23 @@
 	luaL_openlibs( lua ); /* include lua standard libraries */
 
 	/* Predeclare the request table. */
-	lua_pushstring( lua, "request" );
 	lua_createtable( lua, 0, 7 );
-	lua_settable( lua, LUA_GLOBALSINDEX );
+	lua_setglobal( lua, "request" );
 
 	/* Predeclare a table for shared data */
-	lua_pushstring( lua, "shared" );
 	lua_newtable( lua );
-	lua_settable( lua, LUA_GLOBALSINDEX );
+	lua_setglobal( lua, "shared" );
 
 	/* replace the lua print() function with one that calls debug() instead */
 	lua_register( lua, "print", luaV_print );
 
 	/* Restrict additional globals. */
-    lua_createtable( lua, 0, 1);
-    lua_pushcfunction( lua, luaV_globalindex );
-    lua_setfield( lua, -2, "__newindex");
-    lua_pushboolean( lua, 0 );
-    lua_setfield( lua, -2, "__metatable");
-    lua_setmetatable( lua, LUA_GLOBALSINDEX );
+	lua_createtable( lua, 0, 1);
+	lua_pushcfunction( lua, luaV_globalindex );
+	lua_setfield( lua, -2, "__newindex");
+	lua_pushboolean( lua, 0 );
+	lua_setfield( lua, -2, "__metatable");
+	lua_setmetatable( lua, -2 );
 
 	lua_settop( lua, 0 );  /* wipe the stack */
 	return( lua );
@@ -111,7 +109,7 @@
 void
 luaV_setup_request( parsed *request )
 {
-	lua_getfield( v.lua, LUA_GLOBALSINDEX, "request" );
+	lua_getglobal( v.lua, "request" );
 	lua_pushstring( v.lua, request->scheme );
 	lua_setfield( v.lua, 1, "scheme" );
 	lua_pushstring( v.lua, request->host );
--- a/lua.h	Wed Jul 25 11:49:11 2012 -0700
+++ b/lua.h	Tue Jun 09 12:01:57 2015 -0700
@@ -1,6 +1,6 @@
 /* vim: set noet nosta sw=4 ts=4 ft=c : */
 /*
-Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
--- a/main.c	Wed Jul 25 11:49:11 2012 -0700
+++ b/main.c	Tue Jun 09 12:01:57 2015 -0700
@@ -1,6 +1,6 @@
 /* vim: set noet nosta sw=4 ts=4 ft=c : */
 /*
-Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
--- a/process.c	Wed Jul 25 11:49:11 2012 -0700
+++ b/process.c	Tue Jun 09 12:01:57 2015 -0700
@@ -1,6 +1,6 @@
 /* vim: set noet nosta sw=4 ts=4 ft=c : */
 /*
-Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
--- a/util.c	Wed Jul 25 11:49:11 2012 -0700
+++ b/util.c	Tue Jun 09 12:01:57 2015 -0700
@@ -1,6 +1,6 @@
 /* vim: set noet nosta sw=4 ts=4 ft=c : */
 /*
-Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
--- a/volta.h	Wed Jul 25 11:49:11 2012 -0700
+++ b/volta.h	Tue Jun 09 12:01:57 2015 -0700
@@ -1,6 +1,6 @@
 /* vim: set noet nosta sw=4 ts=4 ft=c : */
 /*
-Copyright (c) 2011-2012, Mahlon E. Smith <mahlon@martini.nu>
+Copyright (c) 2011-2015, Mahlon E. Smith <mahlon@martini.nu>
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met: