git.99rst.org
/
openwrt-luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
afc5d67
)
ipkg.lua: compare_versions() Replace Lua Math Library call
author
Christian Schoenebeck
<redacted>
Tue, 4 Aug 2015 19:14:48 +0000
(21:14 +0200)
committer
Christian Schoenebeck
<redacted>
Tue, 4 Aug 2015 19:14:48 +0000
(21:14 +0200)
function compare_versions(): replace Lua Math Library call with if clause
Signed-off-by: Christian Schoenebeck <redacted>
modules/luci-base/luasrc/model/ipkg.lua
patch
|
blob
|
history
diff --git
a/modules/luci-base/luasrc/model/ipkg.lua
b/modules/luci-base/luasrc/model/ipkg.lua
index 976081b84dd7e0c9a31b891adb8857f0663ded65..2e26bd7a163f00d33e4ef080f2f4aedb3058fdf5 100644
(file)
--- a/
modules/luci-base/luasrc/model/ipkg.lua
+++ b/
modules/luci-base/luasrc/model/ipkg.lua
@@
-211,7
+211,12
@@
function compare_versions(ver1, comp, ver2)
local av1 = util.split(ver1, "[%.%-]", nil, true)
local av2 = util.split(ver2, "[%.%-]", nil, true)
- for i = 1, math.max(table.getn(av1),table.getn(av2)), 1 do
+ local max = table.getn(av1)
+ if (table.getn(av1) < table.getn(av2)) then
+ max = table.getn(av2)
+ end
+
+ for i = 1, max, 1 do
local s1 = av1[i] or ""
local s2 = av2[i] or ""
git clone https://git.99rst.org/PROJECT