# HG changeset patch # User jbe # Date 1612889087 -3600 # Node ID ab837b075cf72c77adacc4463fe369de32acf31c # Parent 15bde6a79d41f5862ce8742e619e3fd1c000a949 Fixed mldap_get_named_number_arg to not leave any element on the Lua stack (should not have had any effect anyway but is now consistent to documentation) diff -r 15bde6a79d41 -r ab837b075cf7 lib/mldap/mldap.c --- a/lib/mldap/mldap.c Tue Feb 09 17:40:50 2021 +0100 +++ b/lib/mldap/mldap.c Tue Feb 09 17:44:47 2021 +0100 @@ -79,7 +79,7 @@ lua_State *L, // pointer to lua_State variable int idx, // stack index of the table containing the named arguments const char *argname, // name of the argument - int mandatory // if not 0, then the argument is mandatory and an error is raised if it isn't found + bool mandatory // if not 0, then the argument is mandatory and an error is raised if it isn't found // leaves the string as new element on top of the stack ) { @@ -114,8 +114,8 @@ lua_State *L, // pointer to lua_State variable int idx, // stack index of the table containing the named arguments const char *argname, // name of the argument - int mandatory, // if not 0, then the argument is mandatory and an error is raised if it isn't found - lua_Number default_value // default value to return, if the argument is not mandatory and nil or false + bool mandatory, // if not 0, then the argument is mandatory and an error is raised if it isn't found + lua_Number default_value // default value to return, if the argument is not mandatory and nil // opposed to 'mldap_get_named_string_arg', this function leaves no element on the stack ) { @@ -145,6 +145,8 @@ } // remove unnecessary element from stack (not needed to avoid garbage collection): + lua_pop(L, 1); + return value; // leaves no new elements on the stack @@ -157,7 +159,7 @@ lua_State *L, // pointer to lua_State variable int idx, // stack index of the table containing the named arguments const char *argname, // name of the argument - int mandatory, // if not 0, then the argument is mandatory and an error is raised if it isn't found + bool mandatory, // if not 0, then the argument is mandatory and an error is raised if it isn't found bool default_value // default value to return, if the argument is not mandatory and nil // opposed to 'mldap_get_named_string_arg', this function leaves no element on the stack