Hmm it is misleading to call this variable matches, as it is sized by the caller. As I see its always sized 1 element.

Anyway we should either pass a single element or also pass the size of the array.