On 05-07-22 06:38, Henri Verbeet wrote:
On Tue, 5 Jul 2022 at 11:26, Giovanni Mascellani gmascellani@codeweavers.com wrote:
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?
Right, you should only ever need one or the other. (I.e., &fields[i] - fields == i)
I can do it but I would have to return a magic value (I am thinking on -1) when the field is not found, given the current uses of get_struct_field().
Alternatively, I can change the return type to bool and return false when the field is not found. This seems better.
I can also split the function into a get_struct_field() and a has_struct_field(), but I don't like the idea.