mirror of https://github.com/sipwise/kamailio.git
Change-Id: I3fc5d3b4f0a7bcf875f35c9cd511a14efecbe2abmr13.3
parent
3eef7f7267
commit
0e7c35fc3d
@ -0,0 +1,37 @@
|
|||||||
|
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||||
|
Date: Tue, 10 Dec 2024 23:58:06 +0100
|
||||||
|
Subject: [PATCH] db_sqlite: fix incompatible-pointer-types warning
|
||||||
|
|
||||||
|
fixes #4064
|
||||||
|
|
||||||
|
(cherry picked from commit 06cc2560e5358468178ef3e5c795a8a0ec67b693)
|
||||||
|
---
|
||||||
|
src/modules/db_sqlite/dbase.c | 11 +++++++----
|
||||||
|
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/modules/db_sqlite/dbase.c b/src/modules/db_sqlite/dbase.c
|
||||||
|
index 97af64d..a3e9b82 100644
|
||||||
|
--- a/src/modules/db_sqlite/dbase.c
|
||||||
|
+++ b/src/modules/db_sqlite/dbase.c
|
||||||
|
@@ -126,14 +126,17 @@ db1_con_t *db_sqlite_init(const str *_url)
|
||||||
|
* No function should be called after this
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static void db_sqlite_free_connection(struct sqlite_connection *con)
|
||||||
|
+static void db_sqlite_free_connection(struct pool_con *con)
|
||||||
|
{
|
||||||
|
+ struct sqlite_connection *_c;
|
||||||
|
+
|
||||||
|
if(!con)
|
||||||
|
return;
|
||||||
|
+ _c = (struct sqlite_connection *)con;
|
||||||
|
|
||||||
|
- sqlite3_close(con->conn);
|
||||||
|
- free_db_id(con->hdr.id);
|
||||||
|
- pkg_free(con);
|
||||||
|
+ sqlite3_close(_c->conn);
|
||||||
|
+ free_db_id(_c->hdr.id);
|
||||||
|
+ pkg_free(_c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void db_sqlite_close(db1_con_t *_h)
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||||
|
Date: Wed, 11 Dec 2024 00:09:02 +0100
|
||||||
|
Subject: [PATCH] db_unixodbc: fix incompatible-pointer-types warning
|
||||||
|
|
||||||
|
> dbase.c: In function 'db_unixodbc_close_impl':
|
||||||
|
> dbase.c:261:32: error: passing argument 2 of 'db_do_close' from incompatible pointer type [-Wincompatible-pointer-types]
|
||||||
|
> 261 | return db_do_close(_h, db_unixodbc_free_connection);
|
||||||
|
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
> | |
|
||||||
|
> | void (*)(struct my_con *)
|
||||||
|
> In file included from val.h:34,
|
||||||
|
> from dbase.c:33:
|
||||||
|
> ../../lib/srdb1/db.h:495:40: note: expected 'void (*)(struct pool_con *)' but argument is of type 'void (*)(struct my_con *)'
|
||||||
|
> 495 | void db_do_close(db1_con_t *_h, void (*free_connection)(struct pool_con *));
|
||||||
|
> | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
> make[2]: *** [../../Makefile.rules:101: dbase.o] Error 1
|
||||||
|
|
||||||
|
related #4064
|
||||||
|
|
||||||
|
(cherry picked from commit 7f24bc09863220b4c14e2046708c10ff0891c038)
|
||||||
|
---
|
||||||
|
src/modules/db_unixodbc/connection.c | 13 ++++++++-----
|
||||||
|
src/modules/db_unixodbc/connection.h | 2 +-
|
||||||
|
2 files changed, 9 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/modules/db_unixodbc/connection.c b/src/modules/db_unixodbc/connection.c
|
||||||
|
index 92b1cdb..d56f2ac 100644
|
||||||
|
--- a/src/modules/db_unixodbc/connection.c
|
||||||
|
+++ b/src/modules/db_unixodbc/connection.c
|
||||||
|
@@ -179,14 +179,17 @@ err2:
|
||||||
|
/*
|
||||||
|
* Close the connection and release memory
|
||||||
|
*/
|
||||||
|
-void db_unixodbc_free_connection(struct my_con *con)
|
||||||
|
+void db_unixodbc_free_connection(struct pool_con *con)
|
||||||
|
{
|
||||||
|
+ struct my_con *_c;
|
||||||
|
+
|
||||||
|
if(!con)
|
||||||
|
return;
|
||||||
|
- SQLFreeHandle(SQL_HANDLE_ENV, con->env);
|
||||||
|
- SQLDisconnect(con->dbc);
|
||||||
|
- SQLFreeHandle(SQL_HANDLE_DBC, con->dbc);
|
||||||
|
- pkg_free(con);
|
||||||
|
+ _c = (struct my_con *)con;
|
||||||
|
+ SQLFreeHandle(SQL_HANDLE_ENV, _c->env);
|
||||||
|
+ SQLDisconnect(_c->dbc);
|
||||||
|
+ SQLFreeHandle(SQL_HANDLE_DBC, _c->dbc);
|
||||||
|
+ pkg_free(_c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/modules/db_unixodbc/connection.h b/src/modules/db_unixodbc/connection.h
|
||||||
|
index d94f0b4..a37bb1e 100644
|
||||||
|
--- a/src/modules/db_unixodbc/connection.h
|
||||||
|
+++ b/src/modules/db_unixodbc/connection.h
|
||||||
|
@@ -83,7 +83,7 @@ struct my_con *db_unixodbc_new_connection(struct db_id *id);
|
||||||
|
/*
|
||||||
|
* Close the connection and release memory
|
||||||
|
*/
|
||||||
|
-void db_unixodbc_free_connection(struct my_con *con);
|
||||||
|
+void db_unixodbc_free_connection(struct pool_con *con);
|
||||||
|
|
||||||
|
char *db_unixodbc_build_conn_str(const struct db_id *id, char *buf);
|
||||||
|
|
||||||
Loading…
Reference in new issue