regcomp.c: Extract code into a function