aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gsm0808/gsm0808_test.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-02-28 20:11:21 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2014-03-18 14:10:02 +0100
commit7e86eef4a1d49b6f0e3c18633698ed7a601e9a73 (patch)
tree04f811bb04b35f0202fb8a7f570b55274469e542 /tests/gsm0808/gsm0808_test.c
parent1512ea6452c123fbf7da325422b4378d64b90087 (diff)
msgb: Optionally declare some msgb struct fields as const
Writing directly to following struct fields may cause inconsistencies that are hard to debug: data_len, len, head, tail, data In general, the available macros and functions should be used to modify them instead. This patch declares these fields as const if MSGB_DISABLE_DIRECT_WRITE is defined. Doing so may lead to warnings and errors, therefore this macro is only defined for libosmocore yet, where at least the errors are also fixed by this patch. The main purpose is to maintain consistency, so only modifing the fields themselves is restricted. It's still possible to modify the data the pointers refer to. Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests/gsm0808/gsm0808_test.c')
-rw-r--r--tests/gsm0808/gsm0808_test.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index 7e5e97b5..1ce6ef9a 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -108,8 +108,7 @@ static void test_create_cipher_complete()
msgb_free(msg);
/* with l3 data but short */
- l3->len -= 1;
- l3->tail -= 1;
+ msgb_trim(l3, l3->len - 1);
msg = gsm0808_create_cipher_complete(l3, 4);
VERIFY(msg, res2, ARRAY_SIZE(res2));
msgb_free(msg);