Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] SIGSEGV under certain circumstances



Bart Schaefer wrote on Sun, Mar 05, 2017 at 13:45:13 -0800:
> [Somebody will have to explain to me why (mp += cl) makes sense, as that
> seems to be using a byte count to increment a (Cmatcher*), but it's done
> in several places.]

[ Context: this is about cfp_matcher_pats(). ]

Using a byte count to modify a pointer, in itself, is fine.  It's just
pointer arithmetic that makes the pointer 'mp' point at a different
element of the array 'ms'.

The part that confuses me is why the line says 'mp += cl' rather than
simply 'mp++'.  The inner loop executes precisely 'zl' times (because
the loop variable, 'tl', is initialized to 'al' and skips Meta bytes),
and 'mp' points into an array of size 'zl'.



Messages sorted by: Reverse Date, Date, Thread, Author