[Asterisk-code-review] utils: Don't set or clear flags that don't need setting or c... (asterisk[13])
Friendly Automation
asteriskteam at digium.com
Wed Dec 12 13:11:20 CST 2018
Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/10793 )
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
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/main/utils.c b/main/utils.c
index c82ecb9..3d3750b 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -2813,9 +2813,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/10793
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I0e7fb507ac09b15e45e1ff8501ecfca67afa5217
Gerrit-Change-Number: 10793
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/81bf3bc4/attachment.html>
More information about the asterisk-code-review
mailing list