aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-10-02 16:11:15 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-10-08 16:56:02 +0200
commitba67df65233121043568c299c5d868c6d63e74a3 (patch)
treec10d340b3029514e1f6e3cc010184b88d270c735
parentfded0a7362cbe4507ccb9d4c5e75a3700fca9657 (diff)
osmux: Do not divide the number of bytes by eight.
sizeof(uint8_t) == 1 and there is no need to create an array with 16 bytes and then only use the first two of them. This means the CID range is from 0 to 127 and we should be able to extend this to 256 by changing the array size to 32. Update the testcase now that we can have more than 16 calls with Osmux.
-rw-r--r--openbsc/src/libmgcp/mgcp_osmux.c4
-rw-r--r--openbsc/tests/mgcp/mgcp_test.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/openbsc/src/libmgcp/mgcp_osmux.c b/openbsc/src/libmgcp/mgcp_osmux.c
index b0ef69fd4..30a81cbc3 100644
--- a/openbsc/src/libmgcp/mgcp_osmux.c
+++ b/openbsc/src/libmgcp/mgcp_osmux.c
@@ -536,7 +536,7 @@ int osmux_used_cid(void)
{
int i, j, used = 0;
- for (i = 0; i < sizeof(osmux_cid_bitmap) / 8; i++) {
+ for (i = 0; i < sizeof(osmux_cid_bitmap); i++) {
for (j = 0; j < 8; j++) {
if (osmux_cid_bitmap[i] & (1 << j))
used += 1;
@@ -550,7 +550,7 @@ int osmux_get_cid(void)
{
int i, j;
- for (i = 0; i < sizeof(osmux_cid_bitmap) / 8; i++) {
+ for (i = 0; i < sizeof(osmux_cid_bitmap); i++) {
for (j = 0; j < 8; j++) {
if (osmux_cid_bitmap[i] & (1 << j))
continue;
diff --git a/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c
index 7b5de31d6..ec86c55a9 100644
--- a/openbsc/tests/mgcp/mgcp_test.c
+++ b/openbsc/tests/mgcp/mgcp_test.c
@@ -1186,7 +1186,7 @@ static void test_osmux_cid(void)
osmux_put_cid(id);
OSMO_ASSERT(osmux_used_cid() == 0);
- for (i = 0; i < 16; ++i) {
+ for (i = 0; i < 128; ++i) {
id = osmux_get_cid();
OSMO_ASSERT(id == i);
OSMO_ASSERT(osmux_used_cid() == i + 1);