[Pkg-ocaml-maint-commits] [approx] 03/16: remove unused exports

Eric Cooper ecc at cmu.edu
Mon Dec 9 15:44:03 UTC 2013


This is an automated email from the git hooks/post-receive script.

ecc-guest pushed a commit to branch upstream
in repository approx.

commit f8ec21e07ac4af51ec71d5a9ec498fd9f550de2f
Author: Eric Cooper <ecc at cmu.edu>
Date:   Sat Mar 9 11:06:14 2013 -0500

    remove unused exports
---
 util.ml  | 34 +++++++++++++++++-----------------
 util.mli | 49 +++++--------------------------------------------
 2 files changed, 22 insertions(+), 61 deletions(-)

diff --git a/util.ml b/util.ml
index 182fcc4..b5c9166 100644
--- a/util.ml
+++ b/util.ml
@@ -1,5 +1,5 @@
 (* approx: proxy server for Debian archive files
-   Copyright (C) 2011  Eric C. Cooper <ecc at cmu.edu>
+   Copyright (C) 2013  Eric C. Cooper <ecc at cmu.edu>
    Released under the GNU General Public License *)
 
 open Printf
@@ -70,6 +70,8 @@ let make_directory path =
 
 let quoted_string = sprintf "%S"
 
+(* Return the relative portion of a pathname *)
+
 let relative_path path =
   let n = String.length path in
   let rec loop i =
@@ -92,6 +94,9 @@ let relative_url path =
   with _ ->
     failwith ("malformed URL: " ^ path)
 
+(* Split a filename into the leading portion without an extension
+   and the extension, if any, beginning with '.' *)
+
 let split_extension file =
   let base = Filename.basename file in
   (* look for '.' in basename only, not parent directories *)
@@ -103,6 +108,8 @@ let split_extension file =
     (if dir = "." then name else dir ^/ name), ext
   with Not_found -> (file, "")
 
+(* Return a filename with its extension, if any, removed *)
+
 let without_extension file = fst (split_extension file)
 
 let extension file = snd (split_extension file)
@@ -121,6 +128,9 @@ let unwind_protect body post =
   | Unwind e -> raise e    (* assume cleanup has been done *)
   | e -> post (); raise e
 
+(* Apply a function to a resource that is acquired and released by
+   the given functions *)
+
 let with_resource release acquire x f =
   let res = acquire x in
   unwind_protect
@@ -151,6 +161,8 @@ let gensym str =
 
 let tmp_dir_name = ref None
 
+(* Return the name of the temporary file directory *)
+
 let tmp_dir () =
   match !tmp_dir_name with
   | Some dir -> dir
@@ -169,12 +181,15 @@ let rm file = try Sys.remove file with _ -> ()
 
 let compressed_extensions = [".gz"; ".bz2"; ".lzma"; ".xz"]
 
+(* Check if a file is compressed by examining its extension *)
+
 let is_compressed file = List.mem (extension file) compressed_extensions
 
 (* Decompress a file to a temporary file,
    rather than reading from a pipe or using the CamlZip library,
    so that we detect corrupted files before partially processing them.
-   This is also significantly faster than using CamlZip. *)
+   This is also significantly faster than using CamlZip.
+   Return the temporary file name, which must be removed by the caller *)
 
 let decompress file =
   if extension file <> ".gz" then invalid_string_arg "decompress" file
@@ -225,16 +240,6 @@ let newest_file list =
   | Some (f, _) -> f
   | None -> raise Not_found
 
-let copy_channel src dst =
-  let len = 4096 in
-  let buf = String.create len in
-  let rec loop () =
-    match input src buf 0 len with
-    | 0 -> ()
-    | n -> output dst buf 0 n; loop ()
-  in
-  loop ()
-
 let open_out_excl file =
   out_channel_of_descr (openfile file [O_CREAT; O_WRONLY; O_EXCL] 0o644)
 
@@ -248,11 +253,6 @@ let update_ctime name =
   | Some { st_atime = atime; st_mtime = mtime } -> utimes name atime mtime
   | None -> ()
 
-let directory_exists dir =
-  Sys.file_exists dir && Sys.is_directory dir
-
-let is_symlink name = (lstat name).st_kind = S_LNK
-
 let directory_id name =
   match stat_file name with
   | Some { st_kind = S_DIR; st_dev = dev; st_ino = ino } -> Some (dev, ino)
diff --git a/util.mli b/util.mli
index 39004e1..72225cd 100644
--- a/util.mli
+++ b/util.mli
@@ -1,5 +1,5 @@
 (* approx: proxy server for Debian archive files
-   Copyright (C) 2011  Eric C. Cooper <ecc at cmu.edu>
+   Copyright (C) 2013  Eric C. Cooper <ecc at cmu.edu>
    Released under the GNU General Public License *)
  
 val invalid_string_arg : string -> string -> 'a
@@ -47,23 +47,10 @@ val make_directory : string -> unit
 
 val quoted_string : string -> string
 
-(* Return the relative portion of a pathname *)
-
-val relative_path : string -> string
-
 (* Return the relative portion of a URL *)
 
 val relative_url : string -> string
 
-(* Split a filename into the leading portion without an extension
-   and the extension, if any, beginning with '.' *)
-
-val split_extension : string -> string * string
-
-(* Return a filename with its extension, if any, removed *)
-
-val without_extension : string -> string
-
 (* Return the extension of a filename, including the initial '.' *)
 
 val extension : string -> string
@@ -77,11 +64,6 @@ val the : 'a option -> 'a
 
 val unwind_protect : (unit -> 'a) -> (unit -> unit) -> 'a
 
-(* Apply a function to a resource that is acquired and released by
-   the given functions *)
-
-val with_resource : ('t -> unit) -> ('a -> 't) -> 'a -> ('t -> 'b) -> 'b
-
 (* Open an input channel and apply a function to the channel,
    using unwind_protect to ensure that the channel gets closed *)
 
@@ -101,23 +83,10 @@ val with_process : ?error:string -> string -> (in_channel -> 'a) -> 'a
 
 val gensym : string -> string
 
-(* Return the name of the temporary file directory *)
-
-val tmp_dir : unit -> string
-
 (* Attempt to remove a file but ignore any errors *)
 
 val rm : string -> unit
 
-(* Check if a file is compressed by examining its extension *)
-
-val is_compressed : string -> bool
-
-(* Decompress a file to a temporary location and return
-   the temporary file name, which must be removed by the caller *)
-
-val decompress : string -> string
-
 (* Decompress a file and apply a function to the temporary file name,
    using unwind_protect to ensure that the temporary file gets removed *)
 
@@ -143,10 +112,6 @@ val open_file : string -> in_channel
 
 val open_out_excl : string -> out_channel
 
-(* Copy an input channel to an output channel *)
-
-val copy_channel : in_channel -> out_channel -> unit
-
 (* Open a temporary file for output in the same directory as the given one
    (so that it can be renamed back to the original), apply the given function,
    and return the file name *)
@@ -158,14 +123,6 @@ val with_temp_file : string -> (out_channel -> unit) -> string
 
 val update_ctime : string -> unit
 
-(* Check if a filename exists and is a directory *)
-
-val directory_exists : string -> bool
-
-(* Check if a filename is a symbolic link *)
-
-val is_symlink : string -> bool
-
 (* Create a generic iterator function from a fold function *)
 
 val iter_of_fold : ((unit -> 'a) -> unit -> 'b) -> 'a -> 'b
@@ -174,12 +131,16 @@ val iter_of_fold : ((unit -> 'a) -> unit -> 'b) -> 'a -> 'b
 
 val fold_dirs : ('a -> string -> 'a) -> 'a -> string -> 'a
 
+(* Apply a function to each directory below a given path *)
+
 val iter_dirs : (string -> unit) -> string -> unit
 
 (* Fold a function over each non-directory below a given path *)
 
 val fold_non_dirs : ('a -> string -> 'a) -> 'a -> string -> 'a
 
+(* Apply a function to each non-directory below a given path *)
+
 val iter_non_dirs : (string -> unit) -> string -> unit
 
 (* Return the Unix stat information *)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/approx.git



More information about the Pkg-ocaml-maint-commits mailing list