From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [BUG] SIGSEGV under certain circumstances
Date: Sun, 5 Mar 2017 22:41:00 +0000 [thread overview]
Message-ID: <20170305224100.GA18432@fujitsu.shahaf.local2> (raw)
In-Reply-To: <170305134513.ZM26364@torch.brasslantern.com>
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'.
next prev parent reply other threads:[~2017-03-05 22:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-01 15:38 Chi-Hsuan Yen
2017-03-04 23:11 ` Bart Schaefer
2017-03-05 12:55 ` Chi-Hsuan Yen
2017-03-05 13:09 ` Chi-Hsuan Yen
2017-03-05 16:00 ` Bart Schaefer
2017-03-05 16:17 ` Peter Stephenson
2017-03-05 18:42 ` Bart Schaefer
2017-03-05 18:52 ` Peter Stephenson
2017-03-05 21:45 ` Bart Schaefer
2017-03-05 22:31 ` Bart Schaefer
2017-03-05 22:41 ` Daniel Shahaf [this message]
2017-03-05 22:51 ` Bart Schaefer
2017-03-05 23:07 ` Bart Schaefer
2017-03-06 0:23 ` Bart Schaefer
2017-03-06 9:47 ` Peter Stephenson
2017-03-06 17:10 ` Bart Schaefer
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=20170305224100.GA18432@fujitsu.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).