Skip to content

Commit

Permalink
fix most deprecated warnings on Julia 0.7 (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
bicycle1885 authored Dec 1, 2017
1 parent 9f532f3 commit d839406
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/buffer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ mutable struct Buffer
Ptr{_Buffer},
())
buf = new(buf_ptr)
finalizer(buf, finalize_buffer)
if VERSION > v"0.7-"
finalizer(finalize_buffer, buf)
else
finalizer(buf, finalize_buffer)
end
return buf
end
end
Expand Down
6 changes: 5 additions & 1 deletion src/node.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ mutable struct Node
node = new(ptr, owner)
end

finalizer(node, finalize_node)
if VERSION > v"0.7-"
finalizer(finalize_node, node)
else
finalizer(node, finalize_node)
end
else
node = new(ptr)
end
Expand Down
7 changes: 2 additions & 5 deletions src/xpath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,8 @@ function Base.find(node::Node, xpath::AbstractString, ns=namespaces(node))
return Vector{Node}()
end
nodeset = unsafe_load(result.nodesetval)
nodes = Vector{Node}(nodeset.nodeNr)
for i in 1:nodeset.nodeNr
nodes[i] = Node(unsafe_load(nodeset.nodeTab, i))
end
return nodes
# I don't know why, but this fails to infer the type of elements.
return Node[Node(unsafe_load(nodeset.nodeTab, i)) for i in 1:nodeset.nodeNr]
catch
rethrow()
finally
Expand Down

0 comments on commit d839406

Please sign in to comment.