There are known bugs in src/kwset.c, so I'm reading the code trying to better understand what it does and how it does it. Namely, the fix Julian proposed for review a few days ago.
I notice this file consistently uses 0 in place of NULL. It's the ultimate in C portability, but I think it makes this code harder to read, especially since the structures whose pointer fields are assigned to 0 are not defined anywhere near where they are used. Also, some structure pointers are hidden behind typedef aliases, which makes it hard to even know they are pointers. The rest of GNU grep's source code uses NULL all over the place. Would anyone be opposed to a 's/0/NULL/g' switch for these pointer values? Are there any portability issues that are not already triggered by the rest of the code?