diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24676ebc..3e9751ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: run: | mkdir -p build cd build - cmake -DCMAKE_BUILD_TYPE=${{ matrix.mode }} .. + ${{ matrix.env }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.mode }} .. make - name: Check diff --git a/src/polyxx/polynomial.cpp b/src/polyxx/polynomial.cpp index aa0891ad..a71c51f7 100644 --- a/src/polyxx/polynomial.cpp +++ b/src/polyxx/polynomial.cpp @@ -377,29 +377,31 @@ namespace poly { std::vector psc(const Polynomial& p, const Polynomial& q) { std::size_t size = std::min(degree(p), degree(q)) + 1; - lp_polynomial_t* tmp[size]; + std::vector tmp; for (std::size_t i = 0; i < size; ++i) { - tmp[i] = lp_polynomial_new(detail::context(p, q)); + tmp.push_back(lp_polynomial_new(detail::context(p, q))); } - lp_polynomial_psc(tmp, p.get_internal(), q.get_internal()); + lp_polynomial_psc(tmp.data(), p.get_internal(), q.get_internal()); std::vector res; for (std::size_t i = 0; i < size; ++i) { res.emplace_back(tmp[i]); } + tmp.clear(); return res; } std::vector subres(const Polynomial& p, const Polynomial& q) { std::size_t size = std::min(degree(p), degree(q)) + 1; - lp_polynomial_t* tmp[size]; + std::vector tmp; for (std::size_t i = 0; i < size; ++i) { - tmp[i] = lp_polynomial_new(detail::context(p, q)); + tmp.push_back(lp_polynomial_new(detail::context(p, q))); } - lp_polynomial_subres(tmp, p.get_internal(), q.get_internal()); + lp_polynomial_subres(tmp.data(), p.get_internal(), q.get_internal()); std::vector res; for (std::size_t i = 0; i < size; ++i) { res.emplace_back(tmp[i]); } + tmp.clear(); return res; } diff --git a/src/polyxx/upolynomial.cpp b/src/polyxx/upolynomial.cpp index 90c21c1f..935b51a3 100644 --- a/src/polyxx/upolynomial.cpp +++ b/src/polyxx/upolynomial.cpp @@ -100,16 +100,19 @@ namespace poly { } std::vector coefficients(const UPolynomial& p) { - lp_integer_t coeffs[degree(p) + 1]; + std::vector coeffs; + lp_integer_t tmp; for (std::size_t i = 0; i < degree(p) + 1; ++i) { - lp_integer_construct_from_int(lp_Z, &coeffs[i], 0); + lp_integer_construct_from_int(lp_Z, &tmp, 0); + coeffs.push_back(tmp); } - lp_upolynomial_unpack(p.get_internal(), coeffs); + lp_upolynomial_unpack(p.get_internal(), coeffs.data()); std::vector res; for (std::size_t i = 0; i < degree(p) + 1; ++i) { res.emplace_back(&coeffs[i]); lp_integer_destruct(&coeffs[i]); } + coeffs.clear(); return res; }