This and the subsequent patch add COUNTED_BY to two places it can be done without much extra work. The reordering is needed for Clang as mentioned in Bruno's Gnulib commit [1].
[1] https://github.com/coreutils/gnulib/commit/63897e4d37383f84eb4a6e55dd3b6cfd284219cf -- 8< -- * 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. */ -- 2.55.0
