gprs: Do not put the subscr in gprs_subscr_delete
Currently gprs_subscr_delete implicitely calls subscr_put, which
makes the code more complex than necessary (additional subscr_get) in
a few places. It also makes it more difficult to see, whether get/put
are balanced within a function. In addition, the functions are not
named consistently (gprs_subscr_delete vs.
gprs_subscr_put_and_cancel).
This commit changes the semantics of gprs_subscr_delete and
indirectly of gprs_subscr_put_and_cancel to not call subscr_put on
their argument, but to leave that for the caller to do it
explicitely.
It renames gprs_subscr_put_and_cancel to gprs_subscr_cancel to
reflect that change in the name, too.
Sponsored-by: On-Waves ehf
diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c
index 34ad647..57577a4 100644
--- a/openbsc/tests/sgsn/sgsn_test.c
+++ b/openbsc/tests/sgsn/sgsn_test.c
@@ -270,6 +270,7 @@
/* There is no subscriber cache. Verify it */
gprs_subscr_delete(s1);
+ subscr_put(s1);
s1 = NULL;
sfound = gprs_subscr_get_by_imsi(imsi1);
OSMO_ASSERT(sfound == NULL);
@@ -279,6 +280,7 @@
/* Free entry 2 (GSM_SUBSCRIBER_FIRST_CONTACT is set) */
gprs_subscr_delete(s2);
+ subscr_put(s2);
s2 = NULL;
OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL);
OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi2) == NULL);
@@ -286,6 +288,7 @@
/* Try to delete entry 3 */
gprs_subscr_delete(s3);
+ subscr_put(s3);
s3 = NULL;
OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi3) == NULL);