Factorize patternProperties pointer collector

It will also be used for "properties".

Signed-off-by: Francis Galiegue <fgaliegue@gmail.com>