close_in chan
let lookup_api_version sym =
- try Hashtbl.find hash sym
- with Not_found ->
- failwithf "API symbol \"%s\" not found in API versions file" sym
+ try Some (Hashtbl.find hash sym)
+ with Not_found -> None
val load_api_versions : string -> unit
(** Load the data from the named file. *)
-val lookup_api_version : string -> string
+val lookup_api_version : string -> string option
(** [lookup_api_version c_api] looks up the version that the C API call
(which must be the full C name, eg. ["guestfs_launch"]) was
- added. This returns the version string, eg. ["0.3"]. *)
+ added. This returns the version string, eg. [Some "0.3"], or
+ [None] if no version could be found. *)
| None -> ()
| Some txt -> pr "%s\n\n" txt
);
- let version = lookup_api_version name in
- pr "(Added in %s)\n\n" version;
+ (match lookup_api_version name with
+ | Some version -> pr "(Added in %s)\n\n" version
+ | None -> ()
+ );
(* Handling of optional argument variants. *)
if optargs <> [] then (