ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [1/2] incubator-ponymail git commit: Localise variables as far as possible
Date Sat, 07 Jan 2017 01:49:58 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master f843e6891 -> 4d165cab2


Localise variables as far as possible

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/a0b00093
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/a0b00093
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/a0b00093

Branch: refs/heads/master
Commit: a0b00093f47df41e089c3438ecb25c0fc62cf670
Parents: f843e68
Author: Sebb <sebb@apache.org>
Authored: Fri Jan 6 22:23:56 2017 +0000
Committer: Sebb <sebb@apache.org>
Committed: Fri Jan 6 22:23:56 2017 +0000

----------------------------------------------------------------------
 site/api/stats.lua | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/a0b00093/site/api/stats.lua
----------------------------------------------------------------------
diff --git a/site/api/stats.lua b/site/api/stats.lua
index 423af53..cd61cf7 100644
--- a/site/api/stats.lua
+++ b/site/api/stats.lua
@@ -102,19 +102,14 @@ function handle(r)
     if get.d and tonumber(get.d) and tonumber(get.d) > 0 then
         dd = tonumber(get.d)
     end
-    local x
-    local nx
-    local y
-    local z
-    local ec
     -- Param: q=query
     if get.q and #get.q > 0 then
-        x = {}
-        nx = {}
+        local x = {}
+        local nx = {}
         local q = get.q:gsub("+", " ") -- apache quirk?
         for k, v in pairs({'from','subject','body'}) do
-            y = {}
-            z = {}
+            local y = {}
+            local z = {}
             local words = {}
             
             -- first, grab all "foo bar" quotes
@@ -163,7 +158,7 @@ function handle(r)
         domain = get.domain
     }
 
-    z = {}
+    local z = {}
     -- Param: header_from=
     -- Param: header_subject=
     -- Param: header_body=
@@ -256,7 +251,7 @@ function handle(r)
     if get.s and get.e then
         local em = tonumber(get.e:match("%-(%d%d?)$"))
         local ey = tonumber(get.e:match("^(%d%d%d%d)"))
-        ec = days[em]
+        local ec = days[em]
         if em == 2 and leapYear(ey) then
             ec = ec + 1
         end


Mime
View raw message