[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Tue, 20 Feb 2024 15:48:22 -0500 (EST) |
branch: master
commit 35c97d96d1790a29b3cdf24e52efa9009e383493
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Feb 20 20:41:11 2024 +0000
* tp/Texinfo/XS/main/unicode.c (utf8_from_string, string_from_utf8):
Replace calls to u8_strconv_from_encoding and u8_strconv_to_encoding
with call to strdup followed by cast.
(format_eight_bit_accents_stack): Replace call to
u8_strconv_from_encoding with call to utf8_from_string.
This eliminates the requirement for gnulib uniconv modules, which
indirectly required the iconv_open module.
---
ChangeLog | 13 ++++++++++++-
tp/Texinfo/XS/convert/convert_html.c | 1 -
tp/Texinfo/XS/convert/converter.c | 1 -
tp/Texinfo/XS/main/manipulate_indices.c | 1 -
tp/Texinfo/XS/main/manipulate_tree.c | 1 -
tp/Texinfo/XS/main/node_name_normalization.c | 1 -
tp/Texinfo/XS/main/unicode.c | 18 +++++++++++-------
tp/Texinfo/XS/main/utils.c | 1 -
tp/Texinfo/XS/parsetexi/def.c | 1 -
tp/Texinfo/XS/structuring_transfo/transformations.c | 1 -
10 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 81cc46515f..9b63a73bc0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,15 @@
-2024-02-19 Gavin Smith <gavinsmith0123@gmail.com>, and
+2024-02-20 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/XS/main/unicode.c (utf8_from_string, string_from_utf8):
+ Replace calls to u8_strconv_from_encoding and u8_strconv_to_encoding
+ with call to strdup followed by cast.
+ (format_eight_bit_accents_stack): Replace call to
+ u8_strconv_from_encoding with call to utf8_from_string.
+
+ This eliminates the requirement for gnulib uniconv modules, which
+ indirectly required the iconv_open module.
+
+2024-02-20 Gavin Smith <gavinsmith0123@gmail.com>, and
Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/Plaintext.pm (convert):
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 92b30012bd..ac3a57c6b2 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -22,7 +22,6 @@
#include <ctype.h>
#include <stdarg.h>
#include <iconv.h>
-#include "uniconv.h"
#include <unistr.h>
#include <unictype.h>
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index 98da0ecaee..26165dbb57 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -22,7 +22,6 @@
#include <stddef.h>
#include <inttypes.h>
#include <unistr.h>
-#include <uniconv.h>
#include <unictype.h>
#include "command_ids.h"
diff --git a/tp/Texinfo/XS/main/manipulate_indices.c
b/tp/Texinfo/XS/main/manipulate_indices.c
index 0a880479b7..cff5983ca5 100644
--- a/tp/Texinfo/XS/main/manipulate_indices.c
+++ b/tp/Texinfo/XS/main/manipulate_indices.c
@@ -19,7 +19,6 @@
#include <stdio.h>
#include <locale.h>
#include <ctype.h>
-#include "uniconv.h"
#include "unictype.h"
#include "unistr.h"
diff --git a/tp/Texinfo/XS/main/manipulate_tree.c
b/tp/Texinfo/XS/main/manipulate_tree.c
index 3003a6be09..ca92e02622 100644
--- a/tp/Texinfo/XS/main/manipulate_tree.c
+++ b/tp/Texinfo/XS/main/manipulate_tree.c
@@ -19,7 +19,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
-#include "uniconv.h"
#include "unistr.h"
#include "tree_types.h"
diff --git a/tp/Texinfo/XS/main/node_name_normalization.c
b/tp/Texinfo/XS/main/node_name_normalization.c
index 3f20b916ec..e3f61f1614 100644
--- a/tp/Texinfo/XS/main/node_name_normalization.c
+++ b/tp/Texinfo/XS/main/node_name_normalization.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <stdio.h>
#include <ctype.h>
-#include "uniconv.h"
#include "unistr.h"
/*
#include "xvasprintf.h"
diff --git a/tp/Texinfo/XS/main/unicode.c b/tp/Texinfo/XS/main/unicode.c
index 473274179c..574f0181b3 100644
--- a/tp/Texinfo/XS/main/unicode.c
+++ b/tp/Texinfo/XS/main/unicode.c
@@ -21,7 +21,6 @@
#include <stdlib.h>
#include <ctype.h>
#include <stdbool.h>
-#include "uniconv.h"
#include "unictype.h"
#include "uninorm.h"
#include "unistr.h"
@@ -40,14 +39,21 @@
uint8_t *
utf8_from_string (const char *text)
{
- /* TODO error checking? Or cast (uint8_t *) instead of conversion? */
- return u8_strconv_from_encoding (text, "UTF-8", iconveh_question_mark);
+ /* TODO error checking? */
+ return (uint8_t *) strdup (text);
+
+ /* With uniconv/* gnulib module this could be the following, although
+ this pulls in quite a few other gnulib module dependencies. */
+ /* return u8_strconv_from_encoding (text, "UTF-8", iconveh_question_mark); */
}
char *
string_from_utf8 (const uint8_t *encoded_u8)
{
- return u8_strconv_to_encoding (encoded_u8, "UTF-8", iconveh_question_mark);
+ return (char *) strdup (encoded_u8);
+ /* With uniconv/* gnulib module this could be the following, although
+ this pulls in quite a few other gnulib module dependencies. */
+ /* return u8_strconv_to_encoding (encoded_u8, "UTF-8",
iconveh_question_mark); */
}
char *
@@ -232,9 +238,7 @@ format_eight_bit_accents_stack (CONVERTER *self, const char
*text,
if (!results_stack[j])
break;
- uint8_t *encoded_u8 = u8_strconv_from_encoding (
- results_stack[j], "UTF-8",
- iconveh_question_mark);
+ uint8_t *encoded_u8 = utf8_from_string (results_stack[j]);
ucs4_t first_char;
u8_next (&first_char, encoded_u8);
free (encoded_u8);
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index e10d954e87..456a3d2fb3 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -24,7 +24,6 @@
#include <iconv.h>
#include <errno.h>
#include <stdbool.h>
-#include "uniconv.h"
#include "unistr.h"
#include "unicase.h"
#include "uniwidth.h"
diff --git a/tp/Texinfo/XS/parsetexi/def.c b/tp/Texinfo/XS/parsetexi/def.c
index 21bbee40f4..5e21b52eda 100644
--- a/tp/Texinfo/XS/parsetexi/def.c
+++ b/tp/Texinfo/XS/parsetexi/def.c
@@ -17,7 +17,6 @@
#include <string.h>
#include <stdbool.h>
#include <iconv.h>
-#include "uniconv.h"
#include "unistr.h"
/* for isolate_last_space and global_documentlanguage */
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.c
b/tp/Texinfo/XS/structuring_transfo/transformations.c
index 821c6cba4f..ee740add21 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.c
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.c
@@ -23,7 +23,6 @@
#include <string.h>
#include <iconv.h>
#include <stdbool.h>
-#include "uniconv.h"
#include "unistr.h"
#include "element_types.h"