Diff

util-src/pposix.c @ 7969:1c6a07606309

util-src: Specify size of various tables to be allocated
author Kim Alvefur <zash@zash.se>
date Thu, 09 Mar 2017 01:20:59 +0100
parent 7966:30309fd01d76
child 8010:49feb0da29e1
line wrap: on
line diff
--- 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");