From 1f2bf29b0fddce7a5f522b78b036cf8d396c6780 Mon Sep 17 00:00:00 2001 From: Ahmed <43099566+ahmed-irfan@users.noreply.github.com> Date: Mon, 16 Dec 2024 18:05:31 -0800 Subject: [PATCH] more clang fixes --- src/polyxx/polynomial.cpp | 2 ++ src/polyxx/upolynomial.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/polyxx/polynomial.cpp b/src/polyxx/polynomial.cpp index 0615b6e6..a71c51f7 100644 --- a/src/polyxx/polynomial.cpp +++ b/src/polyxx/polynomial.cpp @@ -386,6 +386,7 @@ namespace poly { for (std::size_t i = 0; i < size; ++i) { res.emplace_back(tmp[i]); } + tmp.clear(); return res; } @@ -400,6 +401,7 @@ namespace poly { 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..9e18c1fd 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 = nullptr; 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; }