]> git.e2factory.org Git - e2factory.git/commitdiff
Remove buggy get_first_val(), rewrite only place it was used
authorTobias Ulmer <tu@emlix.com>
Wed, 15 Aug 2012 14:09:52 +0000 (16:09 +0200)
committerTobias Ulmer <tu@emlix.com>
Tue, 26 Feb 2013 18:07:06 +0000 (19:07 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index b664ef858583e80d3a08a8bec08ef8d8f5e34399..cd005a6ea6a534123811d9c44f496fa232b7ac4b 100644 (file)
@@ -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