[Asterisk-code-review] utils: Don't set or clear flags that don't need setting or c... (asterisk[master])
Joshua C. Colp
asteriskteam at digium.com
Wed Dec 12 13:12:20 CST 2018
Joshua C. Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/10795 )
Change subject: utils: Don't set or clear flags that don't need setting or clearing
......................................................................
utils: Don't set or clear flags that don't need setting or clearing
Change-Id: I0e7fb507ac09b15e45e1ff8501ecfca67afa5217
---
M main/utils.c
1 file changed, 8 insertions(+), 0 deletions(-)
Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
Joshua C. Colp: Looks good to me, but someone else must approve; Approved for Submit
George Joseph: Looks good to me, approved
diff --git a/main/utils.c b/main/utils.c
index e0b8a6e..b45e7b5 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -2730,9 +2730,17 @@
switch (op) {
case AST_FD_FLAG_SET:
+ if ((f & flags) == flags) {
+ /* There is nothing to set */
+ return 0;
+ }
f |= flags;
break;
case AST_FD_FLAG_CLEAR:
+ if (!(f & flags)) {
+ /* There is nothing to clear */
+ return 0;
+ }
f &= ~flags;
break;
default:
--
To view, visit https://gerrit.asterisk.org/10795
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0e7fb507ac09b15e45e1ff8501ecfca67afa5217
Gerrit-Change-Number: 10795
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua C. Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181212/4776f4ea/attachment.html>
More information about the asterisk-code-review
mailing list