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

Max gerrit-no-reply at lists.osmocom.org
Mon Feb 20 12:40:37 UTC 2017


Hello Neels Hofmeyr, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1853

to look at the new patch set (#3).

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/3

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: newpatchset
Gerrit-Change-Id: I83b0f4a5dacb97614721690ef55bc1311624a58e
Gerrit-PatchSet: 3
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list