*: Use short version of bool expressions

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
Donatas Abraitis 2020-03-04 15:04:23 +02:00
parent 17fe9bb6e5
commit a8f58eb6a5
8 changed files with 14 additions and 14 deletions

View File

@ -383,7 +383,7 @@ int bfdd_bfd_sessions_single_hop_administrative_down_modify(
bs = nb_running_get_entry(dnode, NULL, true); bs = nb_running_get_entry(dnode, NULL, true);
if (shutdown == false) { if (!shutdown) {
if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN)) if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN))
return NB_OK; return NB_OK;
@ -447,7 +447,7 @@ int bfdd_bfd_sessions_single_hop_echo_mode_modify(enum nb_event event,
bs = nb_running_get_entry(dnode, NULL, true); bs = nb_running_get_entry(dnode, NULL, true);
if (echo == false) { if (!echo) {
if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_ECHO)) if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_ECHO))
return NB_OK; return NB_OK;

View File

@ -500,7 +500,7 @@ static void _display_peers_brief(struct vty *vty, const char *vrfname, bool use_
bvt.vrfname = vrfname; bvt.vrfname = vrfname;
if (use_json == false) { if (!use_json) {
bvt.vty = vty; bvt.vty = vty;
vty_out(vty, "Session count: %lu\n", bfd_get_session_count()); vty_out(vty, "Session count: %lu\n", bfd_get_session_count());

View File

@ -3148,7 +3148,7 @@ int bgp_handle_socket(struct bgp *bgp, struct vrf *vrf, vrf_id_t old_vrf_id,
/* /*
* suppress vrf socket * suppress vrf socket
*/ */
if (create == false) { if (!create) {
bgp_close_vrf_socket(bgp); bgp_close_vrf_socket(bgp);
return 0; return 0;
} }

View File

@ -996,7 +996,7 @@ static int nb_transaction_process(enum nb_event event,
* Only try to release resources that were allocated * Only try to release resources that were allocated
* successfully. * successfully.
*/ */
if (event == NB_EV_ABORT && change->prepare_ok == false) if (event == NB_EV_ABORT && !change->prepare_ok)
break; break;
/* Call the appropriate callback. */ /* Call the appropriate callback. */

View File

@ -2447,7 +2447,7 @@ route_map_result_t route_map_apply(struct route_map *map,
} }
for (; index; index = index->next) { for (; index; index = index->next) {
if (skip_match_clause == false) { if (!skip_match_clause) {
/* Apply this index. */ /* Apply this index. */
match_ret = route_map_apply_match(&index->match_list, match_ret = route_map_apply_match(&index->match_list,
prefix, type, object); prefix, type, object);

View File

@ -202,7 +202,7 @@ void pbr_map_reason_string(unsigned int reason, char *buf, int size)
void pbr_map_final_interface_deletion(struct pbr_map *pbrm, void pbr_map_final_interface_deletion(struct pbr_map *pbrm,
struct pbr_map_interface *pmi) struct pbr_map_interface *pmi)
{ {
if (pmi->delete == true && !pbr_map_interface_is_installed(pbrm, pmi)) { if (pmi->delete && !pbr_map_interface_is_installed(pbrm, pmi)) {
listnode_delete(pbrm->incoming, pmi); listnode_delete(pbrm->incoming, pmi);
pmi->pbrm = NULL; pmi->pbrm = NULL;

View File

@ -953,7 +953,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
thread_add_timer_msec( thread_add_timer_msec(
master, vrrp_master_down_timer_expire, r, master, vrrp_master_down_timer_expire, r,
r->skew_time * CS2MS, &r->t_master_down_timer); r->skew_time * CS2MS, &r->t_master_down_timer);
} else if (r->vr->preempt_mode == false } else if (!r->vr->preempt_mode
|| pkt->hdr.priority >= r->priority) { || pkt->hdr.priority >= r->priority) {
if (r->vr->version == 3) { if (r->vr->version == 3) {
r->master_adver_interval = r->master_adver_interval =
@ -965,7 +965,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
vrrp_master_down_timer_expire, r, vrrp_master_down_timer_expire, r,
r->master_down_interval * CS2MS, r->master_down_interval * CS2MS,
&r->t_master_down_timer); &r->t_master_down_timer);
} else if (r->vr->preempt_mode == true } else if (r->vr->preempt_mode
&& pkt->hdr.priority < r->priority) { && pkt->hdr.priority < r->priority) {
/* Discard advertisement */ /* Discard advertisement */
DEBUGD(&vrrp_dbg_proto, DEBUGD(&vrrp_dbg_proto,
@ -1834,7 +1834,7 @@ static int vrrp_autoconfig_if_add(struct interface *ifp)
created = true; created = true;
} }
if (!vr || vr->autoconf == false) if (!vr || !vr->autoconf)
return 0; return 0;
if (!created) { if (!created) {

View File

@ -605,7 +605,7 @@ int32_t zebra_mlag_test_mlag_internal(const char *none, const char *primary,
zsend_capabilities_all_clients(); zsend_capabilities_all_clients();
if (zrouter.mlag_info.role != MLAG_ROLE_NONE) { if (zrouter.mlag_info.role != MLAG_ROLE_NONE) {
if (zrouter.mlag_info.clients_interested_cnt == 0 if (zrouter.mlag_info.clients_interested_cnt == 0
&& test_mlag_in_progress == false) { && !test_mlag_in_progress) {
if (zrouter.mlag_info.zebra_pth_mlag == NULL) if (zrouter.mlag_info.zebra_pth_mlag == NULL)
zebra_mlag_spawn_pthread(); zebra_mlag_spawn_pthread();
zrouter.mlag_info.clients_interested_cnt++; zrouter.mlag_info.clients_interested_cnt++;
@ -613,7 +613,7 @@ int32_t zebra_mlag_test_mlag_internal(const char *none, const char *primary,
hook_call(zebra_mlag_private_open_channel); hook_call(zebra_mlag_private_open_channel);
} }
} else { } else {
if (test_mlag_in_progress == true) { if (test_mlag_in_progress) {
test_mlag_in_progress = false; test_mlag_in_progress = false;
zrouter.mlag_info.clients_interested_cnt--; zrouter.mlag_info.clients_interested_cnt--;
hook_call(zebra_mlag_private_close_channel); hook_call(zebra_mlag_private_close_channel);
@ -790,7 +790,7 @@ int zebra_mlag_protobuf_encode_client_data(struct stream *s, uint32_t *msg_type)
vrf_name_len); vrf_name_len);
} }
} }
if (cleanup == false) { if (!cleanup) {
Bulk_msg.mroute_add = pay_load; Bulk_msg.mroute_add = pay_load;
len = zebra_mlag_mroute_add_bulk__pack(&Bulk_msg, len = zebra_mlag_mroute_add_bulk__pack(&Bulk_msg,
tmp_buf); tmp_buf);
@ -804,7 +804,7 @@ int zebra_mlag_protobuf_encode_client_data(struct stream *s, uint32_t *msg_type)
XFREE(MTYPE_MLAG_PBUF, pay_load[i]); XFREE(MTYPE_MLAG_PBUF, pay_load[i]);
} }
XFREE(MTYPE_MLAG_PBUF, pay_load); XFREE(MTYPE_MLAG_PBUF, pay_load);
if (cleanup == true) if (cleanup)
return -1; return -1;
} break; } break;
case MLAG_MROUTE_DEL_BULK: { case MLAG_MROUTE_DEL_BULK: {