Explorar o código

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);
Daniel-Constantin Mierla hai 9 meses
pai
achega
8e398b8675
Modificáronse 2 ficheiros con 10 adicións e 8 borrados
  1. 4 4
      src/lib/srdb1/db.c
  2. 6 4
      src/lib/srdb1/db.h

+ 4 - 4
src/lib/srdb1/db.c

@@ -270,7 +270,7 @@ error:
  * 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 @@ err:
  * 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;
 

+ 6 - 4
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 *));
 
 
 /**