Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: VARARR in pattern code
On Mon, 08 Sep 2014 15:10:37 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> While looking at the problem with repeated *'s, I notice that inside the
> pattern code for closures --- *'s, #'s and ##'s --- there's a VARARR.
>
> /*
> * Array to record the start of characters for
> * backtracking.
> */
> VARARR(char, charstart, patinend-patinput);
>
> If you're interested, that was added to fix a very similar problem with
> pathological backtracking involving negated matches with "~" or "^".
Hmm... I think I tell a lie. I think this one was added for multibyte
mode --- when backtracking, the only way I know of to guarantee you're
going back a whole character is either to scan the entire string from
the start, or remember, and this does the latter.
There may be some more efficient way of backtracking through multibyte
strings known to cognoscenti.
The allocation I original thought this one was is actually a zshcalloc()
around line 2841 (post patch), so not subject to VARARR(), and as it's
only used by the exclusion code it doesn't slow down standard glob
matches.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author