Re: new module 'regex-quote'

2010-09-29 Thread Reuben Thomas
On 25 September 2010 11:58, Bruno Haible wrote: > It is a nice dream, but you have to know that the way for some feature > into glibc is hard. Either you have to convince Ulrich Drepper, or you > have to convince the Austin group. Making a fork in some GNU project, > such as gnulib, is _not_ suffi

Re: new module 'regex-quote'

2010-09-29 Thread Reuben Thomas
On 25 September 2010 12:01, Bruno Haible wrote: >> 2010-09-18  Bruno Haible   >> >>       New module 'regex-quote'. >>       * lib/regex-quote.h: New file. >>       * lib/regex-quote.c: New file. >>       * modules/regex-quote: New file. >>

Re: new module 'regex-quote'

2010-09-25 Thread Bruno Haible
> 2010-09-18 Bruno Haible > > New module 'regex-quote'. > * lib/regex-quote.h: New file. > * lib/regex-quote.c: New file. > * modules/regex-quote: New file. > Suggested by Reuben Thomas . I pushed this module. No one except Reu

Re: new module 'regex-quote'

2010-09-25 Thread Bruno Haible
Hi Reuben, > > But the fact is that POSIX standardizes the regex API, and therefore there > > is a border between "in glibc" and "outside glibc". Functionality in glibc > > is available at no cost; functionality outside glibc requires additional > > link options and increased startup time or a 50K

Re: new module 'regex-quote'

2010-09-21 Thread Reuben Thomas
On 21 September 2010 01:07, Bruno Haible wrote: > Reuben, > >> Heh. My point precisely: 3 functions and 50 lines versus 1 flag and 5 >> lines (RE_PLAIN) to solve the same problem > > I agree that if we had the opportunity to invent regex APIs from scratch > now, all 4 syntaxes (literals, wildcards

Re: new module 'regex-quote'

2010-09-20 Thread Bruno Haible
Reuben, > Heh. My point precisely: 3 functions and 50 lines versus 1 flag and 5 > lines (RE_PLAIN) to solve the same problem I agree that if we had the opportunity to invent regex APIs from scratch now, all 4 syntaxes (literals, wildcards, basic regular expression, extended regular expression) wo

Re: new module 'regex-quote'

2010-09-20 Thread Reuben Thomas
On 20 September 2010 19:21, Bruno Haible wrote: > The drawback of a large API is that it's harder to keep in memory. Heh. My point precisely: 3 functions and 50 lines versus 1 flag and 5 lines (RE_PLAIN) to solve the same problem (although my solution does not help with the anchored variant, but

Re: new module 'regex-quote'

2010-09-20 Thread Bruce Korb
> The drawback of a large API is that it's harder to keep in memory. "keep in mind". "memory" as in "computer memory" is too cheap to be any consideration at all. :)

Re: new module 'regex-quote'

2010-09-20 Thread Bruno Haible
Eric, > rather than adding a new flag bit, what about providing > regex_quote_anchored as a wrapper that provides the anchors, so that the > end user can choose between the one-liners of regex_quote or > regex_quote_anchored? It's the same argumentation: It's already easy enough to do this in

Re: new module 'regex-quote'

2010-09-20 Thread Eric Blake
On 09/20/2010 10:21 AM, Bruno Haible wrote: Hi Eric, /* regex_quote converts a literal string to a regular expression that will look for this literal string. cflags can be 0 or REG_EXTENDED. If it is 0, the result is a Basic Regular Expression (BRE)

Re: new module 'regex-quote'

2010-09-20 Thread Bruno Haible
Hi Eric, > > /* regex_quote converts a literal string to a regular expression that will > > look for this literal string. > > cflags can be 0 or REG_EXTENDED. > > If it is 0, the result is a Basic Regular Expression (BRE) > > > >

Re: new module 'regex-quote'

2010-09-20 Thread Reuben Thomas
On 18 September 2010 23:53, Reuben Thomas wrote: > Great, thanks, though at 3 new functions and about 50 lines of code it > does illustrate why I prefer RE_PLAIN. > > Nonetheless, if you put this in gnulib I'd probably use it rather than > RE_PLAIN, just because it's there. On second thoughts, --

Re: new module 'regex-quote'

2010-09-20 Thread Eric Blake
On 09/18/2010 04:05 PM, Bruno Haible wrote: /* regex_quote converts a literal string to a regular expression that will look for this literal string. cflags can be 0 or REG_EXTENDED. If it is 0, the result is a Basic Regular Expression (BRE)

Re: new module 'regex-quote'

2010-09-18 Thread Reuben Thomas
On 18 September 2010 23:05, Bruno Haible wrote: > Reuben Thomas wrote: >> > it's a function which transforms a string to a string. >> > I'm sure this function has been implemented many times already. The one I >> > wrote is called 'regexp-quote' [1][2]. >> >> Great, can we have it in gnulib? Does

Re: new module 'regex-quote'

2010-09-18 Thread Bruno Haible
t work for all syntaxes? It needs a flag to distinguish the syntax, since BRE and ERE have different syntaxes. Here's a suggested module: 2010-09-18 Bruno Haible New module 'regex-quote'. * lib/regex-quote.h: New file. * lib/regex-quote.c: New file. *