Zebediah Figura (@zfigura) commented about tools/widl/typegen.c:
{ + unsigned int i; + int ret = FALSE; var_list_t *fields = type_struct_get_fields(type); const var_t *field; + + if (!visited_structs->structs) + { + visited_structs->count = 0; + visited_structs->capacity = 100; + visited_structs->structs = xmalloc(sizeof (type_t*) * visited_structs->capacity); + } + + if (visited_structs->count >= visited_structs->capacity) + { + visited_structs->capacity *= 2;
I'd just do "capacity = max(4, capacity * 2)"; then you don't need the explicit initialization. Or even just copy-paste the array_reserve() helper we use in other places in Wine. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3151#note_52796