aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2013-10-29 21:56:30 -0200
committerHisham Muhammad <hisham@gobolinux.org>2013-10-29 21:56:30 -0200
commit98ef4bf021e8a9f8062514394e7bb166e6a0a892 (patch)
treed73d11b18226ce635007be0ae3b27f02bb5cf055
parentd82cc27ddda123d452a68357db49051cc24267ae (diff)
downloadluarocks-98ef4bf021e8a9f8062514394e7bb166e6a0a892.tar.gz
luarocks-98ef4bf021e8a9f8062514394e7bb166e6a0a892.tar.bz2
luarocks-98ef4bf021e8a9f8062514394e7bb166e6a0a892.zip
Remove redundant function.
-rw-r--r--src/luarocks/tools/patch.lua15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/luarocks/tools/patch.lua b/src/luarocks/tools/patch.lua
index baaacfc1..c518fc4d 100644
--- a/src/luarocks/tools/patch.lua
+++ b/src/luarocks/tools/patch.lua
@@ -10,6 +10,7 @@
10module("luarocks.tools.patch", package.seeall) 10module("luarocks.tools.patch", package.seeall)
11 11
12local fs = require("luarocks.fs") 12local fs = require("luarocks.fs")
13local util = require("luarocks.util")
13 14
14local version = '0.1' 15local version = '0.1'
15 16
@@ -47,12 +48,6 @@ local function table_copy(t)
47 return t2 48 return t2
48end 49end
49 50
50-- Returns boolean whether array t contains value v.
51local function array_contains(t, v)
52 for _,v2 in ipairs(t) do if v == v2 then return true end end
53 return false
54end
55
56local function exists(filename) 51local function exists(filename)
57 local fh = io.open(filename) 52 local fh = io.open(filename)
58 local result = fh ~= nil 53 local result = fh ~= nil
@@ -284,7 +279,7 @@ function read_patch(filename, data)
284 local advance 279 local advance
285 if state == 'filenames' then 280 if state == 'filenames' then
286 if startswith(line, "--- ") then 281 if startswith(line, "--- ") then
287 if array_contains(files.source, nextfileno) then 282 if util.array_contains(files.source, nextfileno) then
288 all_ok = false 283 all_ok = false
289 warning(format("skipping invalid patch for %s", 284 warning(format("skipping invalid patch for %s",
290 files.source[nextfileno+1])) 285 files.source[nextfileno+1]))
@@ -304,7 +299,7 @@ function read_patch(filename, data)
304 table.insert(files.source, match) 299 table.insert(files.source, match)
305 end 300 end
306 elseif not startswith(line, "+++ ") then 301 elseif not startswith(line, "+++ ") then
307 if array_contains(files.source, nextfileno) then 302 if util.array_contains(files.source, nextfileno) then
308 all_ok = false 303 all_ok = false
309 warning(format("skipping invalid patch with no target for %s", 304 warning(format("skipping invalid patch with no target for %s",
310 files.source[nextfileno+1])) 305 files.source[nextfileno+1]))
@@ -315,7 +310,7 @@ function read_patch(filename, data)
315 end 310 end
316 state = 'header' 311 state = 'header'
317 else 312 else
318 if array_contains(files.target, nextfileno) then 313 if util.array_contains(files.target, nextfileno) then
319 all_ok = false 314 all_ok = false
320 warning(format("skipping invalid patch - double target at line %d", 315 warning(format("skipping invalid patch - double target at line %d",
321 lineno+1)) 316 lineno+1))
@@ -354,7 +349,7 @@ function read_patch(filename, data)
354 if not advance and state == 'hunkhead' then 349 if not advance and state == 'hunkhead' then
355 local m1, m2, m3, m4 = match_linerange(line) 350 local m1, m2, m3, m4 = match_linerange(line)
356 if not m1 then 351 if not m1 then
357 if not array_contains(files.hunks, nextfileno-1) then 352 if not util.array_contains(files.hunks, nextfileno-1) then
358 all_ok = false 353 all_ok = false
359 warning(format("skipping invalid patch with no hunks for file %s", 354 warning(format("skipping invalid patch with no hunks for file %s",
360 files.target[nextfileno])) 355 files.target[nextfileno]))