Skip to content

Commit

Permalink
Use Vector in more misc places (JuliaLang#21549)
Browse files Browse the repository at this point in the history
  • Loading branch information
musm authored and tkelman committed Apr 26, 2017
1 parent 8e283e8 commit 53161af
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion base/dates/periods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ julia> Dates.CompoundPeriod(Dates.Minute(50000))
50000 minutes
```
"""
CompoundPeriod(p::Vector{<:Period}) = CompoundPeriod(Array{Period}(p))
CompoundPeriod(p::Vector{<:Period}) = CompoundPeriod(Vector{Period}(p))

CompoundPeriod(t::Time) = CompoundPeriod(Period[Hour(t), Minute(t), Second(t), Millisecond(t),
Microsecond(t), Nanosecond(t)])
Expand Down
3 changes: 1 addition & 2 deletions base/distributed/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function splitrange(N::Int, np::Int)
each = div(N,np)
extras = rem(N,np)
nchunks = each > 0 ? np : extras
chunks = Array{UnitRange{Int}}(nchunks)
chunks = Vector{UnitRange{Int}}(nchunks)
lo = 1
for i in 1:nchunks
hi = lo + each - 1
Expand Down Expand Up @@ -203,4 +203,3 @@ macro parallel(args...)
end
thecall
end

2 changes: 1 addition & 1 deletion base/env.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ if is_windows()
pos = block[1]
blk = block[2]
len = ccall(:wcslen, UInt, (Ptr{UInt16},), pos)
buf = Array{UInt16}(len)
buf = Vector{UInt16}(len)
unsafe_copy!(pointer(buf), pos, len)
env = transcode(String, buf)
m = match(r"^(=?[^=]+)=(.*)$"s, env)
Expand Down
6 changes: 3 additions & 3 deletions base/grisu/bignums.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ const kBigitSize = 28
const kBigitMask = Chunk((1 << kBigitSize) - 1)
# Every instance allocates kBigitLength chunks on the stack. Bignums cannot
# grow. There are no checks if the stack-allocated space is sufficient.
const kBigitCapacity = div(kMaxSignificantBits,kBigitSize)
const kBigitCapacity = div(kMaxSignificantBits, kBigitSize)

mutable struct Bignum
bigits::Array{UInt32,1}
bigits::Vector{UInt32}
used_digits::Int32
exponent::Int32
function Bignum()
bigits = Array{UInt32}(kBigitCapacity)
bigits = Vector{UInt32}(kBigitCapacity)
@inbounds for i = 1:kBigitCapacity
bigits[i] = 0
end
Expand Down
2 changes: 1 addition & 1 deletion base/libc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ if is_windows()
C_NULL, e, 0, lpMsgBuf, 0, C_NULL)
p = lpMsgBuf[]
len == 0 && return ""
buf = Array{UInt16}(len)
buf = Vector{UInt16}(len)
unsafe_copy!(pointer(buf), p, len)
ccall(:LocalFree, stdcall, Ptr{Void}, (Ptr{Void},), p)
return transcode(String, buf)
Expand Down
6 changes: 3 additions & 3 deletions base/pkg/resolve/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ mutable struct Interface
pdict = Dict{String,Int}(pkgs[i] => i for i = 1:np)

# generate spp and pvers
spp = Array{Int}(np)
spp = Vector{Int}(np)

pvers = [VersionNumber[] for i = 1:np]

Expand Down Expand Up @@ -82,11 +82,11 @@ mutable struct Interface
end

## generate wveights:
vweight = Array{Vector{VersionWeight}}(np)
vweight = Vector{Vector{VersionWeight}}(np)
for p0 = 1:np
pvers0 = pvers[p0]
spp0 = spp[p0]
vweight0 = vweight[p0] = Array{VersionWeight}(spp0)
vweight0 = vweight[p0] = Vector{VersionWeight}(spp0)
for v0 = 1:spp0-1
vweight0[v0] = VersionWeight(pvers0[v0])
end
Expand Down
2 changes: 1 addition & 1 deletion base/pkg/resolve/maxsum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ function getsolution(msgs::Messages)

fld = msgs.fld
np = length(fld)
sol = Array{Int}(np)
sol = Vector{Int}(np)
for p0 = 1:np
fld0 = fld[p0]
s0 = indmax(fld0)
Expand Down
4 changes: 2 additions & 2 deletions base/random.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ To randomly permute a arbitrary vector, see [`shuffle`](@ref)
or [`shuffle!`](@ref).
"""
function randperm(r::AbstractRNG, n::Integer)
a = Array{typeof(n)}(n)
a = Vector{typeof(n)}(n)
@assert n <= Int64(2)^52
if n == 0
return a
Expand All @@ -1532,7 +1532,7 @@ Construct a random cyclic permutation of length `n`. The optional `rng`
argument specifies a random number generator, see [Random Numbers](@ref).
"""
function randcycle(r::AbstractRNG, n::Integer)
a = Array{typeof(n)}(n)
a = Vector{typeof(n)}(n)
n == 0 && return a
@assert n <= Int64(2)^52
a[1] = 1
Expand Down
2 changes: 1 addition & 1 deletion base/sparse/sparsevector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ end
function hvcat(rows::Tuple{Vararg{Int}}, X::_SparseConcatGroup...)
nbr = length(rows) # number of block rows

tmp_rows = Array{SparseMatrixCSC}(nbr)
tmp_rows = Vector{SparseMatrixCSC}(nbr)
k = 0
@inbounds for i = 1 : nbr
tmp_rows[i] = hcat(X[(1 : rows[i]) + k]...)
Expand Down

0 comments on commit 53161af

Please sign in to comment.