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/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: Make subscr parameter to db_subscr_get() optional ...................................................................... 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. While at it also call to db_remove_reset() and return explicitly instead of using goto to make it a bit easier to follow the code. Change-Id: I83b0f4a5dacb97614721690ef55bc1311624a58e --- M src/db_hlr.c 1 file changed, 9 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/db_hlr.c b/src/db_hlr.c index 2c6b243..340e7ce 100644 --- a/src/db_hlr.c +++ b/src/db_hlr.c @@ -41,7 +41,7 @@ struct hlr_subscriber *subscr) { sqlite3_stmt *stmt = dbc->stmt[SEL_BY_IMSI]; - int rc, ret = 0; + int rc; if (!db_bind_imsi(stmt, imsi)) return -EINVAL; @@ -50,8 +50,13 @@ rc = sqlite3_step(stmt); if (rc != SQLITE_ROW) { LOGHLR(imsi, LOGL_ERROR, "Error executing SQL: %d\n", rc); - ret = -ENOEXEC; - goto out; + db_remove_reset(stmt); + return -ENOEXEC; + } + + if (!subscr) { + db_remove_reset(stmt); + return 0; } /* obtain the various columns */ @@ -70,10 +75,9 @@ subscr->ms_purged_cs = sqlite3_column_int(stmt, 11); subscr->ms_purged_ps = sqlite3_column_int(stmt, 12); -out: db_remove_reset(stmt); - return ret; + return 0; } int db_subscr_ps(struct db_context *dbc, const char *imsi, bool enable) -- To view, visit https://gerrit.osmocom.org/1853 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I83b0f4a5dacb97614721690ef55bc1311624a58e Gerrit-PatchSet: 11 Gerrit-Project: osmo-hlr Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>