From aed46ec97d22c1eccae3578c0010840c3acede0e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 22 Mar 2019 09:44:42 +0100 Subject: gb_proxy: cosmetic: Use 'bool' in data structures where applicable If we ever only use 0/1 in an 'int', we should have used 'bool'. Change-Id: I63876f52d5de87e4c99d92669270fd1f487e217c --- src/gprs/gb_proxy.c | 8 ++++---- src/gprs/gb_proxy_patch.c | 4 ++-- src/gprs/gb_proxy_tlli.c | 16 ++++++++-------- src/gprs/gb_proxy_vty.c | 22 +++++++++++----------- 4 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/gprs') diff --git a/src/gprs/gb_proxy.c b/src/gprs/gb_proxy.c index 0b5758a33..3da7bfdbb 100644 --- a/src/gprs/gb_proxy.c +++ b/src/gprs/gb_proxy.c @@ -310,7 +310,7 @@ static int gbproxy_restart_imsi_acquisition(struct gbproxy_link_info* link_info) in_progress = 1; gbproxy_link_info_discard_messages(link_info); - link_info->imsi_acq_pending = 0; + link_info->imsi_acq_pending = false; return in_progress; } @@ -531,7 +531,7 @@ static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer, * implementation relies on the MS doing proper retransmissions * of the triggering message instead */ - link_info->imsi_acq_pending = 1; + link_info->imsi_acq_pending = true; } return 0; @@ -836,11 +836,11 @@ static int block_unblock_peer(struct gbproxy_config *cfg, uint16_t ptp_bvci, uin switch (pdu_type) { case BSSGP_PDUT_BVC_BLOCK_ACK: - peer->blocked = 1; + peer->blocked = true; rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_BLOCKED]); break; case BSSGP_PDUT_BVC_UNBLOCK_ACK: - peer->blocked = 0; + peer->blocked = false; rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_UNBLOCKED]); break; default: diff --git a/src/gprs/gb_proxy_patch.c b/src/gprs/gb_proxy_patch.c index 251bb67d6..6235b04f4 100644 --- a/src/gprs/gb_proxy_patch.c +++ b/src/gprs/gb_proxy_patch.c @@ -398,7 +398,7 @@ void gbproxy_clear_patch_filter(struct gbproxy_match *match) { if (match->enable) { regfree(&match->re_comp); - match->enable = 0; + match->enable = false; } talloc_free(match->re_str); match->re_str = NULL; @@ -419,7 +419,7 @@ int gbproxy_set_patch_filter(struct gbproxy_match *match, const char *filter, REG_EXTENDED | REG_NOSUB | REG_ICASE); if (rc == 0) { - match->enable = 1; + match->enable = true; match->re_str = talloc_strdup(tall_sgsn_ctx, filter); return 0; } diff --git a/src/gprs/gb_proxy_tlli.c b/src/gprs/gb_proxy_tlli.c index 0c027d5fb..4e21ede86 100644 --- a/src/gprs/gb_proxy_tlli.c +++ b/src/gprs/gb_proxy_tlli.c @@ -284,8 +284,8 @@ void gbproxy_reassign_tlli(struct gbproxy_tlli_state *tlli_state, /* Remember assigned TLLI */ tlli_state->assigned = new_tlli; - tlli_state->bss_validated = 0; - tlli_state->net_validated = 0; + tlli_state->bss_validated = false; + tlli_state->net_validated = false; } uint32_t gbproxy_map_tlli(uint32_t other_tlli, @@ -325,9 +325,9 @@ static void gbproxy_validate_tlli(struct gbproxy_tlli_state *tlli_state, /* See GSM 04.08, 4.7.1.5 */ if (to_bss) - tlli_state->net_validated = 1; + tlli_state->net_validated = true; else - tlli_state->bss_validated = 1; + tlli_state->bss_validated = true; if (!tlli_state->bss_validated || !tlli_state->net_validated) return; @@ -367,7 +367,7 @@ static int gbproxy_unregister_link_info(struct gbproxy_peer *peer, link_info->sgsn_tlli.current = 0; link_info->sgsn_tlli.assigned = 0; - link_info->is_deregistered = 1; + link_info->is_deregistered = true; gbproxy_reset_link(link_info); @@ -424,7 +424,7 @@ static void gbproxy_assign_imsi(struct gbproxy_peer *peer, &peer->cfg->matches[match_id], parse_ctx->imsi, parse_ctx->imsi_len); if (imsi_matches >= 0) - link_info->is_matching[match_id] = imsi_matches; + link_info->is_matching[match_id] = imsi_matches ? true : false; } } @@ -498,7 +498,7 @@ static struct gbproxy_link_info *gbproxy_get_link_info_ul( if (!link_info) return NULL; - link_info->is_deregistered = 0; + link_info->is_deregistered = false; return link_info; } @@ -577,7 +577,7 @@ static struct gbproxy_link_info *gbproxy_get_link_info_dl( peer, parse_ctx->imsi, parse_ctx->imsi_len); if (link_info) - link_info->is_deregistered = 0; + link_info->is_deregistered = false; return link_info; } diff --git a/src/gprs/gb_proxy_vty.c b/src/gprs/gb_proxy_vty.c index 52c39fdcd..5c4f45420 100644 --- a/src/gprs/gb_proxy_vty.c +++ b/src/gprs/gb_proxy_vty.c @@ -241,7 +241,7 @@ DEFUN(cfg_gbproxy_match_imsi, return CMD_WARNING; } - g_cfg->acquire_imsi = 1; + g_cfg->acquire_imsi = true; return CMD_SUCCESS; } @@ -256,7 +256,7 @@ DEFUN(cfg_gbproxy_no_match_imsi, for (match_id = 0; match_id < ARRAY_SIZE(g_cfg->matches); ++match_id) gbproxy_clear_patch_filter(&g_cfg->matches[match_id]); - g_cfg->acquire_imsi = 0; + g_cfg->acquire_imsi = false; return CMD_SUCCESS; } @@ -329,7 +329,7 @@ DEFUN(cfg_gbproxy_patch_ptmsi, "patch-ptmsi", GBPROXY_PATCH_PTMSI_STR) { - g_cfg->patch_ptmsi = 1; + g_cfg->patch_ptmsi = true; return CMD_SUCCESS; } @@ -339,7 +339,7 @@ DEFUN(cfg_gbproxy_no_patch_ptmsi, "no patch-ptmsi", NO_STR GBPROXY_PATCH_PTMSI_STR) { - g_cfg->patch_ptmsi = 0; + g_cfg->patch_ptmsi = false; return CMD_SUCCESS; } @@ -355,7 +355,7 @@ DEFUN(cfg_gbproxy_acquire_imsi, "acquire-imsi", GBPROXY_ACQUIRE_IMSI_STR) { - g_cfg->acquire_imsi = 1; + g_cfg->acquire_imsi = true; return CMD_SUCCESS; } @@ -365,7 +365,7 @@ DEFUN(cfg_gbproxy_no_acquire_imsi, "no acquire-imsi", NO_STR GBPROXY_ACQUIRE_IMSI_STR) { - g_cfg->acquire_imsi = 0; + g_cfg->acquire_imsi = false; return CMD_SUCCESS; } @@ -387,10 +387,10 @@ DEFUN(cfg_gbproxy_secondary_sgsn, return CMD_WARNING; } - g_cfg->route_to_sgsn2 = 1; + g_cfg->route_to_sgsn2 = true; g_cfg->nsip_sgsn2_nsei = nsei; - g_cfg->patch_ptmsi = 1; + g_cfg->patch_ptmsi = true; return CMD_SUCCESS; } @@ -400,10 +400,10 @@ DEFUN(cfg_gbproxy_no_secondary_sgsn, "no secondary-sgsn", NO_STR GBPROXY_SECOND_SGSN_STR) { - g_cfg->route_to_sgsn2 = 0; + g_cfg->route_to_sgsn2 = false; g_cfg->nsip_sgsn2_nsei = 0xFFFF; - g_cfg->patch_ptmsi = 0; + g_cfg->patch_ptmsi = false; return CMD_SUCCESS; } @@ -849,7 +849,7 @@ DEFUN_DEPRECATED(cfg_gbproxy_broken_apn_match, return CMD_WARNING; } - g_cfg->acquire_imsi = 1; + g_cfg->acquire_imsi = true; return CMD_SUCCESS; } -- cgit v1.2.3