diff mbox

[1/3] use non-vararg functions if possible

Message ID 1438194030-6423-1-git-send-email-max.suraev@fairwaves.co
State Accepted
Headers show

Commit Message

Max July 29, 2015, 6:20 p.m. UTC
Signed-off-by: Max <max.suraev@fairwaves.co>
---
 openbsc/src/libmsc/db.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Max July 29, 2015, 6:25 p.m. UTC | #1
This patch series switch to thread-safe interface of libdbi (correspondingly
introducing version requirement for libdbi >= 0.9.0). In addition SQL-specific debug
facility is added alongside with couple of inefficiencies catch.

Essentially it's groundwork for possible future refactoring which allows for things
like gprs authentication or prepared statements to be implemented.
Holger Freyther July 30, 2015, 8 a.m. UTC | #2
> On 29 Jul 2015, at 20:25, ☎ <Max.Suraev@fairwaves.co> wrote:
> 
> This patch series switch to thread-safe interface of libdbi (correspondingly
> introducing version requirement for libdbi >= 0.9.0). In addition SQL-specific debug
> facility is added alongside with couple of inefficiencies catch.

libdbi >= 0.9.0 has severe memory corruptions[1] and they remain unfixed. We
should just move away from it and not force the usage of a broken version.

holger



[1] http://sourceforge.net/p/libdbi/mailman/message/32607036/
diff mbox

Patch

diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index 428f99b..035202d 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -301,7 +301,7 @@  static int update_db_revision_3(void)
 	dbi_result_free(result);
 
 	/* Cycle through old messages and convert them to the new format */
-	result = dbi_conn_queryf(conn, "SELECT * FROM SMS_3");
+	result = dbi_conn_query(conn, "SELECT * FROM SMS_3");
 	if (!result) {
 		LOGP(DDB, LOGL_ERROR,
 		     "Failed fetch messages from the old SMS table (upgrade from rev 3).\n");
@@ -1095,8 +1095,8 @@  int db_subscriber_list_active(void (*cb)(struct gsm_subscriber*,void*), void *cl
 {
 	dbi_result result;
 
-	result = dbi_conn_queryf(conn,
-			"SELECT * from Subscriber WHERE LAC != 0 AND authorized = 1");
+	result = dbi_conn_query(conn,
+		       "SELECT * from Subscriber WHERE LAC != 0 AND authorized = 1");
 	if (!result) {
 		LOGP(DDB, LOGL_ERROR, "Failed to list active subscribers\n");
 		return -1;