diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-09-30 20:55:11 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-09-30 20:55:11 +0000 |
commit | 8465c1513276ddfab59ed7578049cebf167b71fc (patch) | |
tree | 4ad27e47c238cd4c814e7d8d146fe5a2148effc9 /perl_checker.src/common.ml | |
parent | 98004c4ce6b1853dfd86c8060a049094afb4de93 (diff) | |
download | perl-MDK-Common-8465c1513276ddfab59ed7578049cebf167b71fc.tar perl-MDK-Common-8465c1513276ddfab59ed7578049cebf167b71fc.tar.gz perl-MDK-Common-8465c1513276ddfab59ed7578049cebf167b71fc.tar.bz2 perl-MDK-Common-8465c1513276ddfab59ed7578049cebf167b71fc.tar.xz perl-MDK-Common-8465c1513276ddfab59ed7578049cebf167b71fc.zip |
display relative file names when nicer
Diffstat (limited to 'perl_checker.src/common.ml')
-rw-r--r-- | perl_checker.src/common.ml | 17 |
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 = |