From 0eb1edfd0c37a0cbd612b1d15c6e0561aae87f7e Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Thu, 19 Mar 2015 18:25:26 -0400 Subject: [PATCH] Fix CFILE use in sparse --- base/sparse/cholmod.jl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/base/sparse/cholmod.jl b/base/sparse/cholmod.jl index c1cde9968c437..d467f9bb2d1c3 100644 --- a/base/sparse/cholmod.jl +++ b/base/sparse/cholmod.jl @@ -663,6 +663,13 @@ for Ti in IndexTypes finalizer(s, free!) s end + + function read_sparse(file::IO, T) + cfile = Libc.FILE(file) + s = read_sparse(cfile, T) + close(cfile) + s + end end end @@ -791,7 +798,7 @@ Sparse(A::Dense) = dense_to_sparse(A, Cint) Sparse(L::Factor) = factor_to_sparse!(copy(L)) function Sparse(filename::ByteString) open(filename) do f - return read_sparse(Libc.FILE(f), SuiteSparse_long) + return read_sparse(f, SuiteSparse_long) end end