From a940d3c9209cd4bf54eb27a686aaee97a3fc9b77 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Fri, 2 Oct 2026 23:29:30 -0700 Subject: [PATCH] maint: factor: use the COUNTED_BY attribute for the list of factors * src/factor.c (struct mp_factors): Use COUNTED_BY on the f member. (mp_no_factors): Use 0 instead of NULL when initializing the return value. --- src/factor.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/factor.c b/src/factor.c index 615cf6ada..ac9fe1b86 100644 --- a/src/factor.c +++ b/src/factor.c @@ -292,11 +292,12 @@ struct mp_factor /* Prime factors of an mpz_t. */ struct mp_factors { - /* A vector of distinct prime factors, a count of the factors, - and the number of allocated slots in the vector. */ - struct mp_factor *f; idx_t nfactors; idx_t nalloc; + + /* A vector of distinct prime factors, a count of the factors, + and the number of allocated slots in the vector. */ + struct mp_factor *f COUNTED_BY (nalloc); }; static void factor (struct factors *, mp_limb_t, mp_limb_t); @@ -664,7 +665,7 @@ static struct mp_factors mp_factor (mpz_t); static struct mp_factors mp_no_factors (void) { - return (struct mp_factors) {NULL,}; + return (struct mp_factors) {0}; } /* Free storage allocated for FACTORS, making it uninitialized. */