summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/common.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-09-30 20:55:11 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-09-30 20:55:11 +0000
commit26815d8c809e3ebe8a1f1d41cf8f4b28234089e6 (patch)
tree1df551d6d4e7afcc47221f207913aeb328b4aad2 /perl_checker.src/common.ml
parentaa1c154e46f6886584b9c16f894e0ff2dcabdbfa (diff)
downloadperl_checker-26815d8c809e3ebe8a1f1d41cf8f4b28234089e6.tar
perl_checker-26815d8c809e3ebe8a1f1d41cf8f4b28234089e6.tar.gz
perl_checker-26815d8c809e3ebe8a1f1d41cf8f4b28234089e6.tar.bz2
perl_checker-26815d8c809e3ebe8a1f1d41cf8f4b28234089e6.tar.xz
perl_checker-26815d8c809e3ebe8a1f1d41cf8f4b28234089e6.zip
display relative file names when nicer
Diffstat (limited to 'perl_checker.src/common.ml')
-rw-r--r--perl_checker.src/common.ml17
1 files changed, 8 insertions, 9 deletions
diff --git a/perl_checker.src/common.ml b/perl_checker.src/common.ml
index 6d5c79c..ee989dc 100644
--- a/perl_checker.src/common.ml
+++ b/perl_checker.src/common.ml
@@ -522,6 +522,14 @@ let hashtbl_exists f h =
false
with Found -> true
+let memoize f =
+ let hash = Hashtbl.create 16 in
+ fun k ->
+ try Hashtbl.find hash k
+ with Not_found ->
+ let v = f k in
+ Hashtbl.add hash k v ; v
+
let array_shift a = Array.sub a 1 (Array.length a - 1)
let array_last_n n a =
let len = Array.length a in
@@ -828,15 +836,6 @@ let expand_symlinks file =
) (file ^ "/" ^ piece)) "" l
| _ -> internal_error (Printf.sprintf "expand_symlinks: %s is relative\n" file)
-let file_to_absolute_file file =
- let abs_file =
- if file.[0] = '/' then file else
- let cwd = Unix.getcwd() in
- if file = "." then cwd else cwd ^ "/" ^ file
- in
- expand_symlinks abs_file
-
-
let mtime f = int_of_float ((Unix.stat f).Unix.st_mtime)
let rec updir dir nb =