From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: schwab@suse.de, michael.albinus@gmx.de, emacs-devel@gnu.org
Subject: Re: emacs-26 c87d04e: Avoid aborts in 'md5'
Date: Wed, 28 Feb 2018 14:14:46 -0800 [thread overview]
Message-ID: <f9b035f3-fc34-08c2-bde1-732ed917401b@cs.ucla.edu> (raw)
In-Reply-To: <83woywyhri.fsf@gnu.org>
On 02/28/2018 12:35 PM, Eli Zaretskii wrote:
> That's not what I meant. I meant that as long as the code is frozen
> in its current form, nothing is gained by omitting 'else'.
I'm puzzled, since my patch inserts 'else', and yet you appear to be
objecting to it on the grounds that nothing is gained by omitting
'else'. I must be misunderstanding.
> we always check STRINGP before using SBYTES or SSDATA
Only if there's some possibility that the object is not a string. In
general, Emacs C functions very often use SBYTES or SDATA without first
checking STRINGP, because they are in contexts where the object must be
a string. For fun I just now looked at print.c, and none of the first
ten occurrences of SDATA or SSDATA were protected by STRINGP. And that's
OK, since none of these occurrences needed STRINGP.
For the case we're talking about, it's not possible for the object to be
a string, so although it might be appropriate to have an eassert
(STRINGP (...)) to verify that the impossible does not happen (to help
future-proof the code, say), we shouldn't need a runtime check in
production code.
next prev parent reply other threads:[~2018-02-28 22:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180227164448.16622.42058@vcs0.savannah.gnu.org>
[not found] ` <20180227164448.E4B45207B1@vcs0.savannah.gnu.org>
2018-02-28 8:30 ` emacs-26 c87d04e: Avoid aborts in 'md5' Michael Albinus
2018-02-28 8:49 ` Andreas Schwab
2018-02-28 9:09 ` Michael Albinus
2018-02-28 9:15 ` Andreas Schwab
2018-02-28 15:55 ` Eli Zaretskii
2018-02-28 16:32 ` Andreas Schwab
2018-02-28 17:24 ` Eli Zaretskii
2018-02-28 19:14 ` Paul Eggert
2018-02-28 20:35 ` Eli Zaretskii
2018-02-28 22:14 ` Paul Eggert [this message]
2018-03-01 3:39 ` Eli Zaretskii
2018-02-28 15:52 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f9b035f3-fc34-08c2-bde1-732ed917401b@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=michael.albinus@gmx.de \
--cc=schwab@suse.de \
/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.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).