Message ID | 20200820175745.10582-1-xypron.glpk@gmx.de |
---|---|
State | Accepted |
Commit | 34ca77c1e113d42a63f8ae21b41ec7f9f356c1de |
Delegated to: | Tom Rini |
Headers | show |
Series | [1/1] lib/hashtable: remove superfluous check | expand |
On Thu, 20 Aug 2020 at 11:57, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote: > > We assign first_deleted = 0. There is no need to check its value without > any further assignment in between. > > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > --- > indicated by cppcheck > --- > lib/hashtable.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Thu, Aug 20, 2020 at 07:57:45PM +0200, Heinrich Schuchardt wrote: > We assign first_deleted = 0. There is no need to check its value without > any further assignment in between. > > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot/master, thanks!
diff --git a/lib/hashtable.c b/lib/hashtable.c index 4a8c50b4b8..7c08f5c805 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -324,8 +324,7 @@ int hsearch_r(struct env_entry item, enum env_action action, */ unsigned hval2; - if (htab->table[idx].used == USED_DELETED - && !first_deleted) + if (htab->table[idx].used == USED_DELETED) first_deleted = idx; ret = _compare_and_overwrite_entry(item, action, retval, htab,
We assign first_deleted = 0. There is no need to check its value without any further assignment in between. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> --- indicated by cppcheck --- lib/hashtable.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.28.0