[Asterisk-code-review] utils: Don't set or clear flags that don't need setting or c... (asterisk[13])
Sean Bright
asteriskteam at digium.com
Tue Dec 11 09:07:53 CST 2018
Sean Bright has uploaded this change for review. ( 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(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/93/10793/1
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: newchange
Gerrit-Change-Id: I0e7fb507ac09b15e45e1ff8501ecfca67afa5217
Gerrit-Change-Number: 10793
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181211/097efd1e/attachment.html>
More information about the asterisk-code-review
mailing list