git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Andreas Ericsson <ae@op5.se>
Date
Sep 18, 2008, 08:06 UTC
Message-ID
<48D20C04.1020703@op5.se>
In-Reply-To
<7vod2myljk.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 31 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 19 of 44 in “Use compatibility regex library for OSX/Darwin”
  1. Use compatibility regex library for OSX/DarwinArjen Laarhoven, Sep 7, 2008
  2. Mike RalphsonSep 10, 2008
  3. Johannes SixtSep 10, 2008
  4. Arjen LaarhovenSep 10, 2008
  5. Mike RalphsonSep 10, 2008
  6. Mike RalphsonSep 11, 2008
  7. Use compatibility regex library also on AIXJohannes Sixt, Sep 11, 2008
  8. Arjen LaarhovenSep 11, 2008
  9. Mike RalphsonSep 11, 2008
  10. Jeff KingSep 11, 2008
  11. Junio C HamanoSep 11, 2008
  12. Brandon CaseySep 16, 2008
  13. Junio C HamanoSep 16, 2008
  14. 1/4 diff.c: return pattern entry pointer rather than just the hunk header patternBrandon Casey, Sep 18, 2008
  15. 2/4 diff.c: associate a flag with each pattern and use it for compiling regexBrandon Casey, Sep 18, 2008
  16. Junio C HamanoSep 18, 2008
  17. Andreas EricssonSep 18, 2008
  18. Junio C HamanoSep 18, 2008
  19. Andreas EricssonSep 18, 2008
  20. Junio C HamanoSep 18, 2008
  21. 3/4 diff.*.xfuncname which uses "extended" regex's for hunk header selectionBrandon Casey, Sep 18, 2008
  22. 4/4 diff.c: convert builtin funcname patterns to extended regular expressionsBrandon Casey, Sep 18, 2008
  23. 4/4 diff.c: convert builtin funcname patterns to extended regular expressionsBrandon Casey, Sep 18, 2008
  24. Andreas EricssonSep 18, 2008
  25. Junio C HamanoSep 18, 2008
  26. Johan HerlandSep 18, 2008
  27. Gustaf HendebySep 18, 2008
  28. Jonathan del StrotherSep 18, 2008
  29. Brandon CaseySep 18, 2008
  30. Jeff KingSep 16, 2008
  31. Boyd Lynn GerberSep 16, 2008
  32. Jeff KingSep 16, 2008
  33. Boyd Lynn GerberSep 16, 2008
  34. Jeff KingSep 16, 2008
  35. Boyd Lynn GerberSep 17, 2008
  36. Brandon CaseySep 17, 2008
  37. Boyd Lynn GerberSep 17, 2008
  38. Brandon CaseySep 17, 2008
  39. Boyd Lynn GerberSep 17, 2008
  40. Brandon CaseySep 17, 2008
  41. Boyd Lynn GerberSep 17, 2008
  42. Brandon CaseySep 17, 2008
  43. Boyd Lynn GerberSep 17, 2008
  44. Brandon CaseySep 19, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.