* lib/gl_array_map.c (struct gl_map_impl): Mark the pairs field as
counted_by count. Swap these fields (needed for clang).
(gl_array_nx_getput): Increase map->count before writing into
map->pairs.
+2026-05-03 Bruno Haible <bruno@clisp.org>
+
+ array-map: Use the counted_by attribute.
+ * lib/gl_array_map.c (struct gl_map_impl): Mark the pairs field as
+ counted_by count. Swap these fields (needed for clang).
+ (gl_array_nx_getput): Increase map->count before writing into
+ map->pairs.
+
2026-05-03 Bruno Haible <bruno@clisp.org>
array-list: Use the counted_by attribute.
struct gl_map_impl
{
struct gl_map_impl_base base;
+ size_t count;
/* An array of ALLOCATED pairs, of which the first COUNT are used.
0 <= COUNT <= ALLOCATED. */
- struct pair *pairs;
- size_t count;
+ struct pair *pairs
+ _GL_ATTRIBUTE_COUNTED_BY (count);
size_t allocated;
};
if (grow (map) < 0)
return -1;
struct pair *pairs = map->pairs;
+ map->count = count + 1;
pairs[count].key = key;
pairs[count].value = value;
- map->count = count + 1;
return 1;
}
}