|
From: | Paul Eggert |
Subject: | Re: emacs-26 c87d04e: Avoid aborts in 'md5' |
Date: | Wed, 28 Feb 2018 14:14:46 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |