From: Andreas Ericsson <ae@op5.se>
To: Junio C Hamano <gitster@pobox.com>
Cc: Brandon Casey <casey@nrlssc.navy.mil>,
Arjen Laarhoven <arjen@yaph.org>,
Mike Ralphson <mike.ralphson@gmail.com>,
Johannes Sixt <j.sixt@viscovery.net>, Jeff King <peff@peff.net>,
Boyd Lynn Gerber <gerberb@zenez.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 2/4] diff.c: associate a flag with each pattern and use it for compiling regex
Date: Thu, 18 Sep 2008 10:06:28 +0200 [thread overview]
Message-ID: <48D20C04.1020703@op5.se> (raw)
In-Reply-To: <7vod2myljk.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
> Andreas Ericsson <ae@op5.se> 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@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
next prev parent reply other threads:[~2008-09-18 8:07 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-07 18:45 [RFC/PATCH] Use compatibility regex library for OSX/Darwin Arjen Laarhoven
2008-09-10 8:03 ` Mike Ralphson
2008-09-10 9:49 ` Johannes Sixt
2008-09-10 10:03 ` Arjen Laarhoven
2008-09-10 11:53 ` Mike Ralphson
2008-09-11 7:59 ` Mike Ralphson
2008-09-11 8:14 ` [PATCH] Use compatibility regex library also on AIX Johannes Sixt
2008-09-11 8:25 ` Arjen Laarhoven
2008-09-11 8:31 ` Mike Ralphson
2008-09-11 12:12 ` Jeff King
2008-09-11 8:27 ` Junio C Hamano
2008-09-16 17:49 ` [RFC/PATCH] Use compatibility regex library for OSX/Darwin Brandon Casey
2008-09-16 18:09 ` Junio C Hamano
2008-09-18 0:08 ` [PATCH 1/4] diff.c: return pattern entry pointer rather than just the hunk header pattern Brandon Casey
2008-09-18 0:10 ` [PATCH 2/4] diff.c: associate a flag with each pattern and use it for compiling regex Brandon Casey
2008-09-18 4:14 ` Junio C Hamano
2008-09-18 6:41 ` Andreas Ericsson
2008-09-18 7:12 ` Junio C Hamano
2008-09-18 8:06 ` Andreas Ericsson [this message]
2008-09-18 8:35 ` Junio C Hamano
2008-09-18 0:10 ` [PATCH 3/4] diff.*.xfuncname which uses "extended" regex's for hunk header selection Brandon Casey
[not found] ` <7vd4j212gb.fsf@gitster.siamese.dyndns.org>
2008-09-19 18:14 ` Brandon Casey
2008-09-18 0:21 ` [PATCH 4/4] diff.c: convert builtin funcname patterns to extended regular expressions Brandon Casey
2008-09-18 0:33 ` [PATCH 4/4 v2] " Brandon Casey
2008-09-18 7:18 ` [PATCH 4/4] " Andreas Ericsson
2008-09-18 7:31 ` Junio C Hamano
2008-09-18 8:39 ` Johan Herland
2008-09-18 10:15 ` Gustaf Hendeby
2008-09-18 10:53 ` Jonathan del Strother
2008-09-18 15:48 ` Brandon Casey
2008-09-16 19:08 ` [RFC/PATCH] Use compatibility regex library for OSX/Darwin Jeff King
2008-09-16 23:25 ` Boyd Lynn Gerber
2008-09-16 23:32 ` Jeff King
2008-09-16 23:42 ` Boyd Lynn Gerber
2008-09-16 23:46 ` Jeff King
2008-09-17 0:10 ` Boyd Lynn Gerber
2008-09-17 0:13 ` Brandon Casey
2008-09-17 0:13 ` Boyd Lynn Gerber
2008-09-17 0:20 ` Brandon Casey
2008-09-17 0:38 ` Boyd Lynn Gerber
2008-09-17 0:58 ` Brandon Casey
2008-09-17 1:02 ` Boyd Lynn Gerber
2008-09-17 1:25 ` Brandon Casey
2008-09-17 14:48 ` Boyd Lynn Gerber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48D20C04.1020703@op5.se \
--to=ae@op5.se \
--cc=arjen@yaph.org \
--cc=casey@nrlssc.navy.mil \
--cc=gerberb@zenez.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=mike.ralphson@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).