Skip to content

Commit

Permalink
try automatically managing freeing p_create (#587)
Browse files Browse the repository at this point in the history
`yuyichao` suggested this two years ago in #349 (comment)
  • Loading branch information
scottstanie authored and musm committed Oct 16, 2019
1 parent 99a1b77 commit 1bf4cf8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ function h5open(filename::AbstractString, rd::Bool, wr::Bool, cr::Bool, tr::Bool
end
close_apl = false
if apl.id == H5P_DEFAULT
apl = p_create(H5P_FILE_ACCESS, false)
apl = p_create(H5P_FILE_ACCESS, true)
close_apl = true
# With garbage collection, the other modes don't make sense
apl["fclose_degree"] = H5F_CLOSE_STRONG
Expand Down Expand Up @@ -649,11 +649,11 @@ function h5open(filename::AbstractString, mode::AbstractString="r", pv...; swmr=
# pv is interpreted as pairs of arguments
# the first of a pair is a key of hdf5_prop_get_set
# the second of a pair is a property value
fapl = p_create(H5P_FILE_ACCESS, false, pv...) # file access property list
fapl = p_create(H5P_FILE_ACCESS, true, pv...) # file access property list
# With garbage collection, the other modes don't make sense
# (Set this first, so that the user-passed properties can overwrite this.)
fapl["fclose_degree"] = H5F_CLOSE_STRONG
fcpl = p_create(H5P_FILE_CREATE, false, pv...) # file create property list
fcpl = p_create(H5P_FILE_CREATE, true, pv...) # file create property list
modes =
mode == "r" ? (true, false, false, false, false) :
mode == "r+" ? (true, true, false, false, true ) :
Expand Down

0 comments on commit 1bf4cf8

Please sign in to comment.