[Unison-hackers] [unison-svn] r514 - trunk/src

vouillon at seas.upenn.edu vouillon at seas.upenn.edu
Fri Sep 21 08:41:53 EDT 2012


Author: vouillon
Date: 2012-09-21 08:41:51 -0400 (Fri, 21 Sep 2012)
New Revision: 514

Modified:
   trunk/src/Makefile.OCaml
   trunk/src/RECENTNEWS
   trunk/src/case.ml
   trunk/src/fspath.ml
   trunk/src/fspath.mli
   trunk/src/mkProjectInfo.ml
   trunk/src/path.ml
   trunk/src/path.mli
   trunk/src/props.ml
   trunk/src/update.ml
   trunk/src/uutil.ml
   trunk/src/uutil.mli
Log:
* Use hash function from OCaml 3.x for comparing archives, even when
  compiled with OCaml 4.x


Modified: trunk/src/Makefile.OCaml
===================================================================
--- trunk/src/Makefile.OCaml	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/Makefile.OCaml	2012-09-21 12:41:51 UTC (rev 514)
@@ -224,7 +224,7 @@
           lwt/pqueue.cmo lwt/lwt.cmo lwt/lwt_util.cmo \
           lwt/$(SYSTEM)/lwt_unix_impl.cmo lwt/lwt_unix.cmo \
           \
-          case.cmo pred.cmo uutil.cmo \
+          uutil.cmo case.cmo pred.cmo \
           fileutil.cmo name.cmo path.cmo fspath.cmo fs.cmo fingerprint.cmo \
           abort.cmo osx.cmo external.cmo fswatch.cmo \
           props.cmo fileinfo.cmo os.cmo lock.cmo clroot.cmo common.cmo \

Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/RECENTNEWS	2012-09-21 12:41:51 UTC (rev 514)
@@ -1,3 +1,9 @@
+CHANGES FROM VERSION 2.46.9
+
+* Use hash function from OCaml 3.x for comparing archives, even when
+  compiled with OCaml 4.x
+
+-------------------------------
 CHANGES FROM VERSION 2.46.8
 
 * Filesystem monitoring: do not use filters on maps, for compatibility

Modified: trunk/src/case.ml
===================================================================
--- trunk/src/case.ml	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/case.ml	2012-09-21 12:41:51 UTC (rev 514)
@@ -140,7 +140,7 @@
   method mode = Sensitive
   method modeDesc = "case sensitive"
   method compare s s' = compare (s : string) s'
-  method hash s = Hashtbl.hash s
+  method hash s = Uutil.hash s
   method normalizePattern s = s
   method caseInsensitiveMatch = false
   method normalizeMatchedString s = s
@@ -152,7 +152,7 @@
   method mode = Insensitive
   method modeDesc = "Latin-1 case insensitive"
   method compare s s' = Util.nocase_cmp s s'
-  method hash s = Hashtbl.hash (String.lowercase s)
+  method hash s = Uutil.hash (String.lowercase s)
   method normalizePattern s = s
   method caseInsensitiveMatch = true
   method normalizeMatchedString s = s
@@ -164,7 +164,7 @@
   method mode = UnicodeSensitive
   method modeDesc = "Unicode case sensitive"
   method compare s s' = Unicode.case_sensitive_compare s s'
-  method hash s = Hashtbl.hash (Unicode.decompose s)
+  method hash s = Uutil.hash (Unicode.decompose s)
   method normalizePattern p = Unicode.decompose p
   method caseInsensitiveMatch = false
   method normalizeMatchedString s = Unicode.decompose s
@@ -176,7 +176,7 @@
   method mode = UnicodeInsensitive
   method modeDesc = "Unicode case insensitive"
   method compare s s' = Unicode.case_insensitive_compare s s'
-  method hash s = Hashtbl.hash (Unicode.normalize s)
+  method hash s = Uutil.hash (Unicode.normalize s)
   method normalizePattern p = Unicode.normalize p
   method caseInsensitiveMatch = false
   method normalizeMatchedString s = Unicode.normalize s

Modified: trunk/src/fspath.ml
===================================================================
--- trunk/src/fspath.ml	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/fspath.ml	2012-09-21 12:41:51 UTC (rev 514)
@@ -335,4 +335,3 @@
 
 let quotes (Fspath f) = Uutil.quotes f
 let compare (Fspath f1) (Fspath f2) = compare f1 f2
-let hash (Fspath f) = Hashtbl.hash f

Modified: trunk/src/fspath.mli
===================================================================
--- trunk/src/fspath.mli	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/fspath.mli	2012-09-21 12:41:51 UTC (rev 514)
@@ -33,5 +33,3 @@
 
 (* CASE-SENSITIVE comparison between fspaths *)
 val compare : t -> t -> int
-(* CASE-SENSITIVE hash of a fspath *)
-val hash : t -> int

Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/mkProjectInfo.ml	2012-09-21 12:41:51 UTC (rev 514)
@@ -86,3 +86,4 @@
 
 
 
+

Modified: trunk/src/path.ml
===================================================================
--- trunk/src/path.ml	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/path.ml	2012-09-21 12:41:51 UTC (rev 514)
@@ -210,10 +210,6 @@
     assert (not (isEmpty path));
     prefix ^ path
 
-(* No need to perform case normalization on local paths *)
-let hash p = Hashtbl.hash p
-let equal (p1 : local) (p2 : local) = p1 = p2
-
 (* Pref controlling whether symlinks are followed. *)
 let followPred = Pred.create ~advanced:true "follow"
     ("Including the preference \\texttt{-follow \\ARG{pathspec}} causes Unison to \

Modified: trunk/src/path.mli
===================================================================
--- trunk/src/path.mli	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/path.mli	2012-09-21 12:41:51 UTC (rev 514)
@@ -33,8 +33,6 @@
   (* Add to the final name, but before any file extension. *)
 
 val compare : t -> t -> int
-val equal : local -> local -> bool
-val hash : local -> int
 
 val followLink : local -> bool
 val followPred : Pred.t

Modified: trunk/src/props.ml
===================================================================
--- trunk/src/props.ml	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/props.ml	2012-09-21 12:41:51 UTC (rev 514)
@@ -305,7 +305,7 @@
     (match id with
        IdIgnored   -> -1
      | IdNumeric i -> i
-     | IdNamed nm  -> Hashtbl.hash nm)
+     | IdNamed nm  -> Uutil.hash nm)
     h
 
 let similar id id' =
@@ -609,7 +609,7 @@
 
 let dummy = None
 
-let hash t h = Uutil.hash2 (Hashtbl.hash t) h
+let hash t h = Uutil.hash2 (Uutil.hash t) h
 
 let similar t t' =
   not (Prefs.read Osx.rsrc) || t = t'

Modified: trunk/src/update.ml
===================================================================
--- trunk/src/update.ml	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/update.ml	2012-09-21 12:41:51 UTC (rev 514)
@@ -256,9 +256,9 @@
                        (checkArchive false (n :: path) a h))
         children (Props.hash desc h)
   | ArchiveFile (desc, dig, _, ress) ->
-      Uutil.hash2 (Hashtbl.hash dig) (Props.hash desc h)
+      Uutil.hash2 (Uutil.hash dig) (Props.hash desc h)
   | ArchiveSymlink content ->
-      Uutil.hash2 (Hashtbl.hash content) h
+      Uutil.hash2 (Uutil.hash content) h
   | NoArchive ->
       135
 

Modified: trunk/src/uutil.ml
===================================================================
--- trunk/src/uutil.ml	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/uutil.ml	2012-09-21 12:41:51 UTC (rev 514)
@@ -34,6 +34,10 @@
 
 let hash2 x y = (17 * x + 257 * y) land 0x3FFFFFFF
 
+external hash_param : int -> int -> 'a -> int = "caml_hash_univ_param" "noalloc"
+
+let hash x = hash_param 10 100 x
+
 (*****************************************************************************)
 (*                             File sizes                                    *)
 (*****************************************************************************)

Modified: trunk/src/uutil.mli
===================================================================
--- trunk/src/uutil.mli	2012-09-19 11:58:57 UTC (rev 513)
+++ trunk/src/uutil.mli	2012-09-21 12:41:51 UTC (rev 514)
@@ -13,6 +13,8 @@
 
 (* Hashing *)
 val hash2 : int -> int -> int
+(* Hash function (OCaml 3.x version) *)
+val hash : 'a -> int
 
 module type FILESIZE = sig
   type t



More information about the Unison-hackers mailing list