aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-04-27 13:34:23 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-04-27 13:35:07 +0200
commitb72141458c2c1ff73e97688233c6341b2eca09a9 (patch)
treef2468080207488279091f23eb83dca6f12115c61 /src
parentaed46ec97d22c1eccae3578c0010840c3acede0e (diff)
gprs_sndcp_comp_free: Replace ifelse with switch and better handling of error
gprs_sndcp_dcomp_term asserts if compclass is not SNDCP_XID_DATA_COMPRESSION, so this way by checking in the caller too we easily now if the unexpected value is in compclass or in algo.dcomp. Change-Id: I4600e6a137f42f20fdf69637e4a9048b265c1748
Diffstat (limited to 'src')
-rw-r--r--src/gprs/gprs_sndcp_comp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gprs/gprs_sndcp_comp.c b/src/gprs/gprs_sndcp_comp.c
index 0b4c67cd4..c71cc8982 100644
--- a/src/gprs/gprs_sndcp_comp.c
+++ b/src/gprs/gprs_sndcp_comp.c
@@ -160,16 +160,23 @@ void gprs_sndcp_comp_free(struct llist_head *comp_entities)
llist_for_each_entry(comp_entity, comp_entities, list) {
/* Free compression entity */
- if (comp_entity->compclass == SNDCP_XID_PROTOCOL_COMPRESSION) {
+ switch (comp_entity->compclass) {
+ case SNDCP_XID_PROTOCOL_COMPRESSION:
LOGP(DSNDCP, LOGL_INFO,
"Deleting header compression entity %d ...\n",
comp_entity->entity);
gprs_sndcp_pcomp_term(comp_entity);
- } else {
+ break;
+ case SNDCP_XID_DATA_COMPRESSION:
LOGP(DSNDCP, LOGL_INFO,
"Deleting data compression entity %d ...\n",
comp_entity->entity);
gprs_sndcp_dcomp_term(comp_entity);
+ break;
+ default:
+ LOGP(DSNDCP, LOGL_INFO,
+ "Invalid compression class %d!\n", comp_entity->compclass);
+ OSMO_ASSERT(false);
}
}