[Libguestfs] [PATCH] builder: use Filename.check_suffix

Pino Toscano
Mon, 10 Mar 2014 12:48:29 -0000

... instead of manually extracting and checking the suffix by ourselves
---
 builder/sources.ml | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/builder/sources.ml b/builder/sources.ml
index fd0b236..016adc4 100644
--- a/builder/sources.ml
+++ b/builder/sources.ml
@@ -87,10 +87,7 @@ let merge_sources current_sources new_sources    )
new_sources current_sources

 let filter_filenames filename -  let suffix = ".conf" in
-  let n = String.length filename in
-  let ns = String.length suffix in
-  n >= ns && String.sub filename (n - ns) ns = suffix
+  Filename.check_suffix filename ".conf"

 let read_sources ~prog ~debug    let dirs = Paths.xdg_config_dirs ~prog in
--
1.8.3.1