Skip to content

Commit cfd3929

Browse files
committed
Merge pull request #3633 from lemenkov/strict_type_checking
Fix FTBFS with recent GCC (cherry picked from commit 4f1059b)
1 parent 2ef56f0 commit cfd3929

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

db/db.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "db_cap.h"
4747
#include "db_row.h"
4848
#include "db_ps.h"
49+
#include "db_pool.h"
4950
#include "../globals.h"
5051

5152
extern stat_var *sql_total_queries;
@@ -407,7 +408,7 @@ int db_bind_mod(const str* mod, db_func_t* dbf);
407408
* \return returns a pointer to the db_con_t representing the connection if it was
408409
successful, otherwise 0 is returned.
409410
*/
410-
db_con_t* db_do_init(const str* url, void* (*new_connection)());
411+
db_con_t* db_do_init(const str* url, void* (*new_connection)(const struct db_id *));
411412

412413

413414
/**
@@ -418,7 +419,7 @@ db_con_t* db_do_init(const str* url, void* (*new_connection)());
418419
* \param _h database connection handle
419420
* \param (*free_connection) Pointer to the db specifc free_connection method
420421
*/
421-
void db_do_close(db_con_t* _h, void (*free_connection)());
422+
void db_do_close(db_con_t* _h, void (*free_connection)(struct pool_con*));
422423

423424

424425
/**

modules/db_unixodbc/db_con.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,13 @@ struct my_con* db_unixodbc_new_connection(struct db_id* id)
190190
/*
191191
* Close the connection and release memory
192192
*/
193-
void db_unixodbc_free_connection(struct my_con* con)
193+
void db_unixodbc_free_connection(struct pool_con* con)
194194
{
195-
if (!con) return;
196-
SQLFreeHandle(SQL_HANDLE_ENV, con->env);
197-
SQLDisconnect(con->dbc);
198-
SQLFreeHandle(SQL_HANDLE_DBC, con->dbc);
195+
struct my_con* mcon = (struct my_con*)con;
196+
if (!mcon) return;
197+
SQLFreeHandle(SQL_HANDLE_ENV, mcon->env);
198+
SQLDisconnect(mcon->dbc);
199+
SQLFreeHandle(SQL_HANDLE_DBC, mcon->dbc);
199200
pkg_free(con);
200201
}
201202

modules/db_unixodbc/db_con.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct my_con* db_unixodbc_new_connection(struct db_id* id);
8686
/*
8787
* Close the connection and release memory
8888
*/
89-
void db_unixodbc_free_connection(struct my_con* con);
89+
void db_unixodbc_free_connection(struct pool_con* con);
9090

9191
char *db_unixodbc_build_conn_str(const struct db_id* id, char *buf);
9292

0 commit comments

Comments
 (0)