Skip to content

Commit d5fcacb

Browse files
committed
Shrink variables in parseHunkHeader.
1 parent 70cc0c3 commit d5fcacb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

xtra/PATCH.LUA

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ local function patch(pf)
3030
elseif ls=='@'then if l:sub(2,3)=="@ " then
3131
local function parseHunkHeader()
3232
local function split(i,d)local r={}for m in (i..d):gmatch("(.-)"..d)do table.insert(r,m)end return r end
33-
local words,o,n=split(l," "),{},{}
34-
if words[2]then o=split(words[2],",")end if words[3]then n=split(words[3],",")end
35-
if o[1]then o[1]=o[1]:sub(2)end if n[1]then n[1]=n[1]:sub(2)end
36-
return{o={s=tonumber(o[1]),l=tonumber(o[2])or 1},n={s=tonumber(n[1]),l=tonumber(n[2])or 1}}end
33+
local s,o,w=split(l," "),{},{}
34+
if s[2]then o=split(s[2],",")end if s[3]then w=split(s[3],",")end
35+
if o[1]then o[1]=o[1]:sub(2)end if w[1]then w[1]=w[1]:sub(2)end
36+
return{o={s=tonumber(o[1]),l=tonumber(o[2])or 1},n={s=tonumber(w[1]),l=tonumber(w[2])or 1}}end
3737
if h then if h.o.l~=bl-(h.o.s-1)or h.n.l~=ol-(h.n.s-1)then print(M)os.exit(1)else print("patched")end end
3838
h=parseHunkHeader()if h then
3939
io.write("\t@@ -"..h.o.s..","..h.o.l.." +"..h.n.s..","..h.n.l.." @@: ")

0 commit comments

Comments
 (0)