Merge "utils: Don't set or clear flags that don't need setting or clearing" into 16

This commit is contained in:
Joshua C. Colp 2018-12-13 08:23:42 -06:00 committed by Gerrit Code Review
commit 84d693a689
1 changed files with 8 additions and 0 deletions

View File

@ -2730,9 +2730,17 @@ int __ast_fd_set_flags(int fd, int flags, enum ast_fd_flag_operation op,
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: