From 4cb3cb9f1549634adcf6af3ad58a8acc85708fa2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 27 Oct 2024 13:29:15 +0100 Subject: [PATCH] Fix @GC.preserve -> GC.@preserve (#1663) This old syntax has been deprecated for a long time --- examples/IsPower.jl | 4 ++-- src/Misc/Matrix.jl | 4 ++-- src/QuadForm/LineOrbits.jl | 28 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/IsPower.jl b/examples/IsPower.jl index cbdb4cd986..25958843e9 100644 --- a/examples/IsPower.jl +++ b/examples/IsPower.jl @@ -312,11 +312,11 @@ function Base.getindex(H::Hecke.HenselCtx, s::Symbol, i::Int) return unsafe_load(H.link, i) elseif s == :v f = Hecke.Globals.Zx() - @GC.preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.v+(i-1)*sizeof(Hecke.fmpz_poly_raw)) + GC.@preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.v+(i-1)*sizeof(Hecke.fmpz_poly_raw)) return f elseif s == :w f = Hecke.Globals.Zx() - @GC.preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.w+(i-1)*sizeof(Hecke.fmpz_poly_raw)) + GC.@preserve f H ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{Hecke.fmpz_poly_raw}), f, H.w+(i-1)*sizeof(Hecke.fmpz_poly_raw)) return f end end diff --git a/src/Misc/Matrix.jl b/src/Misc/Matrix.jl index 74d2c17f4b..e921eae7f8 100644 --- a/src/Misc/Matrix.jl +++ b/src/Misc/Matrix.jl @@ -325,7 +325,7 @@ end # Copy B into A at position (i, j) function _copy_matrix_into_matrix(A::ZZMatrix, i::Int, j::Int, B::ZZMatrix) - @GC.preserve A B begin + GC.@preserve A B begin for k in 0:nrows(B) - 1 for l in 0:ncols(B) - 1 d = mat_entry_ptr(B, 1 + k, 1 + l) @@ -337,7 +337,7 @@ function _copy_matrix_into_matrix(A::ZZMatrix, i::Int, j::Int, B::ZZMatrix) end function _copy_matrix_into_matrix(A::QQMatrix, i::Int, j::Int, B::QQMatrix) - @GC.preserve A B begin + GC.@preserve A B begin for k in 0:nrows(B) - 1 for l in 0:ncols(B) - 1 d = mat_entry_ptr(B, 1 + k, 1 + l) diff --git a/src/QuadForm/LineOrbits.jl b/src/QuadForm/LineOrbits.jl index 70249d0172..4a07c959cd 100644 --- a/src/QuadForm/LineOrbits.jl +++ b/src/QuadForm/LineOrbits.jl @@ -416,7 +416,7 @@ end function _normalize!(x::fpMatrix) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin piv = 0 local ell for j in 1:ncols(x) @@ -474,7 +474,7 @@ end function _normalize!(x::MatElem{FpFieldElem}) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin piv = 0 local ell for j in 1:ncols(x) @@ -533,7 +533,7 @@ end function _isequal(x::fqPolyRepMatrix, y::Vector{fqPolyRepFieldElem}) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:length(y) el = mat_entry_ptr(x, 1, i) b = ccall((:fq_nmod_equal, libflint), Cint, (Ref{fqPolyRepFieldElem}, Ptr{fqPolyRepFieldElem}, Ref{fqPolyRepField}), y[i], el, R) @@ -548,7 +548,7 @@ end function _muleq!(x::fqPolyRepMatrix, y::fqPolyRepFieldElem) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:nrows(x) for j in 1:ncols(x) el = mat_entry_ptr(x, i, j) @@ -561,7 +561,7 @@ end function _normalize!(x::fqPolyRepMatrix) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin piv = 0 local ell for j in 1:ncols(x) @@ -629,7 +629,7 @@ end function _isless(x::Vector{fqPolyRepFieldElem}, y::fqPolyRepMatrix) d = length(x) R = base_ring(y) - @GC.preserve y begin + GC.@preserve y begin for i in 1:d xi = x[i] el = mat_entry_ptr(y, 1, i) @@ -655,7 +655,7 @@ end function _isequal(x::FqPolyRepMatrix, y::Vector{FqPolyRepFieldElem}) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:length(y) el = mat_entry_ptr(x, 1, i) b = ccall((:fq_equal, libflint), Cint, @@ -671,7 +671,7 @@ end function _muleq!(x::FqPolyRepMatrix, y::FqPolyRepFieldElem) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:nrows(x) for j in 1:ncols(x) el = mat_entry_ptr(x, i, j) @@ -685,7 +685,7 @@ end function _normalize!(x::FqPolyRepMatrix) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin piv = 0 local ell for j in 1:ncols(x) @@ -758,7 +758,7 @@ end function _isless(x::Vector{FqPolyRepFieldElem}, y::FqPolyRepMatrix, tx::ZZRingElem = ZZRingElem(), ty::ZZRingElem = ZZRingElem()) d = length(x) R = base_ring(y) - @GC.preserve y begin + GC.@preserve y begin for i in 1:d xi = x[i] el = mat_entry_ptr(y, 1, i) @@ -791,7 +791,7 @@ end function _isequal(x::FqMatrix, y::Vector{FqFieldElem}) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:length(y) el = mat_entry_ptr(x, 1, i) b = ccall((:fq_default_equal, libflint), Cint, @@ -807,7 +807,7 @@ end function _muleq!(x::FqMatrix, y::FqFieldElem) R = base_ring(x) - @GC.preserve x begin + GC.@preserve x begin for i in 1:nrows(x) for j in 1:ncols(x) el = Nemo.fq_default_mat_entry_ptr(x, i, j) @@ -823,7 +823,7 @@ function _normalize!(x::FqMatrix) R = base_ring(x) piv = 0 local ell - @GC.preserve x begin + GC.@preserve x begin for j in 1:ncols(x) el = Nemo.fq_default_mat_entry_ptr(x, 1, j) b = ccall((:fq_default_is_zero, libflint), Cint, @@ -895,7 +895,7 @@ end function _isless(x::Vector{FqFieldElem}, y::FqMatrix, tx::ZZRingElem = ZZRingElem(), ty::ZZRingElem = ZZRingElem()) d = length(x) R = base_ring(y) - @GC.preserve y begin + GC.@preserve y begin for i in 1:d xi = x[i] el = Nemo.fq_default_mat_entry_ptr(y, 1, i)