Coverity complained about "Dereferencing "elt" before a null check", here, since just prior it is always dereferenced. Thus, it is an unnecessary test.
On a related note, is there any objection to my running update-copyright so that changes like these aren't polluted (and we're not prompted to update copyright year numbers) by copyright year updates? >From 5a850177bd4dff350ca98eec1b54cabafd815d57 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Thu, 12 Jan 2012 14:52:26 +0100 Subject: [PATCH] build: avoid warning from coverity about lbitset_elt_find * lib/lbitset.c (lbitset_elt_find): Remove unnecessary test of "elt", at a point where we know it is non-NULL, due to prior dereference. Copyright (C) 1987-1988, 1991-2012 Free Software Foundation, --- ChangeLog | 8 +++++++- lib/lbitset.c | 5 ++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 234df12..cf63ace 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-01-12 Jim Meyering <[email protected]> + + build: avoid warning from coverity about lbitset_elt_find + * lib/lbitset.c (lbitset_elt_find): Remove unnecessary test of "elt", + at a point where we know it is non-NULL, due to prior dereference. + 2012-01-06 Jim Meyering <[email protected]> build: avoid warnings about set-but-not-used variables diff --git a/lib/lbitset.c b/lib/lbitset.c index 35854f2..ef7e216 100644 --- a/lib/lbitset.c +++ b/lib/lbitset.c @@ -352,7 +351,7 @@ lbitset_elt_find (bitset bset, bitset_windex windex, /* ELT is the nearest to the one we want. If it's not the one we want, the one we want does not exist. */ - if (elt && (windex - elt->index) < LBITSET_ELT_WORDS) + if (windex - elt->index < LBITSET_ELT_WORDS) { bset->b.cindex = elt->index; bset->b.csize = LBITSET_ELT_WORDS; -- 1.7.9.rc0.25.gc7817
