Hi,
Il 01/07/22 23:24, Francisco Casas ha scritto:
static const struct hlsl_struct_field *get_struct_field(const struct hlsl_struct_field *fields,
size_t count, const char *name)
size_t count, const char *name, unsigned int *field_indx)
{ size_t i;
for (i = 0; i < count; ++i) { if (!strcmp(fields[i].name, name))
{
if (field_indx)
*field_indx = i; return &fields[i];
} } return NULL;
}
It's not a big deal, but this interface looks more complicated than it should for such a simple thing. Maybe we could just return the field index and the caller can dereference the array if needed?
Giovanni.