diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-11-17 16:38:25 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-11-17 18:19:19 +0100 |
commit | 843b44d261c5d1087face85cc95a68fcf2efad24 (patch) | |
tree | 4e22e3574b7db945942cac0510b536d5029311aa /openbsc/src/gsm_04_08_utils.c | |
parent | fe9da827fd29b8e153a43d44865a37ff36ae446d (diff) |
[neci] Use the correct length when going over the array
Use the correct length when going over the array instead
of using the neci0 values. Remove the fixme from the method
as well as the issue has been addressed by adding a parameter
to the method.
Diffstat (limited to 'openbsc/src/gsm_04_08_utils.c')
-rw-r--r-- | openbsc/src/gsm_04_08_utils.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/openbsc/src/gsm_04_08_utils.c b/openbsc/src/gsm_04_08_utils.c index 0e242b778..e95de79fa 100644 --- a/openbsc/src/gsm_04_08_utils.c +++ b/openbsc/src/gsm_04_08_utils.c @@ -305,10 +305,20 @@ static const enum gsm_chreq_reason_t reason_by_chreq[] = { enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci) { int i; - /* FIXME: determine if we set NECI = 0 in the BTS SI4 */ + int length; + const struct chreq *chreq; - for (i = 0; i < ARRAY_SIZE(chreq_type_neci0); i++) { - const struct chreq *chr = neci ? &chreq_type_neci1[i] : &chreq_type_neci0[i]; + if (neci) { + chreq = chreq_type_neci1; + length = ARRAY_SIZE(chreq_type_neci1); + } else { + chreq = chreq_type_neci0; + length = ARRAY_SIZE(chreq_type_neci0); + } + + + for (i = 0; i < length; i++) { + const struct chreq *chr = &chreq[i]; if ((ra & chr->mask) == chr->val) return ctype_by_chreq[chr->type]; } @@ -319,10 +329,19 @@ enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci) enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra, int neci) { int i; - /* FIXME: determine if we set NECI = 0 in the BTS SI4 */ + int length; + const struct chreq *chreq; + + if (neci) { + chreq = chreq_type_neci1; + length = ARRAY_SIZE(chreq_type_neci1); + } else { + chreq = chreq_type_neci0; + length = ARRAY_SIZE(chreq_type_neci0); + } - for (i = 0; i < ARRAY_SIZE(chreq_type_neci0); i++) { - const struct chreq *chr = neci ? &chreq_type_neci1[i] : &chreq_type_neci0[i]; + for (i = 0; i < length; i++) { + const struct chreq *chr = &chreq[i]; if ((ra & chr->mask) == chr->val) return reason_by_chreq[chr->type]; } |