# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1489018859 -3600
# Node ID 1c6a0760630952c8f053ad4135dc0d9996f4ae90
# Parent  f0e35f4db9e0e0bda5cf3c8448e6532c06123f8d
util-src: Specify size of various tables to be allocated

diff -r f0e35f4db9e0 -r 1c6a07606309 util-src/crand.c
--- a/util-src/crand.c	Thu Mar 09 00:59:32 2017 +0100
+++ b/util-src/crand.c	Thu Mar 09 01:20:59 2017 +0100
@@ -100,7 +100,7 @@
 	luaL_checkversion(L);
 #endif
 
-	lua_newtable(L);
+	lua_createtable(L, 0, 2);
 	lua_pushcfunction(L, Lrandom);
 	lua_setfield(L, -2, "bytes");
 
diff -r f0e35f4db9e0 -r 1c6a07606309 util-src/net.c
--- a/util-src/net.c	Thu Mar 09 00:59:32 2017 +0100
+++ b/util-src/net.c	Thu Mar 09 01:20:59 2017 +0100
@@ -134,7 +134,7 @@
 		{ NULL, NULL }
 	};
 
-	lua_newtable(L);
+	lua_createtable(L, 0, 1);
 	luaL_setfuncs(L, exports, 0);
 	return 1;
 }
diff -r f0e35f4db9e0 -r 1c6a07606309 util-src/pposix.c
--- a/util-src/pposix.c	Thu Mar 09 00:59:32 2017 +0100
+++ b/util-src/pposix.c	Thu Mar 09 01:20:59 2017 +0100
@@ -660,7 +660,7 @@
 		return 2;
 	}
 
-	lua_newtable(L);
+	lua_createtable(L, 0, 6);
 	lua_pushstring(L, uname_info.sysname);
 	lua_setfield(L, -2, "sysname");
 	lua_pushstring(L, uname_info.nodename);
@@ -709,7 +709,7 @@
 #ifdef WITH_MALLINFO
 int lc_meminfo(lua_State *L) {
 	struct mallinfo info = mallinfo();
-	lua_newtable(L);
+	lua_createtable(L, 0, 5);
 	/* This is the total size of memory allocated with sbrk by malloc, in bytes. */
 	lua_pushinteger(L, info.arena);
 	lua_setfield(L, -2, "allocated");
diff -r f0e35f4db9e0 -r 1c6a07606309 util-src/ringbuffer.c
--- a/util-src/ringbuffer.c	Thu Mar 09 00:59:32 2017 +0100
+++ b/util-src/ringbuffer.c	Thu Mar 09 01:20:59 2017 +0100
@@ -187,7 +187,7 @@
 		lua_pushcfunction(L, rb_length);
 		lua_setfield(L, -2, "__len");
 
-		lua_newtable(L); /* __index */
+		lua_createtable(L, 0, 7); /* __index */
 		{
 			lua_pushcfunction(L, rb_find);
 			lua_setfield(L, -2, "find");
@@ -207,7 +207,7 @@
 		lua_setfield(L, -2, "__index");
 	}
 
-	lua_newtable(L);
+	lua_createtable(L, 0, 1);
 	lua_pushcfunction(L, rb_new);
 	lua_setfield(L, -2, "new");
 	return 1;
diff -r f0e35f4db9e0 -r 1c6a07606309 util-src/table.c
--- a/util-src/table.c	Thu Mar 09 00:59:32 2017 +0100
+++ b/util-src/table.c	Thu Mar 09 01:20:59 2017 +0100
@@ -24,7 +24,7 @@
 #if (LUA_VERSION_NUM > 501)
 	luaL_checkversion(L);
 #endif
-	lua_newtable(L);
+	lua_createtable(L, 0, 2);
 	lua_pushcfunction(L, Lcreate_table);
 	lua_setfield(L, -2, "create");
 	lua_pushcfunction(L, Lpack);