* lib/gl_array_set.c (struct gl_set_impl): Mark the elements field as
counted_by count. Swap these fields (needed for clang).
(gl_array_nx_add): Increase set->count before writing into
set->elements.
+2026-05-03 Bruno Haible <bruno@clisp.org>
+
+ array-set: Use the counted_by attribute.
+ * lib/gl_array_set.c (struct gl_set_impl): Mark the elements field as
+ counted_by count. Swap these fields (needed for clang).
+ (gl_array_nx_add): Increase set->count before writing into
+ set->elements.
+
2026-05-03 Bruno Haible <bruno@clisp.org>
array-oset: Use the counted_by attribute.
struct gl_set_impl
{
struct gl_set_impl_base base;
+ size_t count;
/* An array of ALLOCATED elements, of which the first COUNT are used.
0 <= COUNT <= ALLOCATED. */
- const void **elements;
- size_t count;
+ const void **elements
+ _GL_ATTRIBUTE_COUNTED_BY (count);
size_t allocated;
};
if (count == set->allocated)
if (grow (set) < 0)
return -1;
- set->elements[count] = elt;
set->count = count + 1;
+ set->elements[count] = elt;
return 1;
}
}