From a0914a0ad18728e4b2b1632198d50d8b001a8890 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 4 Dec 2022 21:53:26 +0900 Subject: MYSQL: Improve header includes with respect to compat handling Move the gnunet_private_config.h-dependant compatibility fix into gnunet_mysql_compat.h which is only included by implementations. May be reused by external users of gnunet_my_lib.h but they should check their platform on which types to use. --- src/include/Makefile.am | 1 + src/include/gnunet_mhd_compat.h | 2 +- src/include/gnunet_my_lib.h | 7 ++++++- src/include/gnunet_mysql_lib.h | 11 ----------- 4 files changed, 8 insertions(+), 13 deletions(-) (limited to 'src/include') diff --git a/src/include/Makefile.am b/src/include/Makefile.am index ca1aff6e1..86bcb0ec1 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -77,6 +77,7 @@ gnunetinclude_HEADERS = \ gnunet_mst_lib.h \ gnunet_mq_lib.h \ gnunet_my_lib.h \ + gnunet_mysql_compat.h \ gnunet_mysql_lib.h \ gnunet_namecache_plugin.h \ gnunet_namecache_service.h \ diff --git a/src/include/gnunet_mhd_compat.h b/src/include/gnunet_mhd_compat.h index ca41fb95a..7ef297c2f 100644 --- a/src/include/gnunet_mhd_compat.h +++ b/src/include/gnunet_mhd_compat.h @@ -36,7 +36,7 @@ #else -/** +** * Data type to use for functions return an "MHD result". */ #define MHD_RESULT int diff --git a/src/include/gnunet_my_lib.h b/src/include/gnunet_my_lib.h index 68ce16286..283b2f7e6 100644 --- a/src/include/gnunet_my_lib.h +++ b/src/include/gnunet_my_lib.h @@ -18,11 +18,12 @@ SPDX-License-Identifier: AGPL3.0-or-later */ /** - * @addtogroup lib_extra + * @addtogroup lib_extra * @{ * * @author Christian Grothoff * @author Christophe Genevey + * @author Martin Schanzenbach * * @file * Helper library to access a MySQL database @@ -39,6 +40,10 @@ #include "gnunet_mysql_lib.h" #include +#ifndef MYSQL_BOOL +#error "You need to define MYSQL_BOOL. See (or include) gnunet_mysql_compat.h" +#endif + #ifdef __cplusplus extern "C" { diff --git a/src/include/gnunet_mysql_lib.h b/src/include/gnunet_mysql_lib.h index 88408890b..52be3ff11 100644 --- a/src/include/gnunet_mysql_lib.h +++ b/src/include/gnunet_mysql_lib.h @@ -42,17 +42,6 @@ extern "C" #endif #endif -#ifndef LIBMARIADB -#ifdef HAVE_MYSQL8 && !LIBMARIADB - typedef bool MYSQL_BOOL; -#else - typedef my_bool MYSQL_BOOL; //MySQL < 8 wants this -#endif -#else - typedef my_bool MYSQL_BOOL; //MariaDB still uses my_bool -#endif - - /** * Mysql context. */ -- cgit v1.2.3