[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 2/6] mllib: add a real_uri parameter to Ini_reader.read_ini



Pass the string to the real URI being parsed, if different than the
passed file argument.
---
 builder/index_parser.ml | 2 +-
 mllib/ini_reader.ml     | 2 +-
 mllib/ini_reader.mli    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/builder/index_parser.ml b/builder/index_parser.ml
index aff0b00..219003a 100644
--- a/builder/index_parser.ml
+++ b/builder/index_parser.ml
@@ -127,7 +127,7 @@ let get_index ~downloader ~sigchecker
     Sigchecker.verify sigchecker tmpfile;
 
     (* Try parsing the file. *)
-    let sections = Ini_reader.read_ini tmpfile in
+    let sections = Ini_reader.read_ini ~real_uri:uri tmpfile in
     if delete_tmpfile then
       (try Unix.unlink tmpfile with _ -> ());
 
diff --git a/mllib/ini_reader.ml b/mllib/ini_reader.ml
index 50a06f9..6d1d347 100644
--- a/mllib/ini_reader.ml
+++ b/mllib/ini_reader.ml
@@ -31,7 +31,7 @@ and c_fields = field array
 (* Calls yyparse in the C code. *)
 external parse_index : prog:string -> error_suffix:string -> string -> c_sections = "virt_builder_parse_index"
 
-let read_ini ?(error_suffix = "") file =
+let read_ini ?(error_suffix = "") ?real_uri file =
   let sections = parse_index ~prog ~error_suffix file in
   let sections = Array.to_list sections in
   List.map (
diff --git a/mllib/ini_reader.mli b/mllib/ini_reader.mli
index 62567e8..7005e62 100644
--- a/mllib/ini_reader.mli
+++ b/mllib/ini_reader.mli
@@ -21,4 +21,4 @@ and section = string * fields                (* [name] + fields *)
 and fields = field list
 and field = string * string option * string  (* key + subkey + value *)
 
-val read_ini : ?error_suffix:string -> string -> sections
+val read_ini : ?error_suffix:string -> ?real_uri:string -> string -> sections
-- 
2.1.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]