summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util.ml5
-rw-r--r--src/util.mli2
-rw-r--r--src/value_checker.ml2
-rw-r--r--src/vyconf_config.ml2
-rw-r--r--src/vyconfd.ml2
5 files changed, 3 insertions, 10 deletions
diff --git a/src/util.ml b/src/util.ml
index afa0ef3..7f0d681 100644
--- a/src/util.ml
+++ b/src/util.ml
@@ -21,10 +21,5 @@ let string_of_path path =
| [] -> ""
| x :: xs -> Printf.sprintf "%s%s" x (aux xs "")
-let substitute_default o d =
- match o with
- | None -> d
- | Some v -> v
-
let absolute_path relative_path =
FilePath.make_absolute (Sys.getcwd ()) relative_path
diff --git a/src/util.mli b/src/util.mli
index 46fac71..9f6c3db 100644
--- a/src/util.mli
+++ b/src/util.mli
@@ -2,6 +2,4 @@ val find_xml_child : string -> Xml.xml -> Xml.xml option
val string_of_path : string list -> string
-val substitute_default : 'a option -> 'a -> 'a
-
val absolute_path : FilePath.filename -> FilePath.filename
diff --git a/src/value_checker.ml b/src/value_checker.ml
index dad4596..e7bec15 100644
--- a/src/value_checker.ml
+++ b/src/value_checker.ml
@@ -16,7 +16,7 @@ let validate_value dir value_constraint value =
We should do something about it.
*)
let validator = F.concat dir v in
- let arg = Util.substitute_default c "" in
+ let arg = BatOption.default "" c in
let result = Unix.system (Printf.sprintf "%s %s %s" validator arg value) in
match result with
| Unix.WEXITED 0 -> true
diff --git a/src/vyconf_config.ml b/src/vyconf_config.ml
index 6c24ffb..7a87c1a 100644
--- a/src/vyconf_config.ml
+++ b/src/vyconf_config.ml
@@ -47,7 +47,7 @@ let mandatory_field conf table field =
let optional_field default conf table field =
let value = get_field conf table field in
- Util.substitute_default value default
+ BatOption.default default value
let load filename =
try
diff --git a/src/vyconfd.ml b/src/vyconfd.ml
index c07b1b3..d8fa7c5 100644
--- a/src/vyconfd.ml
+++ b/src/vyconfd.ml
@@ -40,7 +40,7 @@ let make_session_token () =
let setup_session world req =
let token = make_session_token () in
let user = "unknown user" in
- let client_app = Util.substitute_default req.client_application "unknown client" in
+ let client_app = BatOption.default "unknown client" req.client_application in
let () = Hashtbl.add sessions token (Session.make world client_app user) in
{response_tmpl with output=(Some token)}