Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace bytestring with unsafe_string #82

Merged
merged 1 commit into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/33_3_Initializing_the_Solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function root_fsolver_name(s::Ptr{gsl_root_fsolver})
output_string = output_ptr = ccall( (:gsl_root_fsolver_name, libgsl),
Ptr{Cchar}, (Ptr{gsl_root_fsolver}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand All @@ -111,5 +111,5 @@ function root_fdfsolver_name(s::Ptr{gsl_root_fdfsolver})
output_string = output_ptr = ccall( (:gsl_root_fdfsolver_name,
libgsl), Ptr{Cchar}, (Ptr{gsl_root_fdfsolver}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end
2 changes: 1 addition & 1 deletion src/34_3_Initializing_the_Minimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ function min_fminimizer_name(s::Ptr{gsl_min_fminimizer})
output_string = output_ptr = ccall( (:gsl_min_fminimizer_name,
libgsl), Ptr{Cchar}, (Ptr{gsl_min_fminimizer}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end
4 changes: 2 additions & 2 deletions src/35_2_Initializing_the_Solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function multiroot_fsolver_name(s::Ptr{gsl_multiroot_fsolver})
output_string = output_ptr = ccall( (:gsl_multiroot_fsolver_name,
libgsl), Ptr{Cchar}, (Ptr{gsl_multiroot_fsolver}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand All @@ -123,5 +123,5 @@ function multiroot_fdfsolver_name(s::Ptr{gsl_multiroot_fdfsolver})
output_string = output_ptr = ccall( (:gsl_multiroot_fdfsolver_name,
libgsl), Ptr{Cchar}, (Ptr{gsl_multiroot_fdfsolver}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end
4 changes: 2 additions & 2 deletions src/36_3_Initializing_the_Multidimensional_Minimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function multimin_fdfminimizer_name(s::Ptr{gsl_multimin_fdfminimizer})
output_string = output_ptr = ccall( (:gsl_multimin_fdfminimizer_name,
libgsl), Ptr{Cchar}, (Ptr{gsl_multimin_fdfminimizer}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand All @@ -120,5 +120,5 @@ function multimin_fminimizer_name(s::Ptr{gsl_multimin_fminimizer})
output_string = output_ptr = ccall( (:gsl_multimin_fminimizer_name,
libgsl), Ptr{Cchar}, (Ptr{gsl_multimin_fminimizer}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end
2 changes: 1 addition & 1 deletion src/ConvertGSL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ complex_packed_ptr(c::Vector{Cdouble}) = ComplexF64[c[2i-1]+im*c[2i] for i=1:int
#Register this error handler as GSL's default
#where possible, maps errors to Julia's own exceptions
custom_error_handler(reason::Ptr{UInt8}, file::Ptr{UInt8}, line::Integer, errno::Integer) =
custom_error_handler(bytestring(reason), bytestring(file), line, errno)
custom_error_handler(unsafe_string(reason), unsafe_string(file), line, errno)

mutable struct GSLError <: Exception
errno :: Int32
Expand Down
2 changes: 1 addition & 1 deletion src/_18_5_Auxiliary_random_number_generator_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function rng_name(r::Ref{gsl_rng})
output_string = output_ptr = ccall( (:gsl_rng_name, libgsl),
Ref{Cchar}, (Ref{gsl_rng}, ), r )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function qrng_name(q::Ref{gsl_qrng})
output_string = output_ptr = ccall( (:gsl_qrng_name, libgsl),
Ref{Cchar}, (Ref{gsl_qrng}, ), q )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand Down
2 changes: 1 addition & 1 deletion src/_26_2_Stepping_Functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function odeiv2_step_name(s::Ref{gsl_odeiv2_step})
output_string = output_ptr = ccall( (:gsl_odeiv2_step_name, libgsl),
Ptr{Cchar}, (Ref{gsl_odeiv2_step}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand Down
2 changes: 1 addition & 1 deletion src/_26_3_Adaptive_Step-size_Control.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function odeiv2_control_name(c::Ref{gsl_odeiv2_control})
output_string = output_ptr = ccall( (:gsl_odeiv2_control_name,
libgsl), Ptr{Cchar}, (Ref{gsl_odeiv2_control}, ), c )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand Down
2 changes: 1 addition & 1 deletion src/_27_3_Interpolation_Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function interp_name(interp::Ref{gsl_interp})
output_string = output_ptr = ccall( (:gsl_interp_name, libgsl),
Ptr{Cchar}, (Ref{gsl_interp}, ), interp )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand Down
2 changes: 1 addition & 1 deletion src/_27_6_Higher-level_Interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function spline_name(spline::Ref{gsl_spline})
output_string = output_ptr = ccall( (:gsl_spline_name, libgsl),
Ptr{Cchar}, (Ref{gsl_spline}, ), spline )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand Down
2 changes: 1 addition & 1 deletion src/_31_2_Initialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function wavelet_name(w::Ref{gsl_wavelet})
output_string = output_ptr = ccall( (:gsl_wavelet_name, libgsl),
Ptr{Cchar}, (Ref{gsl_wavelet}, ), w )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand Down
4 changes: 2 additions & 2 deletions src/_33_3_Initializing_the_Solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function root_fsolver_name(s::Ref{gsl_root_fsolver})
output_string = output_ptr = ccall( (:gsl_root_fsolver_name, libgsl),
Ptr{Cchar}, (Ref{gsl_root_fsolver}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand All @@ -109,5 +109,5 @@ function root_fdfsolver_name(s::Ref{gsl_root_fdfsolver})
output_string = output_ptr = ccall( (:gsl_root_fdfsolver_name,
libgsl), Ptr{Cchar}, (Ref{gsl_root_fdfsolver}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end
2 changes: 1 addition & 1 deletion src/_34_3_Initializing_the_Minimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ function min_fminimizer_name(s::Ref{gsl_min_fminimizer})
output_string = output_ptr = ccall( (:gsl_min_fminimizer_name,
libgsl), Ptr{Cchar}, (Ref{gsl_min_fminimizer}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end
4 changes: 2 additions & 2 deletions src/_35_2_Initializing_the_Solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function multiroot_fsolver_name(s::Ref{gsl_multiroot_fsolver})
output_string = output_ptr = ccall( (:gsl_multiroot_fsolver_name,
libgsl), Ptr{Cchar}, (Ref{gsl_multiroot_fsolver}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand All @@ -121,5 +121,5 @@ function multiroot_fdfsolver_name(s::Ref{gsl_multiroot_fdfsolver})
output_string = output_ptr = ccall( (:gsl_multiroot_fdfsolver_name,
libgsl), Ptr{Cchar}, (Ref{gsl_multiroot_fdfsolver}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end
4 changes: 2 additions & 2 deletions src/_36_3_Initializing_the_Multidimensional_Minimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function multimin_fdfminimizer_name(s::Ref{gsl_multimin_fdfminimizer})
output_string = output_ptr = ccall( (:gsl_multimin_fdfminimizer_name,
libgsl), Ptr{Cchar}, (Ref{gsl_multimin_fdfminimizer}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand All @@ -105,5 +105,5 @@ function multimin_fminimizer_name(s::Ref{gsl_multimin_fminimizer})
output_string = output_ptr = ccall( (:gsl_multimin_fminimizer_name,
libgsl), Ptr{Cchar}, (Ref{gsl_multimin_fminimizer}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end
4 changes: 2 additions & 2 deletions src/_38_2_Initializing_the_Solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function multifit_fsolver_name(s::Ref{gsl_multifit_fsolver})
output_string = output_ptr = ccall( (:gsl_multifit_fsolver_name,
libgsl), Ptr{Cchar}, (Ref{gsl_multifit_fsolver}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end


Expand All @@ -107,5 +107,5 @@ function multifit_fdfsolver_name(s::Ref{gsl_multifit_fdfsolver})
output_string = output_ptr = ccall( (:gsl_multifit_fdfsolver_name,
libgsl), Ptr{Cchar}, (Ref{gsl_multifit_fdfsolver}, ), s )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end
2 changes: 1 addition & 1 deletion src/_3_2_Error_Codes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ function strerror(gsl_errno::Integer)
output_string = output_ptr = ccall( (:gsl_strerror, libgsl),
Ptr{Cchar}, (Cint, ), gsl_errno )
output_ptr==C_NULL ? throw(GSL_ERROR(8)) : output_ptr
bytestring(output_string)
unsafe_string(output_string)
end
Compat.@dep_vectorize_1arg Number strerror