Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request JuliaLang#12070 from JuliaLang/jq/mmapdeprecate
Browse files Browse the repository at this point in the history
Fix borked mmap deprecations
  • Loading branch information
quinnj committed Jul 8, 2015
2 parents 435daf5 + 756d607 commit 7fa43ed
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ end
@deprecate strftime Libc.strftime
@deprecate strptime Libc.strptime
@deprecate flush_cstdio Libc.flush_cstdio
@deprecate mmap Libc.mmap
@deprecate c_free Libc.free
@deprecate c_malloc Libc.malloc
@deprecate c_calloc Libc.calloc
Expand Down Expand Up @@ -557,9 +556,9 @@ msync{T}(A::Array{T}) = msync(pointer(A), length(A)*sizeof(T))
msync(B::BitArray) = msync(pointer(B.chunks), length(B.chunks)*sizeof(UInt64))

@unix_only begin

export mmap
function mmap(len::Integer, prot::Integer, flags::Integer, fd, offset::Integer)
depwarn("`mmap` is deprecated, use `mmap(io, Array{T,N}, dims, offset)` instead to return an mmapped-array", :mmap)
depwarn("`mmap` is deprecated, use `Mmap.mmap(io, Array{T,N}, dims, offset)` instead to return an mmapped-array", :mmap)
const pagesize::Int = ccall(:jl_getpagesize, Clong, ())
# Check that none of the computations will overflow
if len < 0
Expand Down Expand Up @@ -613,7 +612,7 @@ end

end

@unix_only @deprecate mmap_array{T,N}(::Type{T}, dims::NTuple{N,Integer}, s::IO, offset=position(s)) mmap(s, Array{T,N}, dims, offset)
@unix_only @deprecate mmap_array{T,N}(::Type{T}, dims::NTuple{N,Integer}, s::IO, offset=position(s)) Mmap.mmap(s, Array{T,N}, dims, offset)

@windows_only begin
type SharedMemSpec
Expand All @@ -623,13 +622,13 @@ type SharedMemSpec
end
export mmap_array
function mmap_array{T,N}(::Type{T}, dims::NTuple{N,Integer}, s::Union(IO,SharedMemSpec), offset::FileOffset)
depwarn("`mmap_array` is deprecated, use `mmap(io, Array{T,N}, dims, offset)` instead to return an mmapped-array", :mmap_array)
depwarn("`mmap_array` is deprecated, use `Mmap.mmap(io, Array{T,N}, dims, offset)` instead to return an mmapped-array", :mmap_array)
if isa(s,SharedMemSpec)
a = Mmap.AnonymousMmap(s.name, s.readonly, s.create)
a = Mmap.Anonymous(s.name, s.readonly, s.create)
else
a = s
end
return mmap(a, Array{T,N}, dims, offset)
return Mmap.mmap(a, Array{T,N}, dims, offset)
end
end

Expand Down

0 comments on commit 7fa43ed

Please sign in to comment.