mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
KOPTInterface: Minor optimization when hashing the configurable status
Use a table & table.concat instead of individual concats. And then use that same table for every hash-related operation. (Nothing else uses the configurable hash function, otherwise I'd have limited the table shenanigans to the function itself).
This commit is contained in:
@@ -18,15 +18,13 @@ function Configurable:reset()
|
||||
end
|
||||
end
|
||||
|
||||
function Configurable:hash(sep)
|
||||
local hash = ""
|
||||
function Configurable:hash(list)
|
||||
for key, value in ffiUtil.orderedPairs(self) do
|
||||
local value_type = type(value)
|
||||
if value_type == "number" or value_type == "string" then
|
||||
hash = hash..sep..value
|
||||
table.insert(list, value)
|
||||
end
|
||||
end
|
||||
return hash
|
||||
end
|
||||
|
||||
function Configurable:loadDefaults(config_options)
|
||||
|
||||
Reference in New Issue
Block a user