From: Jo-Philipp Wich Date: Thu, 7 Aug 2008 15:39:52 +0000 (+0000) Subject: * libs/core/ip: save a redundant object in compare() X-Git-Tag: 0.8.0~507 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=adf1cc4c84cadd1b86ea15d171857c38bee7c967;p=project%2Fluci.git * libs/core/ip: save a redundant object in compare() --- diff --git a/libs/core/luasrc/ip.lua b/libs/core/luasrc/ip.lua index a33c34964a..ea243f9507 100644 --- a/libs/core/luasrc/ip.lua +++ b/libs/core/luasrc/ip.lua @@ -321,8 +321,10 @@ function cidr.mask( self, bits ) end function cidr.contains( self, addr ) - if self:mask() <= addr:mask() then - return self:mask(addr:prefix()) == addr:mask() + local mask1 = self:mask() + local mask2 = addr:mask() + if mask1 <= mask2 then + return self:mask(addr:prefix()) == mask2 end return false