Skip to content

Commit

Permalink
uninitialized
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Feb 4, 2018
1 parent 1797e66 commit d72d171
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Shoco.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export compress, decompress
function compress(s::AbstractString)
isempty(s) && return ""
# The output should be no longer than the input
compressed = Vector{UInt8}(sizeof(s))
compressed = Vector{UInt8}(uninitialized, sizeof(s))
# The function modifies `compressed` and returns the number of bytes written
nbytes = ccall((:shoco_compress, shoco), Int,
(Ptr{Cchar}, Csize_t, Ptr{UInt8}, Csize_t),
Expand All @@ -29,7 +29,7 @@ end
function decompress(s::AbstractString)
isempty(s) && return ""
# The decompressed string will be at most twice as long as the input
decompressed = Vector{UInt8}(2 * sizeof(s))
decompressed = Vector{UInt8}(uninitialized, 2 * sizeof(s))
nbytes = ccall((:shoco_decompress, shoco), Int,
(Ptr{Cchar}, Csize_t, Ptr{UInt8}, Csize_t),
s, sizeof(s), decompressed, 2 * sizeof(s))
Expand Down

0 comments on commit d72d171

Please sign in to comment.