aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_ip.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-05 10:50:59 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-05 10:50:59 +0100
commitb89a7948754caad625bbe7208eab0ad3e8af1035 (patch)
tree69e608143c989357b75b3030800285cf049fa799 /src/lua/lua_ip.c
parent9cd5065eace43916683dd113555c3e622e3d3ff6 (diff)
downloadrspamd-b89a7948754caad625bbe7208eab0ad3e8af1035.tar.gz
rspamd-b89a7948754caad625bbe7208eab0ad3e8af1035.zip
[Minor] Use lua_createtable when size is known
Diffstat (limited to 'src/lua/lua_ip.c')
-rw-r--r--src/lua/lua_ip.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lua/lua_ip.c b/src/lua/lua_ip.c
index 97f75ddda..0ebbf2003 100644
--- a/src/lua/lua_ip.c
+++ b/src/lua/lua_ip.c
@@ -223,8 +223,8 @@ lua_ip_to_table (lua_State *L)
guint8 *ptr;
if (ip != NULL && ip->addr) {
- lua_newtable (L);
ptr = rspamd_inet_address_get_hash_key (ip->addr, &max);
+ lua_createtable (L, max, 0);
for (i = 1; i <= max; i++, ptr++) {
lua_pushnumber (L, *ptr);
@@ -248,9 +248,9 @@ lua_ip_str_octets (lua_State *L)
char numbuf[8];
if (ip != NULL && ip->addr) {
- lua_newtable (L);
af = rspamd_inet_address_get_af (ip->addr);
ptr = rspamd_inet_address_get_hash_key (ip->addr, &max);
+ lua_createtable (L, max * 2, 0);
for (i = 1; i <= max; i++, ptr++) {
if (af == AF_INET) {
@@ -288,9 +288,9 @@ lua_ip_inversed_str_octets (lua_State *L)
gint af;
if (ip != NULL && ip->addr) {
- lua_newtable (L);
ptr = rspamd_inet_address_get_hash_key (ip->addr, &max);
af = rspamd_inet_address_get_af (ip->addr);
+ lua_createtable (L, max * 2, 0);
ptr += max - 1;
for (i = 1; i <= max; i++, ptr--) {