Module: kamailio
Branch: 5.8
Commit: b05e8e854bde2ef4ac4c40f227e0794f1a6583ff
URL: 
https://github.com/kamailio/kamailio/commit/b05e8e854bde2ef4ac4c40f227e0794f1a6583ff

Author: Victor Seva <linuxman...@torreviejawireless.org>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-01-23T12:06:18+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

(cherry picked from commit 7f24bc09863220b4c14e2046708c10ff0891c038)

---

Modified: src/modules/db_unixodbc/connection.c
Modified: src/modules/db_unixodbc/connection.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/b05e8e854bde2ef4ac4c40f227e0794f1a6583ff.diff
Patch: 
https://github.com/kamailio/kamailio/commit/b05e8e854bde2ef4ac4c40f227e0794f1a6583ff.patch

---

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);
 

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to