[libxml2] Don't include ICU headers in public headers
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Don't include ICU headers in public headers
- Date: Tue, 1 Mar 2022 14:33:10 +0000 (UTC)
commit b66ce0bba83febe2f4d119097a0391f5d886c3b4
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Tue Mar 1 12:39:02 2022 +0100
Don't include ICU headers in public headers
There's no need to make these implementation details public.
configure.ac | 2 --
encoding.c | 14 ++++++++++++++
include/libxml/encoding.h | 21 +++------------------
3 files changed, 17 insertions(+), 20 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 41c39dd1..6d7018eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1443,8 +1443,6 @@ else
else
if test "$with_icu" != "yes" -a "$with_iconv" != "" ; then
CPPFLAGS="${CPPFLAGS} -I$with_icu"
- # Export this since our headers include icu.h
- XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_icu"
fi
AC_CHECK_HEADER(unicode/ucnv.h,
diff --git a/encoding.c b/encoding.c
index 0847934a..bfa5a304 100644
--- a/encoding.c
+++ b/encoding.c
@@ -48,6 +48,20 @@
#include "buf.h"
#include "enc.h"
+#ifdef LIBXML_ICU_ENABLED
+#include <unicode/ucnv.h>
+/* Size of pivot buffer, same as icu/source/common/ucnv.cpp CHUNK_SIZE */
+#define ICU_PIVOT_BUF_SIZE 1024
+typedef struct _uconv_t uconv_t;
+struct _uconv_t {
+ UConverter *uconv; /* for conversion between an encoding and UTF-16 */
+ UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */
+ UChar pivot_buf[ICU_PIVOT_BUF_SIZE];
+ UChar *pivot_source;
+ UChar *pivot_target;
+};
+#endif
+
static xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
static xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
diff --git a/include/libxml/encoding.h b/include/libxml/encoding.h
index c875af6f..77f137f4 100644
--- a/include/libxml/encoding.h
+++ b/include/libxml/encoding.h
@@ -27,9 +27,7 @@
#ifdef LIBXML_ICONV_ENABLED
#include <iconv.h>
#endif
-#ifdef LIBXML_ICU_ENABLED
-#include <unicode/ucnv.h>
-#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -128,19 +126,6 @@ typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
* Block defining the handlers for non UTF-8 encodings.
* If iconv is supported, there are two extra fields.
*/
-#ifdef LIBXML_ICU_ENABLED
-/* Size of pivot buffer, same as icu/source/common/ucnv.cpp CHUNK_SIZE */
-#define ICU_PIVOT_BUF_SIZE 1024
-struct _uconv_t {
- UConverter *uconv; /* for conversion between an encoding and UTF-16 */
- UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */
- UChar pivot_buf[ICU_PIVOT_BUF_SIZE];
- UChar *pivot_source;
- UChar *pivot_target;
-};
-typedef struct _uconv_t uconv_t;
-#endif
-
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
struct _xmlCharEncodingHandler {
@@ -152,8 +137,8 @@ struct _xmlCharEncodingHandler {
iconv_t iconv_out;
#endif /* LIBXML_ICONV_ENABLED */
#ifdef LIBXML_ICU_ENABLED
- uconv_t *uconv_in;
- uconv_t *uconv_out;
+ struct _uconv_t *uconv_in;
+ struct _uconv_t *uconv_out;
#endif /* LIBXML_ICU_ENABLED */
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]