From 6af66cadba053750b3ebb090c0141bfdf8f8c320 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sat, 17 Aug 2019 16:14:01 +0300 Subject: [PATCH] Merge maxmind db config files. Use macros to identify differences and get rid of unnecessary options. --- config/common/maxminddb_config.h | 43 ++++++- config/mingw32/maxminddb_config.h | 193 ------------------------------ config/mingw64/maxminddb_config.h | 193 ------------------------------ external/MaxmindDB/maxminddb.c | 8 +- 4 files changed, 43 insertions(+), 394 deletions(-) delete mode 100644 config/mingw32/maxminddb_config.h delete mode 100644 config/mingw64/maxminddb_config.h diff --git a/config/common/maxminddb_config.h b/config/common/maxminddb_config.h index 4404e776..6d69ad47 100644 --- a/config/common/maxminddb_config.h +++ b/config/common/maxminddb_config.h @@ -3,12 +3,49 @@ #ifndef MMDB_UINT128_USING_MODE /* Define as 1 if we we use unsigned int __atribute__ ((__mode__(TI))) for uint128 values */ -#define MMDB_UINT128_USING_MODE 1 +#if __x86_64__ + #define MMDB_UINT128_USING_MODE 1 +#else + #define MMDB_UINT128_USING_MODE 0 +#endif + #endif #ifndef MMDB_UINT128_IS_BYTE_ARRAY -/* Define as 1 if we don't have an unsigned __int128 type */ -#undef MMDB_UINT128_IS_BYTE_ARRAY +/* Define as 1 if we don't have an unsigned __int128 type */\ +#if __x86_64__ + #undef MMDB_UINT128_IS_BYTE_ARRAY +#else + #define MMDB_UINT128_IS_BYTE_ARRAY 1 #endif +#endif + +/* Name of package */ +#define PACKAGE "libmaxminddb" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "support@maxmind.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libmaxminddb" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libmaxminddb 1.3.2" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libmaxminddb" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.3.2" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "1.3.2" + #endif /* MAXMINDDB_CONFIG_H */ diff --git a/config/mingw32/maxminddb_config.h b/config/mingw32/maxminddb_config.h deleted file mode 100644 index 1c52aa96..00000000 --- a/config/mingw32/maxminddb_config.h +++ /dev/null @@ -1,193 +0,0 @@ -/* include/maxminddb_config.h. Generated from maxminddb_config.h.in by configure. */ -#ifndef MAXMINDDB_CONFIG_H -#define MAXMINDDB_CONFIG_H - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ARPA_INET_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 - -/* Define to 1 if the system has the type `boolean'. */ -/* #undef HAVE_BOOLEAN */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLFCN_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIBGEN_H 1 - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MATH_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have a working `mmap' system call. */ -/* #undef HAVE_MMAP */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETDB_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETINET_IN_H */ - -/* Has an open_memstream() function */ -/* #undef HAVE_OPEN_MEMSTREAM */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_MMAN_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SOCKET_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Missing the unsigned __int128 type */ -#define MMDB_UINT128_IS_BYTE_ARRAY 1 - -/* int128 types are available with __attribute__((mode(TI))) */ -/* #undef MMDB_UINT128_USING_MODE */ - -/* Name of package */ -#define PACKAGE "libmaxminddb" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "support@maxmind.com" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "libmaxminddb" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libmaxminddb 1.3.2" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libmaxminddb" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.3.2" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "1.3.2" - -/* Define for Solaris 2.5.1 so the uint32_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT32_T */ - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT64_T */ - -/* Define for Solaris 2.5.1 so the uint8_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT8_T */ - -/* Define to rpl_malloc if the replacement function should be used. */ -/* #undef malloc */ - -/* Define to `long int' if does not define. */ -/* #undef off_t */ - -/* Define to the equivalent of the C99 'restrict' keyword, or to - nothing if this is not supported. Do not define if restrict is - supported directly. */ -#define restrict __restrict -/* Work around a bug in Sun C++: it does not support _Restrict or - __restrict__, even though the corresponding Sun C compiler ends up with - "#define restrict _Restrict" or "#define restrict __restrict__" in the - previous line. Perhaps some future version of Sun C++ will work with - restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ -#if defined __SUNPRO_CC && !defined __RESTRICT -# define _Restrict -# define __restrict__ -#endif - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to `int' if does not define. */ -/* #undef ssize_t */ - -/* Define to the type of an unsigned integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint32_t */ - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint64_t */ - -/* Define to the type of an unsigned integer type of width exactly 8 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint8_t */ - -#ifndef MMDB_UINT128_USING_MODE -/* Define as 1 if we we use unsigned int __atribute__ ((__mode__(TI))) for uint128 values */ -#define MMDB_UINT128_USING_MODE 0 -#endif - -#ifndef MMDB_UINT128_IS_BYTE_ARRAY -/* Define as 1 if we don't have an unsigned __int128 type */ -#define MMDB_UINT128_IS_BYTE_ARRAY 1 -#endif - -#endif /* MAXMINDDB_CONFIG_H */ diff --git a/config/mingw64/maxminddb_config.h b/config/mingw64/maxminddb_config.h deleted file mode 100644 index 8f11b9c2..00000000 --- a/config/mingw64/maxminddb_config.h +++ /dev/null @@ -1,193 +0,0 @@ -/* include/maxminddb_config.h. Generated from maxminddb_config.h.in by configure. */ -#ifndef MAXMINDDB_CONFIG_H -#define MAXMINDDB_CONFIG_H - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ARPA_INET_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 - -/* Define to 1 if the system has the type `boolean'. */ -/* #undef HAVE_BOOLEAN */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLFCN_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIBGEN_H 1 - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MATH_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have a working `mmap' system call. */ -/* #undef HAVE_MMAP */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETDB_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETINET_IN_H */ - -/* Has an open_memstream() function */ -/* #undef HAVE_OPEN_MEMSTREAM */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_MMAN_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SOCKET_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Missing the unsigned __int128 type */ -#define MMDB_UINT128_IS_BYTE_ARRAY 0 - -/* int128 types are available with __attribute__((mode(TI))) */ -/* #undef MMDB_UINT128_USING_MODE */ - -/* Name of package */ -#define PACKAGE "libmaxminddb" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "support@maxmind.com" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "libmaxminddb" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libmaxminddb 1.3.2" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libmaxminddb" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.3.2" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "1.3.2" - -/* Define for Solaris 2.5.1 so the uint32_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT32_T */ - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT64_T */ - -/* Define for Solaris 2.5.1 so the uint8_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT8_T */ - -/* Define to rpl_malloc if the replacement function should be used. */ -/* #undef malloc */ - -/* Define to `long int' if does not define. */ -/* #undef off_t */ - -/* Define to the equivalent of the C99 'restrict' keyword, or to - nothing if this is not supported. Do not define if restrict is - supported directly. */ -#define restrict __restrict -/* Work around a bug in Sun C++: it does not support _Restrict or - __restrict__, even though the corresponding Sun C compiler ends up with - "#define restrict _Restrict" or "#define restrict __restrict__" in the - previous line. Perhaps some future version of Sun C++ will work with - restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ -#if defined __SUNPRO_CC && !defined __RESTRICT -# define _Restrict -# define __restrict__ -#endif - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to `int' if does not define. */ -/* #undef ssize_t */ - -/* Define to the type of an unsigned integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint32_t */ - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint64_t */ - -/* Define to the type of an unsigned integer type of width exactly 8 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint8_t */ - -#ifndef MMDB_UINT128_USING_MODE -/* Define as 1 if we we use unsigned int __atribute__ ((__mode__(TI))) for uint128 values */ -#define MMDB_UINT128_USING_MODE 1 -#endif - -#ifndef MMDB_UINT128_IS_BYTE_ARRAY -/* Define as 1 if we don't have an unsigned __int128 type */ -#define MMDB_UINT128_IS_BYTE_ARRAY 0 -#endif - -#endif /* MAXMINDDB_CONFIG_H */ diff --git a/external/MaxmindDB/maxminddb.c b/external/MaxmindDB/maxminddb.c index a4000392..93ab4f7c 100644 --- a/external/MaxmindDB/maxminddb.c +++ b/external/MaxmindDB/maxminddb.c @@ -1,6 +1,5 @@ -#if HAVE_CONFIG_H -#include -#endif +#include + #include "data-pool.h" #include "maxminddb.h" #include "maxminddb-compat-util.h" @@ -1962,8 +1961,7 @@ LOCAL void free_descriptions_metadata(MMDB_s *mmdb) const char *MMDB_lib_version(void) { - //return PACKAGE_VERSION; - return "1.3.2"; // Quick and dirty patch + return PACKAGE_VERSION; } int MMDB_dump_entry_data_list(FILE *const stream,