From fbe295af8f19e0e331d43b539e27ee6b7f3301bf Mon Sep 17 00:00:00 2001 From: Kenta Sato Date: Mon, 2 Jul 2018 14:43:13 +0900 Subject: [PATCH] fix deprecations of cfunction (#71) --- REQUIRE | 2 +- src/EzXML.jl | 4 +++- src/document.jl | 2 +- src/error.jl | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/REQUIRE b/REQUIRE index e67b2c3..212630d 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,3 @@ julia 0.6 BinaryProvider 0.3 -Compat 0.67 +Compat 0.68 diff --git a/src/EzXML.jl b/src/EzXML.jl index 28655e3..1b6c078 100644 --- a/src/EzXML.jl +++ b/src/EzXML.jl @@ -100,7 +100,9 @@ import Compat: Cvoid, stdin, stdout, - bytesavailable + bytesavailable, + findall, + @cfunction using Compat.Libdl using Compat.Printf: @printf diff --git a/src/document.jl b/src/document.jl index 0705375..cf0876c 100644 --- a/src/document.jl +++ b/src/document.jl @@ -198,7 +198,7 @@ end function make_read_callback() # Passing an input stream as an argument is impossible to create a callback # because Julia does not support C-callable closures yet. - return cfunction(Cint, Tuple{Ptr{Cvoid}, Ptr{UInt8}, Cint}) do context, buffer, len + return @cfunction(Cint, (Ptr{Cvoid}, Ptr{UInt8}, Cint)) do context, buffer, len input = unsafe_pointer_to_objref(context) avail = min(bytesavailable(input), len) if avail > 0 diff --git a/src/error.jl b/src/error.jl index 07524a6..79de250 100644 --- a/src/error.jl +++ b/src/error.jl @@ -57,7 +57,7 @@ end # Initialize an error handler. function init_error_handler() - error_handler = cfunction(Cvoid, Tuple{Ptr{Cvoid}, Ptr{Cvoid}}) do ctx, err_ptr + error_handler = @cfunction(Cvoid, (Ptr{Cvoid}, Ptr{Cvoid})) do ctx, err_ptr if ctx == pointer_from_objref(_Error) err = unsafe_load(convert(Ptr{_Error}, err_ptr)) push!(XML_GLOBAL_ERROR_STACK, XMLError(err.domain, err.code, chomp(unsafe_string(err.message)), err.level, err.line))