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.
This commit is contained in:
Collin Funk committed 2026-10-03 15:40:46 -07:00
1 parent b64df1ef3d
commit a940d3c920
1 file changed
+5 -4
+5 -4
View File
@@ -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. */