commit a2a3df8: [Minor] Fix parse_table_arguments

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jul 1 12:35:08 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-07-01 13:29:06 +0100
URL: https://github.com/rspamd/rspamd/commit/a2a3df8b76cbe92bb56f82ae25362e4d0d440f19

[Minor] Fix parse_table_arguments

---
 src/lua/lua_common.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index 354a932f9..cf909e021 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -1320,6 +1320,9 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
 					if (how != RSPAMD_LUA_PARSE_ARGUMENTS_IGNORE_MISSING) {
 						*(va_arg (ap, const gchar **)) = NULL;
 					}
+					else {
+						(void)va_arg (ap, gchar **);
+					}
 				}
 				else {
 					g_set_error (err,
@@ -1342,13 +1345,16 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
 
 			case 'I':
 				if (t == LUA_TNUMBER) {
-					*(va_arg (ap, gint64 *)) = lua_tonumber (L, idx);
+					*(va_arg (ap, gint64 *)) = lua_tointeger (L, idx);
 				}
 				else if (t == LUA_TNIL || t == LUA_TNONE) {
 					failed = TRUE;
 					if (how != RSPAMD_LUA_PARSE_ARGUMENTS_IGNORE_MISSING) {
 						*(va_arg (ap, gint64 *)) = 0;
 					}
+					else {
+						(void)va_arg (ap, gint64 *);
+					}
 				}
 				else {
 					g_set_error (err,
@@ -1383,6 +1389,9 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
 					if (how != RSPAMD_LUA_PARSE_ARGUMENTS_IGNORE_MISSING) {
 						*(va_arg (ap, gint *)) = -1;
 					}
+					else {
+						(void)va_arg (ap, gint *);
+					}
 
 					if (is_table) {
 						lua_pop (L, 1);
@@ -1450,6 +1459,9 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
 					if (how != RSPAMD_LUA_PARSE_ARGUMENTS_IGNORE_MISSING) {
 						*(va_arg (ap, gdouble *)) = 0;
 					}
+					else {
+						(void)va_arg (ap, gdouble *);
+					}
 				}
 				else {
 					g_set_error (err,
@@ -1481,6 +1493,9 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
 					if (how != RSPAMD_LUA_PARSE_ARGUMENTS_IGNORE_MISSING) {
 						*(va_arg (ap, gdouble *)) = NAN;
 					}
+					else {
+						(void)va_arg (ap, gdouble *);
+					}
 				}
 				else {
 					g_set_error (err,
@@ -1516,6 +1531,9 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
 						*(va_arg (ap, const char **)) = NULL;
 						*valuelen = 0;
 					}
+					else {
+						(void)va_arg (ap, const char **);
+					}
 				}
 				else {
 					g_set_error (err,
@@ -1547,6 +1565,9 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
 					if (how != RSPAMD_LUA_PARSE_ARGUMENTS_IGNORE_MISSING) {
 						*(va_arg (ap, ucl_object_t **)) = NULL;
 					}
+					else {
+						(void)va_arg (ap, ucl_object_t **);
+					}
 				}
 
 				if (is_table) {
@@ -1560,6 +1581,9 @@ rspamd_lua_parse_table_arguments (lua_State *L, gint pos,
 					if (how != RSPAMD_LUA_PARSE_ARGUMENTS_IGNORE_MISSING) {
 						*(va_arg (ap, void **)) = NULL;
 					}
+					else {
+						(void)va_arg (ap, void **);
+					}
 				}
 				else if (t != LUA_TUSERDATA) {
 					g_set_error (err,


More information about the Commits mailing list