Module: kamailio
Branch: master
Commit: 7f24bc09863220b4c14e2046708c10ff0891c038
URL:
https://github.com/kamailio/kamailio/commit/7f24bc09863220b4c14e2046708c10f…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2024-12-11T00:17:23+01:00
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
---
Modified: src/modules/db_unixodbc/connection.c
Modified: src/modules/db_unixodbc/connection.h
---
Diff:
https://github.com/kamailio/kamailio/commit/7f24bc09863220b4c14e2046708c10f…
Patch:
https://github.com/kamailio/kamailio/commit/7f24bc09863220b4c14e2046708c10f…
---
diff --git a/src/modules/db_unixodbc/connection.c b/src/modules/db_unixodbc/connection.c
index 92b1cdb9ecb..d56f2ac37a5 100644
--- a/src/modules/db_unixodbc/connection.c
+++ b/src/modules/db_unixodbc/connection.c
@@ -179,14 +179,17 @@ 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)
{
+ 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 d94f0b48e07..a37bb1e3906 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);