Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
7968:f0e35f4db9e0 | 7969:1c6a07606309 |
---|---|
658 lua_pushnil(L); | 658 lua_pushnil(L); |
659 lua_pushstring(L, strerror(errno)); | 659 lua_pushstring(L, strerror(errno)); |
660 return 2; | 660 return 2; |
661 } | 661 } |
662 | 662 |
663 lua_newtable(L); | 663 lua_createtable(L, 0, 6); |
664 lua_pushstring(L, uname_info.sysname); | 664 lua_pushstring(L, uname_info.sysname); |
665 lua_setfield(L, -2, "sysname"); | 665 lua_setfield(L, -2, "sysname"); |
666 lua_pushstring(L, uname_info.nodename); | 666 lua_pushstring(L, uname_info.nodename); |
667 lua_setfield(L, -2, "nodename"); | 667 lua_setfield(L, -2, "nodename"); |
668 lua_pushstring(L, uname_info.release); | 668 lua_pushstring(L, uname_info.release); |
707 } | 707 } |
708 | 708 |
709 #ifdef WITH_MALLINFO | 709 #ifdef WITH_MALLINFO |
710 int lc_meminfo(lua_State *L) { | 710 int lc_meminfo(lua_State *L) { |
711 struct mallinfo info = mallinfo(); | 711 struct mallinfo info = mallinfo(); |
712 lua_newtable(L); | 712 lua_createtable(L, 0, 5); |
713 /* This is the total size of memory allocated with sbrk by malloc, in bytes. */ | 713 /* This is the total size of memory allocated with sbrk by malloc, in bytes. */ |
714 lua_pushinteger(L, info.arena); | 714 lua_pushinteger(L, info.arena); |
715 lua_setfield(L, -2, "allocated"); | 715 lua_setfield(L, -2, "allocated"); |
716 /* This is the total size of memory allocated with mmap, in bytes. */ | 716 /* This is the total size of memory allocated with mmap, in bytes. */ |
717 lua_pushinteger(L, info.hblkhd); | 717 lua_pushinteger(L, info.hblkhd); |