mirror of
https://github.com/open5gs/open5gs.git
synced 2025-10-22 23:31:57 +00:00
[ue-info] be compliant with C99/C11 standard
This commit is contained in:
committed by
Sukchan Lee
parent
40351e5a38
commit
2434f1e4f1
@@ -199,8 +199,9 @@ size_t amf_dump_gnb_info_paged(char *buf, size_t buflen, size_t page, size_t pag
|
||||
if (!tas) { cJSON_Delete(g); oom = true; break; }
|
||||
|
||||
bool inner_oom = false;
|
||||
int t;
|
||||
|
||||
for (int t = 0; t < gnb->num_of_supported_ta_list; t++) {
|
||||
for (t = 0; t < gnb->num_of_supported_ta_list; t++) {
|
||||
const ogs_uint24_t tac = gnb->supported_ta_list[t].tac;
|
||||
const int nbp = gnb->supported_ta_list[t].num_of_bplmn_list;
|
||||
|
||||
@@ -214,8 +215,9 @@ size_t amf_dump_gnb_info_paged(char *buf, size_t buflen, size_t page, size_t pag
|
||||
if (!bplmns) { cJSON_Delete(ta); inner_oom = true; break; }
|
||||
|
||||
bool inner2_oom = false;
|
||||
int p;
|
||||
|
||||
for (int p = 0; p < nbp; p++) {
|
||||
for (p = 0; p < nbp; p++) {
|
||||
const ogs_plmn_id_t *bp_plmn = &gnb->supported_ta_list[t].bplmn_list[p].plmn_id;
|
||||
const int ns = gnb->supported_ta_list[t].bplmn_list[p].num_of_s_nssai;
|
||||
const ogs_s_nssai_t *sn = gnb->supported_ta_list[t].bplmn_list[p].s_nssai;
|
||||
@@ -229,8 +231,9 @@ size_t amf_dump_gnb_info_paged(char *buf, size_t buflen, size_t page, size_t pag
|
||||
if (!sns) { cJSON_Delete(bp); inner2_oom = true; break; }
|
||||
|
||||
bool inner3_oom = false;
|
||||
int i;
|
||||
|
||||
for (int i = 0; i < ns; i++) {
|
||||
for (i = 0; i < ns; i++) {
|
||||
cJSON *o = cJSON_CreateObject();
|
||||
if (!o) { inner3_oom = true; break; }
|
||||
|
||||
|
@@ -335,9 +335,11 @@ static int add_location(cJSON *parent, const amf_ue_t *ue)
|
||||
static int add_msisdn_array(cJSON *parent, const amf_ue_t *ue)
|
||||
{
|
||||
cJSON *arr = cJSON_CreateArray();
|
||||
int i;
|
||||
|
||||
if (!arr) return -1;
|
||||
|
||||
for (int i = 0; i < ue->num_of_msisdn; i++) {
|
||||
for (i = 0; i < ue->num_of_msisdn; i++) {
|
||||
if (!ue->msisdn[i] || !ue->msisdn[i][0]) continue;
|
||||
cJSON *s = cJSON_CreateString(ue->msisdn[i]);
|
||||
if (!s) { cJSON_Delete(arr); return -1; }
|
||||
@@ -470,10 +472,12 @@ static int add_requested_allowed_slices(cJSON *parent, const amf_ue_t *ue)
|
||||
{
|
||||
cJSON *req = cJSON_CreateArray();
|
||||
cJSON *allow = cJSON_CreateArray();
|
||||
int i;
|
||||
|
||||
if (!req || !allow) { if (req) cJSON_Delete(req); if (allow) cJSON_Delete(allow); return -1; }
|
||||
|
||||
/* requested */
|
||||
for (int i = 0; i < ue->requested_nssai.num_of_s_nssai; i++) {
|
||||
for (i = 0; i < ue->requested_nssai.num_of_s_nssai; i++) {
|
||||
const ogs_nas_s_nssai_ie_t *ie = &ue->requested_nssai.s_nssai[i];
|
||||
cJSON *sn = cJSON_CreateObject();
|
||||
if (!sn) { cJSON_Delete(req); cJSON_Delete(allow); return -1; }
|
||||
@@ -485,7 +489,7 @@ static int add_requested_allowed_slices(cJSON *parent, const amf_ue_t *ue)
|
||||
}
|
||||
|
||||
/* allowed */
|
||||
for (int i = 0; i < ue->allowed_nssai.num_of_s_nssai; i++) {
|
||||
for (i = 0; i < ue->allowed_nssai.num_of_s_nssai; i++) {
|
||||
const ogs_nas_s_nssai_ie_t *ie = &ue->allowed_nssai.s_nssai[i];
|
||||
cJSON *sn = cJSON_CreateObject();
|
||||
if (!sn) { cJSON_Delete(req); cJSON_Delete(allow); return -1; }
|
||||
@@ -529,7 +533,8 @@ static int add_am_policy_features(cJSON *parent, const amf_ue_t *ue)
|
||||
cJSON *labels = cJSON_CreateArray();
|
||||
if (!bits || !labels) { if (bits) cJSON_Delete(bits); if (labels) cJSON_Delete(labels); cJSON_Delete(feat); return -1; }
|
||||
|
||||
for (int i = 0; i < 64; i++) {
|
||||
int i;
|
||||
for (i = 0; i < 64; i++) {
|
||||
if ((f >> i) & 1ULL) {
|
||||
cJSON *bi = cJSON_CreateNumber((double)i);
|
||||
if (!bi) { cJSON_Delete(bits); cJSON_Delete(labels); cJSON_Delete(feat); return -1; }
|
||||
|
@@ -198,8 +198,9 @@ size_t mme_dump_enb_info_paged(char *buf, size_t buflen, size_t page, size_t pag
|
||||
if (!tas) { cJSON_Delete(e); oom = true; break; }
|
||||
|
||||
bool inner_oom = false;
|
||||
int t;
|
||||
|
||||
for (int t = 0; t < enb->num_of_supported_ta_list; t++) {
|
||||
for (t = 0; t < enb->num_of_supported_ta_list; t++) {
|
||||
cJSON *ta = cJSON_CreateObject();
|
||||
if (!ta) { inner_oom = true; break; }
|
||||
|
||||
|
Reference in New Issue
Block a user