Skip to contentSkip to conversation

lib/hashtable: remove superfluous check

PATCH New Heinrich Schuchardt 3 participants 3 messages Aug 20, 2020 – Oct 13, 2020 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/hashtable: remove superfluous check

We assign first_deleted = 0. There is no need to check its value without any further assignment in between.

---
indicated by cppcheck

---
 lib/hashtable.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/hashtable.c +1 -2
index 4a8c50b4b8..7c08f5c805 100644
@@ -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,

--
2.28.0

#2 lore raw

PATCH 1/1 lib/hashtable: remove superfluous check

In reply to Heinrich Schuchardt
Quoted 5 lines · Heinrich Schuchardt

We assign first_deleted = 0. There is no need to check its value without any further assignment in between.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201013/a4aa2b1c/attachment.sig>