Re: [PATCH 2/4] diff.c: associate a flag with each pattern and use it for compiling regex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano wrote:
Andreas Ericsson <ae@xxxxxx> writes:

Junio C Hamano wrote:
...
 static struct funcname_pattern {
 	char *name;
 	char *pattern;
+	int cflags;
What does "C" stand for?
"compile". It's the same name as regcomp(3) uses for the flags being
used to compile the regular expression. The full mnemonic name would
be regex_compile_flag, which is a bit unwieldy. Perhaps regcomp_flags
would be a good compromise?

Ah, I see.

When I saw that new field for the first time, I didn't think it will be
used to store the bare flag values regcomp/regexec library would accept
directly (I expected we would see #define or enum to tweak our own set of
features, not limiting ourselves EXTENDED/ICASE etc. that regcomp/regexec
library supports)

IOW, it just did not click for me to look at "man 3 regcomp" which says:

    int regcomp(regex_t *preg, const char *regex, int cflags);

So unless others feel that we might get a better layering separation by
not storing REG_EXTENDED and stuff directly in that field (which was my
initial reaction without looking at 4/4 which does store REG_EXTENDED
there without our own enums), cflag is perfectly a good name here.


I think it makes perfect sense to use whatever we pass when compiling
the regex. I wouldn't dare try to hack up something that pre-mangles
a regular expression and assume it gets it right everywhere anyway, so
I'm quite happy with leaving it all to regcomp(3) and friends.


Thanks --- I am bit under the weather and not thinking quite straight.


Mix 2cc's of 7yo Havana Club into a large cup of tea. Drink one such
cup every hour and eat a fresh fruit with it. I haven't been ill a day
in my life since I came up with that most excellent cure for absolutely
everything. If nothing else, it makes it a bit less boring to be ill.

--
Andreas Ericsson                   andreas.ericsson@xxxxxx
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux