aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-03-26 05:45:44 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-03-26 05:49:34 +0100
commit17d751531ec42fc1e63dd985c117ed4cd69eb04b (patch)
tree1ff80d4210069db51548e2d152f424e0cae1cea0 /openbsc/tests
parentfacb5cdfc2d20de703c90e12a62b4ca69dea278b (diff)
parent3c1221e2b23876cf0cb4170281eceb73e3395efd (diff)
Merge branch 'on-waves/sccp' into on-waves/bsc-master
Diffstat (limited to 'openbsc/tests')
-rw-r--r--openbsc/tests/sccp/sccp_test.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/openbsc/tests/sccp/sccp_test.c b/openbsc/tests/sccp/sccp_test.c
index eb41d3eaf..0c2adc83f 100644
--- a/openbsc/tests/sccp/sccp_test.c
+++ b/openbsc/tests/sccp/sccp_test.c
@@ -354,14 +354,14 @@ int sccp_read_cb(struct msgb *data, unsigned len, void *context)
return 0;
}
-int sccp_write_cb(struct msgb *data, void *ctx)
+void sccp_write_cb(struct msgb *data, void *ctx)
{
int i = 0;
const u_int8_t *got, *wanted;
if (test_data[current_test].response == NULL) {
FAIL("Didn't expect write callback\n");
- return -1;
+ goto exit;
} else if (test_data[current_test].response_length != msgb_l2len(data)) {
FAIL("Size does not match. Got: %d Wanted: %d\n",
msgb_l2len(data), test_data[current_test].response_length);
@@ -374,12 +374,14 @@ int sccp_write_cb(struct msgb *data, void *ctx)
if (got[i] != wanted[i]) {
FAIL("Failed to compare byte. Got: 0x%x Wanted: 0x%x at %d\n",
got[i], wanted[i], i);
- return -1;
+ goto exit;
}
}
write_called = 1;
- return 0;
+
+exit:
+ msgb_free(data);
}
void sccp_c_read(struct sccp_connection *connection, struct msgb *msgb, unsigned int len)
@@ -409,7 +411,7 @@ int sccp_accept_cb(struct sccp_connection *connection, void *user_data)
return 0;
}
-static int sccp_udt_write_cb(struct msgb *data, void *context)
+static void sccp_udt_write_cb(struct msgb *data, void *context)
{
const u_int8_t *got, *wanted;
int i;
@@ -419,7 +421,7 @@ static int sccp_udt_write_cb(struct msgb *data, void *context)
if (send_data[current_test].length != msgb_l2len(data)) {
FAIL("Size does not match. Got: %d Wanted: %d\n",
msgb_l2len(data), send_data[current_test].length);
- return -1;
+ goto exit;
}
got = &data->l2h[0];
@@ -429,12 +431,14 @@ static int sccp_udt_write_cb(struct msgb *data, void *context)
if (got[i] != wanted[i]) {
FAIL("Failed to compare byte. Got: 0x%x Wanted: 0x%x at %d\n",
got[i], wanted[i], i);
- return -1;
+ goto exit;
}
}
matched = 1;
- return 0;
+
+exit:
+ msgb_free(data);
}
static void test_sccp_system(void)
@@ -504,11 +508,11 @@ static int sccp_udt_read(struct msgb *data, unsigned int len, void *context)
return 0;
}
-static int sccp_write_loop(struct msgb *data, void *context)
+static void sccp_write_loop(struct msgb *data, void *context)
{
/* send it back to us */
sccp_system_incoming(data);
- return 0;
+ msgb_free(data);
}
static void test_sccp_udt_communication(void)