
Hi Jeroen,
On 01.07.13 22:12, Jeroen Hofstee wrote:
Hello Andreas,
On 07/01/2013 08:45 PM, Jeroen Hofstee wrote:
Hello Andreas,
On 06/30/2013 01:15 PM, Andreas Bießmann wrote:
BSD (like OS X) variants of regex.h do not declare REG_NOERROR, add a simple define for them.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
+#ifndef REG_NOERROR +/* BSD regex.h do not expose REG_NOERROR */ +# define REG_NOERROR 0 +#endif
I think a neater solutions is to actually remove the REG_NOERROR. From man regexec, GNU 2011-09-27: "regexec() returns zero for a successful match or REG_NOMATCH for failure.". Opengroup specs will mention the same. REG_NOERROR is not mentioned at all.
e.g.:
if (err) { regex_report_error(&item->regex, err, "match", item->name); break; }
should do the job in a portable way (and reads a bit better, as well). But this is only a cosmetic comment, the patch by itself should do the job.
Just realized this is more then cosmetic. Also GNU will not have REG_NOERROR defined since it is an enum, so it will always take the #ifndef REG_NOERROR road, which boils down to !! 0.
So this needs a new version instead of hiding how this works.
you are right, v2 is on the way ...
p.s. Simon, Andreas sorry for spamming, selected the wrong email...
Ouch, sorry! Just realized that I took the wrong mail too.
Best regards
Andreas Bießmann