texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/XS/Makefile.am (ConvertXS_la_SOURCES


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/Makefile.am (ConvertXS_la_SOURCES), tp/Texinfo/XS/convert/ConvertXS.xs (text_convert_tree): call directly convert_to_text. remove convert/convert_text.c.
Date: Sat, 13 Jan 2024 17:25:57 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new c64550cfee * tp/Texinfo/XS/Makefile.am (ConvertXS_la_SOURCES), 
tp/Texinfo/XS/convert/ConvertXS.xs (text_convert_tree): call directly 
convert_to_text. remove convert/convert_text.c.
c64550cfee is described below

commit c64550cfee636176615d5bcb3c0961b4f0009be0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jan 13 23:25:59 2024 +0100

    * tp/Texinfo/XS/Makefile.am (ConvertXS_la_SOURCES),
    tp/Texinfo/XS/convert/ConvertXS.xs (text_convert_tree): call directly
    convert_to_text. remove convert/convert_text.c.
    
    * tp/Texinfo/XS/main/convert_utils.c (encoded_input_file_name),
    tp/Texinfo/XS/main/utils.c (get_encoding_conversion, decode_string)
    (encode_string): add some const.
---
 ChangeLog                            | 10 ++++++++
 tp/Texinfo/XS/Makefile.am            |  2 --
 tp/Texinfo/XS/convert/ConvertXS.xs   | 15 ++++++-----
 tp/Texinfo/XS/convert/convert_text.c | 48 ------------------------------------
 tp/Texinfo/XS/convert/convert_text.h | 10 --------
 tp/Texinfo/XS/main/convert_utils.c   |  2 +-
 tp/Texinfo/XS/main/utils.c           |  8 +++---
 tp/Texinfo/XS/main/utils.h           |  6 ++---
 8 files changed, 27 insertions(+), 74 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 63acba5c10..c2903d9068 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-01-13  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/Makefile.am (ConvertXS_la_SOURCES),
+       tp/Texinfo/XS/convert/ConvertXS.xs (text_convert_tree): call directly
+       convert_to_text. remove convert/convert_text.c.
+
+       * tp/Texinfo/XS/main/convert_utils.c (encoded_input_file_name),
+       tp/Texinfo/XS/main/utils.c (get_encoding_conversion, decode_string)
+       (encode_string): add some const.
+
 2024-01-13  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/Makefile.am (ConvertXS_la_SOURCES),
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index 3763c03ad4..ebe57d70fb 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -379,8 +379,6 @@ ConvertXS_la_SOURCES = \
                        convert/call_html_perl_function.c \
                        convert/get_html_perl_info.c \
                        convert/get_html_perl_info.h \
-                       convert/convert_text.h \
-                       convert/convert_text.c \
                        convert/converter.h \
                        convert/converter.c \
                        convert/convert_html.h \
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index c15a99bbd4..f58f0511da 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -37,7 +37,6 @@
 #include "converter_types.h"
 #include "builtin_commands.h"
 #include "errors.h"
-#include "convert_text.h"
 #include "convert_to_text.h"
 #include "convert_to_texinfo.h"
 #include "indices_in_conversion.h"
@@ -306,21 +305,25 @@ SV *
 text_convert_tree (SV *options_in, SV *tree_in)
     PREINIT:
         DOCUMENT *document = 0;
-        TEXT_OPTIONS *text_options = 0;
     CODE:
         /* The caller checks that there is a descriptor */
         document = get_sv_tree_document (tree_in, "text_convert_tree");
-        text_options = copy_sv_options_for_convert_text (options_in);
         if (document)
           {
-            /* text_options is destroyed in text_convert */
-            char *result = text_convert (document, text_options);
+            char *result;
+            TEXT_OPTIONS *text_options
+               = copy_sv_options_for_convert_text (options_in);
+
+            text_options->document_descriptor = document->descriptor;
+
+            result = convert_to_text (document->tree, text_options);
+
+            destroy_text_options (text_options);
             RETVAL = newSVpv_utf8 (result, 0);
             free (result);
           }
         else
           {
-            destroy_text_options (text_options);
             RETVAL = newSV(0);
           }
     OUTPUT:
diff --git a/tp/Texinfo/XS/convert/convert_text.c 
b/tp/Texinfo/XS/convert/convert_text.c
deleted file mode 100644
index d1f6a48c95..0000000000
--- a/tp/Texinfo/XS/convert/convert_text.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright 2023 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-#include <string.h>
-
-#include "converter_types.h"
-#include "convert_to_text.h"
-#include "convert_text.h"
-
-char *
-text_convert (DOCUMENT *document, TEXT_OPTIONS *text_options)
-{
-  char *result;
-  /* FIXME warn/error?  Or in the .xs code? */
-  if (!document)
-    {
-      return strdup ("");
-    }
-
-  if (!text_options)
-    text_options = new_text_options ();
-
-  text_options->document_descriptor = document->descriptor;
-
-  result = convert_to_text (document->tree, text_options);
-
-  /*
-  fprintf (stderr, "TEXT: using XS: '%.100s'\n", result);
-   */
-  destroy_text_options (text_options);
-
-  return result;
-}
-
diff --git a/tp/Texinfo/XS/convert/convert_text.h 
b/tp/Texinfo/XS/convert/convert_text.h
deleted file mode 100644
index 75575ad59f..0000000000
--- a/tp/Texinfo/XS/convert/convert_text.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* convert_text.h - definitions for convert_text.c */
-#ifndef CONVERT_TEXT_H
-#define CONVERT_TEXT_H
-
-#include "document_types.h"
-#include "convert_to_text.h"
-
-char *text_convert (DOCUMENT *document, TEXT_OPTIONS *options);
-
-#endif
diff --git a/tp/Texinfo/XS/main/convert_utils.c 
b/tp/Texinfo/XS/main/convert_utils.c
index 3fc8b948e0..3f505852fe 100644
--- a/tp/Texinfo/XS/main/convert_utils.c
+++ b/tp/Texinfo/XS/main/convert_utils.c
@@ -269,7 +269,7 @@ encoded_input_file_name (OPTIONS *options,
                          const SOURCE_INFO *source_info)
 {
   char *result;
-  char *encoding = 0;
+  const char *encoding = 0;
   int status;
 
   if (options && options->INPUT_FILE_NAME_ENCODING.string)
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index dc0cdf9dd9..aed55a74c5 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -288,10 +288,10 @@ word_bytes_len_multibyte (const char *text)
 /* conversion to or from utf-8 should always be set before other
    conversion */
 ENCODING_CONVERSION *
-get_encoding_conversion (char *encoding,
+get_encoding_conversion (const char *encoding,
                          ENCODING_CONVERSION_LIST *encodings_list)
 {
-  char *conversion_encoding = encoding;
+  const char *conversion_encoding = encoding;
   int encoding_index = -1;
 
   /* should correspond to
@@ -458,7 +458,7 @@ encode_with_iconv (iconv_t our_iconv, char *s, const 
SOURCE_INFO *source_info)
 }
 
 char *
-decode_string (char *input_string, char *encoding, int *status,
+decode_string (char *input_string, const char *encoding, int *status,
                const SOURCE_INFO *source_info)
 {
   char *result;
@@ -480,7 +480,7 @@ decode_string (char *input_string, char *encoding, int 
*status,
 }
 
 char *
-encode_string (char *input_string, char *encoding, int *status,
+encode_string (char *input_string, const char *encoding, int *status,
                const SOURCE_INFO *source_info)
 {
   char *result;
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index a3657badf8..cd52ebba70 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -204,14 +204,14 @@ OPTION *get_command_option (OPTIONS *options, enum 
command_id cmd);
 void add_include_directory (char *filename, STRING_LIST *include_dirs_list);
 char *locate_include_file (char *filename, STRING_LIST *include_dirs_list);
 
-ENCODING_CONVERSION *get_encoding_conversion (char *encoding,
+ENCODING_CONVERSION *get_encoding_conversion (const char *encoding,
                                     ENCODING_CONVERSION_LIST *encodings_list);
 char *encode_with_iconv (iconv_t our_iconv,  char *s,
                          const SOURCE_INFO *source_info);
 void reset_encoding_list (ENCODING_CONVERSION_LIST *encodings_list);
-char *decode_string (char *input_string, char *encoding, int *status,
+char *decode_string (char *input_string, const char *encoding, int *status,
                      const SOURCE_INFO *source_info);
-char *encode_string (char *input_string, char *encoding, int *status,
+char *encode_string (char *input_string, const char *encoding, int *status,
                      const SOURCE_INFO *source_info);
 
 EXPANDED_FORMAT *new_expanded_formats (void);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]