From: Tobias Ulmer Date: Wed, 15 Aug 2012 14:09:52 +0000 (+0200) Subject: Remove buggy get_first_val(), rewrite only place it was used X-Git-Tag: e2factory-2.3.13rc1~165 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=dd6c163a94cf9acc6b16d6ff6feda0e7705f68d8;p=e2factory.git Remove buggy get_first_val(), rewrite only place it was used Signed-off-by: Tobias Ulmer --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index b664ef8..cd005a6 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -837,11 +837,13 @@ end -- @return bool -- @return error string on error function e2lib.read_global_config(e2_config_file) - e2lib.log(4, "read_global_config()") - local cf = e2lib.get_first_val({ - e2lib.globals.cmdline["e2-config"], -- command line - e2lib.globals.osenv["E2_CONFIG"], -- environment - }) + local cf + if type(e2lib.globals.cmdline["e2-config"]) == "string" then + cf = e2lib.globals.cmdline["e2-config"] + elseif type(e2lib.globals.osenv["E2_CONFIG"]) == "string" then + cf = e2lib.globals.osenv["E2_CONFIG"] + end + local cf_path if cf then cf_path = { cf } @@ -1984,18 +1986,6 @@ function e2lib.format_replace(s, t) return s end ---- take a table of values, with integer keys and return the first string --- value --- @param a table of values -function e2lib.get_first_val(t) - for k, v in pairs(t) do - if type(v) == "string" then - return v - end - end - return nil -end - --- change directory -- @param path -- @return bool