* PATCH: remove dead code flagged by coverity
@ 2018-04-05 12:09 ` Oliver Kiddle
2018-04-05 13:29 ` Peter Stephenson
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Kiddle @ 2018-04-05 12:09 UTC (permalink / raw)
To: Zsh workers
Coverity correctly flags these two lines of code as being dead. This was
added in 42332. Unless the intention was instead for zstrtoul_underscore() to
also handle base#number syntax then this can go because it only looks
for binary, octal, decimal and hex.
Oliver
diff --git a/Src/utils.c b/Src/utils.c
index 3587c3622..c544b81bf 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2486,9 +2486,7 @@ zstrtoul_underscore(const char *s, zulong *retval)
base = 2, s++;
else
base = isset(OCTALZEROES) ? 8 : 10;
- if (base < 2 || base > 36) {
- return 0;
- } else if (base <= 10) {
+ if (base <= 10) {
for (; (*s >= '0' && *s < ('0' + base)) ||
*s == '_'; s++) {
if (*s == '_')
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: remove dead code flagged by coverity
2018-04-05 12:09 ` PATCH: remove dead code flagged by coverity Oliver Kiddle
@ 2018-04-05 13:29 ` Peter Stephenson
0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2018-04-05 13:29 UTC (permalink / raw)
To: Zsh workers
On Thu, 05 Apr 2018 14:09:06 +0200
Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> Coverity correctly flags these two lines of code as being dead. This
> was added in 42332. Unless the intention was instead for
> zstrtoul_underscore() to also handle base#number syntax then this can
> go because it only looks for binary, octal, decimal and hex.
The only use of the function is to ensure we can get a maximum length
unsigned integer. The presence of base# would cause that case to
drop through to a mathevali(), which is what this code always
used before.
Logically, there is a gap as this doesn't handle 16#ffffffffffffffff,
I suppose.
pws
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-05 13:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20180405121007epcas4p383511f24b9e1aedbdee704db42382368@epcas4p3.samsung.com>
2018-04-05 12:09 ` PATCH: remove dead code flagged by coverity Oliver Kiddle
2018-04-05 13:29 ` Peter Stephenson
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).