Skip to content

Commit 2b6f8a5

Browse files
author
Jack Feser
committed
Clean up dependencies and upgrade dune.
1 parent 59d72ee commit 2b6f8a5

File tree

9 files changed

+25
-33
lines changed

9 files changed

+25
-33
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.2 (2019-02-12)
2+
3+
Update to dune 1.7 and clean up dependencies.
4+
15
## 0.1.1 (2018-12-11)
26

37
Fix bug where C memory was released prematurely.

cmph.opam

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
opam-version: "1.2"
22
name: "cmph"
3-
version: "0.1.1"
3+
version: "0.1.2"
44
maintainer: "Jack Feser <[email protected]>"
55
authors: "Jack Feser <[email protected]>"
66
homepage: "https://github.com/jfeser/ocaml-cmph"
@@ -12,11 +12,10 @@ build: [
1212
["dune" "build" "-p" name "-j" jobs]
1313
]
1414
depends: [
15-
"dune" {build & >= "1.1"}
15+
"dune" {build & >= "1.7"}
1616
"ounit" {test & >= "2.0" & < "2.1"}
1717
"ctypes" {>= "0.14" & < "0.15"}
1818
"ctypes-foreign" {>= "0.4" & < "0.5"}
19-
"base" {>= "v0.11" & < "v0.12"}
20-
"stdio" {>= "v0.11" & < "v0.12"}
19+
"core" {>= "v0.11" & < "v0.12"}
2120
"ppx_sexp_conv" {>= "v0.11" & < "v0.12"}
2221
]

dune-project

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
(lang dune 1.1)
1+
(lang dune 1.7)
2+
(name cmph)

lib/cmph.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
(* 3. Generate the hash function. *)
44
(* 4. Export the hash function by dumping to a file or outputting as a buffer. *)
55

6-
open Base
7-
open Stdio
6+
open Core
87
open Ctypes
98
open Foreign
109
module Util = Util

lib/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
(name cmph)
77
(public_name cmph)
88
(modules cmph util)
9-
(libraries base stdio ctypes ctypes.foreign)
9+
(libraries core ctypes ctypes.foreign)
1010
(c_library_flags (:standard (:include flags) -lcmph))
1111
(preprocess (pps ppx_sexp_conv ppx_compare)))
1212

lib/util.ml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
open Base
1+
open Core
22

33
let with_output thunk =
44
let old_stdout = Unix.(dup stdout) in
55
let old_stderr = Unix.(dup stderr) in
6-
let tmp_fn = Caml.Filename.temp_file "output" "log" in
7-
let tmp_fd = Unix.(openfile tmp_fn [O_RDWR; O_CREAT; O_KEEPEXEC] 0o600) in
8-
Unix.(dup2 tmp_fd stdout) ;
9-
Unix.(dup2 tmp_fd stderr) ;
6+
let tmp_fn = Filename.temp_file "output" "log" in
7+
let tmp_fd =
8+
Unix.(openfile tmp_fn ~mode:[O_RDWR; O_CREAT; O_KEEPEXEC] ~perm:0o600)
9+
in
10+
Unix.(dup2 ~src:tmp_fd ~dst:stdout) ;
11+
Unix.(dup2 ~src:tmp_fd ~dst:stderr) ;
1012
let cleanup () =
11-
Unix.(dup2 old_stdout stdout) ;
12-
Unix.(dup2 old_stderr stderr) ;
13+
Unix.(dup2 ~src:old_stdout ~dst:stdout) ;
14+
Unix.(dup2 ~src:old_stderr ~dst:stderr) ;
1315
Unix.close old_stdout ;
1416
Unix.close old_stderr ;
15-
assert (Unix.(lseek tmp_fd 0 SEEK_SET) = 0) ;
16-
let tot_len = Unix.((fstat tmp_fd).st_size) in
17+
assert (Unix.(lseek tmp_fd 0L ~mode:SEEK_SET) = 0L) ;
18+
let tot_len = Unix.((fstat tmp_fd).st_size) |> Int.of_int64_exn in
1719
let buf = Bytes.create tot_len in
1820
let rec read_all ofs rem_len =
1921
if rem_len <= 0 then ()
2022
else
21-
let read_len = Unix.read tmp_fd buf ofs rem_len in
23+
let read_len = Unix.read tmp_fd ~buf ~pos:ofs ~len:rem_len in
2224
let ofs = ofs + read_len in
2325
let rem_len = rem_len - read_len in
2426
read_all ofs rem_len

test/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(executables
2-
(names vector test)
2+
(names test)
33
(libraries oUnit cmph))
44

55
(alias

test/test.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
open Base
2-
open Stdio
1+
open Core
32
open OUnit2
43
open Cmph
54
open Util

test/vector.ml

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)