[PATCH] osmo-hlr[master]: Make subscr parameter to db_subscr_get() optional

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Mon Feb 20 10:28:45 UTC 2017


Review at  https://gerrit.osmocom.org/1853

Make subscr parameter to db_subscr_get() optional

This allows to check for subscriber's presence in DB without the need to
bother with unused structure allocation.

Change-Id: I83b0f4a5dacb97614721690ef55bc1311624a58e
---
M src/db_hlr.c
1 file changed, 17 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/53/1853/1

diff --git a/src/db_hlr.c b/src/db_hlr.c
index b7485f0..09ab6fc 100644
--- a/src/db_hlr.c
+++ b/src/db_hlr.c
@@ -54,22 +54,23 @@
 		goto out;
 	}
 
-	/* obtain the various columns */
-	subscr->id = sqlite3_column_int64(stmt, 0);
-	SL3_TXT(subscr->imsi, stmt, 1);
-	SL3_TXT(subscr->msisdn, stmt, 2);
-	/* FIXME: These should all be BLOBs as they might contain NUL */
-	SL3_TXT(subscr->vlr_number, stmt, 3);
-	SL3_TXT(subscr->sgsn_number, stmt, 4);
-	SL3_TXT(subscr->sgsn_address, stmt, 5);
-	subscr->periodic_lu_timer = sqlite3_column_int(stmt, 6);
-	subscr->periodic_rau_tau_timer = sqlite3_column_int(stmt, 7);
-	subscr->nam_cs = sqlite3_column_int(stmt, 8);
-	subscr->nam_ps = sqlite3_column_int(stmt, 9);
-	subscr->lmsi = sqlite3_column_int(stmt, 10);
-	subscr->ms_purged_cs = sqlite3_column_int(stmt, 11);
-	subscr->ms_purged_ps = sqlite3_column_int(stmt, 12);
-
+	if (subscr) {
+		/* obtain the various columns */
+		subscr->id = sqlite3_column_int64(stmt, 0);
+		SL3_TXT(subscr->imsi, stmt, 1);
+		SL3_TXT(subscr->msisdn, stmt, 2);
+		/* FIXME: These should all be BLOBs as they might contain NUL */
+		SL3_TXT(subscr->vlr_number, stmt, 3);
+		SL3_TXT(subscr->sgsn_number, stmt, 4);
+		SL3_TXT(subscr->sgsn_address, stmt, 5);
+		subscr->periodic_lu_timer = sqlite3_column_int(stmt, 6);
+		subscr->periodic_rau_tau_timer = sqlite3_column_int(stmt, 7);
+		subscr->nam_cs = sqlite3_column_int(stmt, 8);
+		subscr->nam_ps = sqlite3_column_int(stmt, 9);
+		subscr->lmsi = sqlite3_column_int(stmt, 10);
+		subscr->ms_purged_cs = sqlite3_column_int(stmt, 11);
+		subscr->ms_purged_ps = sqlite3_column_int(stmt, 12);
+	}
 out:
 	db_remove_reset(stmt);
 

-- 
To view, visit https://gerrit.osmocom.org/1853
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83b0f4a5dacb97614721690ef55bc1311624a58e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list