X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fcore%2Fluasrc%2Futil.lua;fp=libs%2Fcore%2Fluasrc%2Futil.lua;h=a3ba43246817d49fc721e583f2516aaea49e79ae;hp=94b5ce67f10343c3ebd9321edca592074906a71f;hb=4ef3ac9694dae9f1c7afa57bd525b54e88d7c608;hpb=ed4b7a5fbb020f6ced1ce4333eafdfb6654d244b diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index 94b5ce67f..a3ba43246 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -215,7 +215,7 @@ end -- @param value String containing the HTML text -- @return String with HTML tags stripped of function striptags(s) - return pcdata(s:gsub("]*>", " "):gsub("%s+", " ")) + return pcdata(tostring(s):gsub("]*>", " "):gsub("%s+", " ")) end --- Splits given string on a defined separator sequence and return a table @@ -768,24 +768,19 @@ function copcall(f, ...) end -- Handle return value of protected call -function handleReturnValue(err, co, status, ...) +function handleReturnValue(err, co, status, arg1, arg2, arg3, arg4, arg5) if not status then - return false, err(debug.traceback(co, (...)), ...) + return false, err(debug.traceback(co, arg1), arg1, arg2, arg3, arg4, arg5) end - if coroutine.status(co) == 'suspended' then - return performResume(err, co, coroutine.yield(...)) - else - return true, ... + + if coroutine.status(co) ~= 'suspended' then + return true, arg1, arg2, arg3, arg4, arg5 end + + return performResume(err, co, coroutine.yield(arg1, arg2, arg3, arg4, arg5)) end -- Resume execution of protected function call -function performResume(err, co, ...) - if get_memory_limit and get_memory_limit() > 0 and - collectgarbage("count") > (get_memory_limit() * 0.8) - then - collectgarbage("collect") - end - - return handleReturnValue(err, co, coroutine.resume(co, ...)) +function performResume(err, co, arg1, arg2, arg3, arg4, arg5) + return handleReturnValue(err, co, coroutine.resume(co, arg1, arg2, arg3, arg4, arg5)) end