[sr-dev] git:5.1:105aa05e: db_mysql: replaced my_bool with bool

Henning Westerholt hw at kamailio.org
Wed Aug 15 21:22:59 CEST 2018


Module: kamailio
Branch: 5.1
Commit: 105aa05e05ef98f1f27c708b5ee9442fe51b7ff8
URL: https://github.com/kamailio/kamailio/commit/105aa05e05ef98f1f27c708b5ee9442fe51b7ff8

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2018-08-15T21:22:44+02:00

db_mysql: replaced my_bool with bool

- mysql 8.0.1 removed my_bool and suggests use of bool:
  * https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-1.html
- use stdbool.h, it defines bool in C99, which should be old enough to
be everywhere, otherwise it may require some ifdefs to get it for older
but still alive systems
- reported by GH #1602

(cherry picked from commit 1736723cc2a15bb75c26711675712a966161b722)

---

Modified: src/modules/db_mysql/km_my_con.c
Modified: src/modules/db_mysql/my_fld.h

---

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

---

diff --git a/src/modules/db_mysql/km_my_con.c b/src/modules/db_mysql/km_my_con.c
index 38e6875a19..242329e295 100644
--- a/src/modules/db_mysql/km_my_con.c
+++ b/src/modules/db_mysql/km_my_con.c
@@ -29,6 +29,7 @@
 #include "km_my_con.h"
 #include "km_db_mysql.h"
 #include <mysql.h>
+#include <stdbool.h>
 #include "../../core/mem/mem.h"
 #include "../../core/dprint.h"
 #include "../../core/ut.h"
@@ -44,7 +45,7 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
 	char *host, *grp, *egrp;
 	unsigned int connection_flag = 0;
 #if MYSQL_VERSION_ID > 50012
-	my_bool rec;
+	bool rec;
 #endif
 
 	if (!id) {
diff --git a/src/modules/db_mysql/my_fld.h b/src/modules/db_mysql/my_fld.h
index 4450a26d06..539a4df699 100644
--- a/src/modules/db_mysql/my_fld.h
+++ b/src/modules/db_mysql/my_fld.h
@@ -29,12 +29,13 @@
 #include "../../lib/srdb2/db_drv.h"
 #include "../../lib/srdb2/db_fld.h"
 #include <mysql.h>
+#include <stdbool.h>
 
 struct my_fld {
 	db_drv_t gen;
 
 	char* name;
-	my_bool is_null;
+	bool is_null;
 	MYSQL_TIME time;
 	unsigned long length;
 	str buf;




More information about the sr-dev mailing list