Module: kamailio
Branch: master
Commit: 8e398b8675079e1baac7c7575e70283175cdebe2
URL:
https://github.com/kamailio/kamailio/commit/8e398b8675079e1baac7c7575e70283…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-12-09T19:04:25+01:00
lib/srdb1: new and free connection callbacks expect one parameter
- new connection is executetd with a database id and free connection
with a pool con
- compiler warnings:
src/lib/srdb1/db.c:322:23: warning: passing arguments to a function without a prototype is
deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
322 | con = new_connection(id);
src/lib/srdb1/db.c:361:18: warning: passing arguments to a function without a prototype is
deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
361 | free_connection(con);
---
Modified: src/lib/srdb1/db.c
Modified: src/lib/srdb1/db.h
---
Diff:
https://github.com/kamailio/kamailio/commit/8e398b8675079e1baac7c7575e70283…
Patch:
https://github.com/kamailio/kamailio/commit/8e398b8675079e1baac7c7575e70283…
---
diff --git a/src/lib/srdb1/db.c b/src/lib/srdb1/db.c
index b13d87c692b..77dea84df52 100644
--- a/src/lib/srdb1/db.c
+++ b/src/lib/srdb1/db.c
@@ -270,7 +270,7 @@ int db_bind_mod(const str *mod, db_func_t *mydbf)
* Initialize database module
* \note No function should be called before this
*/
-db1_con_t *db_do_init(const str *url, void *(*new_connection)())
+db1_con_t *db_do_init(const str *url, void *(*new_connection)(struct db_id *))
{
return db_do_init2(url, *new_connection, DB_POOLING_PERMITTED);
}
@@ -280,8 +280,8 @@ db1_con_t *db_do_init(const str *url, void *(*new_connection)())
* Initialize database module
* \note No function should be called before this
*/
-db1_con_t *db_do_init2(
- const str *url, void *(*new_connection)(), db_pooling_t pooling)
+db1_con_t *db_do_init2(const str *url, void *(*new_connection)(struct db_id *),
+ db_pooling_t pooling)
{
struct db_id *id;
void *con;
@@ -347,7 +347,7 @@ db1_con_t *db_do_init2(
* Shut down database module
* \note No function should be called after this
*/
-void db_do_close(db1_con_t *_h, void (*free_connection)())
+void db_do_close(db1_con_t *_h, void (*free_connection)(struct pool_con *))
{
struct pool_con *con;
diff --git a/src/lib/srdb1/db.h b/src/lib/srdb1/db.h
index 248647ecd07..a9538f6b9ca 100644
--- a/src/lib/srdb1/db.h
+++ b/src/lib/srdb1/db.h
@@ -48,6 +48,8 @@
#include "db_cap.h"
#include "db_con.h"
#include "db_row.h"
+#include "db_id.h"
+#include "db_pool.h"
#include "db_pooling.h"
#include "db_locking.h"
@@ -464,7 +466,7 @@ int db_bind_mod(const str *mod, db_func_t *dbf);
* \return returns a pointer to the db1_con_t representing the connection if it was
successful, otherwise 0 is returned.
*/
-db1_con_t *db_do_init(const str *url, void *(*new_connection)());
+db1_con_t *db_do_init(const str *url, void *(*new_connection)(struct db_id *));
/**
@@ -478,8 +480,8 @@ db1_con_t *db_do_init(const str *url, void *(*new_connection)());
* \return returns a pointer to the db1_con_t representing the connection if it was
successful, otherwise 0 is returned.
*/
-db1_con_t *db_do_init2(
- const str *url, void *(*new_connection)(), db_pooling_t pooling);
+db1_con_t *db_do_init2(const str *url, void *(*new_connection)(struct db_id *),
+ db_pooling_t pooling);
/**
@@ -490,7 +492,7 @@ db1_con_t *db_do_init2(
* \param _h database connection handle
* \param (*free_connection) Pointer to the db specific free_connection method
*/
-void db_do_close(db1_con_t *_h, void (*free_connection)());
+void db_do_close(db1_con_t *_h, void (*free_connection)(struct pool_con *));
/**