Page MenuHome GnuPG

Poor style: Redundant condition * 5
Open, WishlistPublic

Description

Some minor tidyups look possible:

[gnupg-2.2.5/dirmngr/workqueue.c:155]: (style) Redundant condition: item->need_network. '!item->need_network || (item->need_network && with_network)' is equivalent to '!item->need_network || with_network'

[gnupg-2.2.5/g10/card-util.c:2071]: (style) Redundant condition: cmds[i].admin_only. '!cmds[i].admin_only || (cmds[i].admin_only && allow_admin)' is equivalent to '!cmds[i].admin_only || allow_admin'

[gnupg-2.2.5/g10/keyedit.c:3367]: (style) Redundant condition: flag. '!flag || (flag && node->flag&flag)' is equivalent to '!flag || node->flag&flag'

[gnupg-2.2.5/g10/sign.c:982]: (style) Redundant condition: smartcard. '!smartcard || (smartcard && hint.digest_length==20)' is equivalent to '!smartcard || hint.digest_length==20'

[gnupg-2.2.5/g10/tofu.c:276]: (style) Redundant condition: !only_batch. 'only_batch || (!only_batch && dbs->in_transaction==1)' is equivalent to 'only_batch || dbs->in_transaction==1'

Event Timeline

werner triaged this task as Wishlist priority.Feb 23 2018, 11:03 AM
werner added a subscriber: werner.

I will eventually look at this. However, sometimes the reason for such conditions can be documentation purposes. Thanks for pointing out.