diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-12-04 21:53:26 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-12-04 21:53:26 +0900 |
commit | a0914a0ad18728e4b2b1632198d50d8b001a8890 (patch) | |
tree | 6107b8b52bcadfaf192b3e1be6d430db410a6644 /src | |
parent | e8f8d28e93421c6d26014f5f8b7e6be133246165 (diff) | |
download | gnunet-a0914a0ad18728e4b2b1632198d50d8b001a8890.tar.gz gnunet-a0914a0ad18728e4b2b1632198d50d8b001a8890.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/datastore/plugin_datastore_mysql.c | 1 | ||||
-rw-r--r-- | src/include/Makefile.am | 1 | ||||
-rw-r--r-- | src/include/gnunet_mhd_compat.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_my_lib.h | 7 | ||||
-rw-r--r-- | src/include/gnunet_mysql_lib.h | 11 | ||||
-rw-r--r-- | src/my/my.c | 1 | ||||
-rw-r--r-- | src/my/my_query_helper.c | 1 | ||||
-rw-r--r-- | src/my/my_result_helper.c | 3 | ||||
-rw-r--r-- | src/mysql/mysql.c | 1 | ||||
-rw-r--r-- | src/regex/gnunet-regex-simulation-profiler.c | 1 |
10 files changed, 15 insertions, 14 deletions
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index 216a6faa4..f62c51778 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c | |||
@@ -121,6 +121,7 @@ | |||
121 | #include "gnunet_datastore_plugin.h" | 121 | #include "gnunet_datastore_plugin.h" |
122 | #include "gnunet_util_lib.h" | 122 | #include "gnunet_util_lib.h" |
123 | #include "gnunet_mysql_lib.h" | 123 | #include "gnunet_mysql_lib.h" |
124 | #include "gnunet_mysql_compat.h" | ||
124 | #include "gnunet_my_lib.h" | 125 | #include "gnunet_my_lib.h" |
125 | 126 | ||
126 | #define MAX_DATUM_SIZE 65536 | 127 | #define MAX_DATUM_SIZE 65536 |
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 = \ | |||
77 | gnunet_mst_lib.h \ | 77 | gnunet_mst_lib.h \ |
78 | gnunet_mq_lib.h \ | 78 | gnunet_mq_lib.h \ |
79 | gnunet_my_lib.h \ | 79 | gnunet_my_lib.h \ |
80 | gnunet_mysql_compat.h \ | ||
80 | gnunet_mysql_lib.h \ | 81 | gnunet_mysql_lib.h \ |
81 | gnunet_namecache_plugin.h \ | 82 | gnunet_namecache_plugin.h \ |
82 | gnunet_namecache_service.h \ | 83 | 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 @@ | |||
36 | 36 | ||
37 | #else | 37 | #else |
38 | 38 | ||
39 | /** | 39 | ** |
40 | * Data type to use for functions return an "MHD result". | 40 | * Data type to use for functions return an "MHD result". |
41 | */ | 41 | */ |
42 | #define MHD_RESULT int | 42 | #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 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @addtogroup lib_extra | 21 | * @addtogroup lib_extra |
22 | * @{ | 22 | * @{ |
23 | * | 23 | * |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * @author Christophe Genevey | 25 | * @author Christophe Genevey |
26 | * @author Martin Schanzenbach | ||
26 | * | 27 | * |
27 | * @file | 28 | * @file |
28 | * Helper library to access a MySQL database | 29 | * Helper library to access a MySQL database |
@@ -39,6 +40,10 @@ | |||
39 | #include "gnunet_mysql_lib.h" | 40 | #include "gnunet_mysql_lib.h" |
40 | #include <mysql/mysql.h> | 41 | #include <mysql/mysql.h> |
41 | 42 | ||
43 | #ifndef MYSQL_BOOL | ||
44 | #error "You need to define MYSQL_BOOL. See (or include) gnunet_mysql_compat.h" | ||
45 | #endif | ||
46 | |||
42 | #ifdef __cplusplus | 47 | #ifdef __cplusplus |
43 | extern "C" | 48 | extern "C" |
44 | { | 49 | { |
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" | |||
42 | #endif | 42 | #endif |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #ifndef LIBMARIADB | ||
46 | #ifdef HAVE_MYSQL8 && !LIBMARIADB | ||
47 | typedef bool MYSQL_BOOL; | ||
48 | #else | ||
49 | typedef my_bool MYSQL_BOOL; //MySQL < 8 wants this | ||
50 | #endif | ||
51 | #else | ||
52 | typedef my_bool MYSQL_BOOL; //MariaDB still uses my_bool | ||
53 | #endif | ||
54 | |||
55 | |||
56 | /** | 45 | /** |
57 | * Mysql context. | 46 | * Mysql context. |
58 | */ | 47 | */ |
diff --git a/src/my/my.c b/src/my/my.c index 468a4a47c..b667af4f9 100644 --- a/src/my/my.c +++ b/src/my/my.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include <mysql/mysql.h> | 27 | #include <mysql/mysql.h> |
28 | #include "gnunet_mysql_compat.h" | ||
28 | #include "gnunet_my_lib.h" | 29 | #include "gnunet_my_lib.h" |
29 | 30 | ||
30 | 31 | ||
diff --git a/src/my/my_query_helper.c b/src/my/my_query_helper.c index e44caad91..c12970876 100644 --- a/src/my/my_query_helper.c +++ b/src/my/my_query_helper.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include <mysql/mysql.h> | 27 | #include <mysql/mysql.h> |
28 | #include "gnunet_mysql_compat.h" | ||
28 | #include "gnunet_my_lib.h" | 29 | #include "gnunet_my_lib.h" |
29 | 30 | ||
30 | 31 | ||
diff --git a/src/my/my_result_helper.c b/src/my/my_result_helper.c index e500c0b27..ceebc6f37 100644 --- a/src/my/my_result_helper.c +++ b/src/my/my_result_helper.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_mysql_compat.h" | ||
28 | #include "gnunet_my_lib.h" | 29 | #include "gnunet_my_lib.h" |
29 | 30 | ||
30 | 31 | ||
@@ -524,7 +525,7 @@ pre_extract_string (void *cls, | |||
524 | 525 | ||
525 | 526 | ||
526 | /** | 527 | /** |
527 | * Check size of extracted fixed size data from a Mysql database | 528 | * Check size of extracted fixed size data from a Mysql database |
528 | * | 529 | * |
529 | * @param cls closure | 530 | * @param cls closure |
530 | * @param[in,out] rs | 531 | * @param[in,out] rs |
diff --git a/src/mysql/mysql.c b/src/mysql/mysql.c index 4c701905c..056c2f07f 100644 --- a/src/mysql/mysql.c +++ b/src/mysql/mysql.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include <mysql/mysql.h> | 26 | #include <mysql/mysql.h> |
27 | #include "gnunet_mysql_lib.h" | 27 | #include "gnunet_mysql_lib.h" |
28 | #include "gnunet_mysql_compat.h" | ||
28 | 29 | ||
29 | /** | 30 | /** |
30 | * Maximum number of supported parameters for a prepared | 31 | * Maximum number of supported parameters for a prepared |
diff --git a/src/regex/gnunet-regex-simulation-profiler.c b/src/regex/gnunet-regex-simulation-profiler.c index ab6d65d58..abdb1abeb 100644 --- a/src/regex/gnunet-regex-simulation-profiler.c +++ b/src/regex/gnunet-regex-simulation-profiler.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "gnunet_util_lib.h" | 32 | #include "gnunet_util_lib.h" |
33 | #include "regex_internal_lib.h" | 33 | #include "regex_internal_lib.h" |
34 | #include "gnunet_mysql_lib.h" | 34 | #include "gnunet_mysql_lib.h" |
35 | #include "gnunet_mysql_compat.h" | ||
35 | #include "gnunet_my_lib.h" | 36 | #include "gnunet_my_lib.h" |
36 | #include <mysql/mysql.h> | 37 | #include <mysql/mysql.h> |
37 | 38 | ||