texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/convert/converter.c (converter_co


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/converter.c (converter_converter): apply directly user_conf argument instead of copying first. Add const.
Date: Wed, 04 Dec 2024 03:01:25 -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 0ea54dd6e8 * tp/Texinfo/XS/convert/converter.c (converter_converter): 
apply directly user_conf argument instead of copying first. Add const.
0ea54dd6e8 is described below

commit 0ea54dd6e80082471fd9d5f56b33a404108f78b5
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Dec 4 09:01:15 2024 +0100

    * tp/Texinfo/XS/convert/converter.c (converter_converter): apply
    directly user_conf argument instead of copying first.
    Add const.
    
    * tp/Texinfo/XS/convert/converter.c
    (copy_converter_initialization_info): copy translated_commands too.
---
 ChangeLog                                          |  9 ++++++++
 tp/Texinfo/XS/convert/converter.c                  | 25 +++++++++++-----------
 tp/Texinfo/XS/convert/converter.h                  |  6 +++---
 tp/Texinfo/XS/convert/html_converter_api.h         |  2 +-
 .../XS/convert/html_converter_init_options.c       |  2 +-
 5 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c3a33acc49..16331eb1e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-12-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/converter.c (converter_converter): apply
+       directly user_conf argument instead of copying first.
+       Add const.
+
+       * tp/Texinfo/XS/convert/converter.c
+       (copy_converter_initialization_info): copy translated_commands too.
+
 2024-12-03  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/converter.c (copy_translated_commands)
diff --git a/tp/Texinfo/XS/convert/converter.c 
b/tp/Texinfo/XS/convert/converter.c
index 071280e979..8f7ff4e61d 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -364,7 +364,7 @@ apply_converter_info (CONVERTER *converter,
 void
 set_converter_init_information (CONVERTER *converter,
                             CONVERTER_INITIALIZATION_INFO *format_defaults,
-                            CONVERTER_INITIALIZATION_INFO *user_conf)
+                            const CONVERTER_INITIALIZATION_INFO *user_conf)
 {
   init_generic_converter (converter);
 
@@ -418,7 +418,8 @@ destroy_converter_initialization_info 
(CONVERTER_INITIALIZATION_INFO *init_info)
   free (init_info);
 }
 
-static void
+/* not used */
+void
 copy_converter_initialization_info (CONVERTER_INITIALIZATION_INFO *dst_info,
                                const CONVERTER_INITIALIZATION_INFO *src_info)
 {
@@ -426,6 +427,13 @@ copy_converter_initialization_info 
(CONVERTER_INITIALIZATION_INFO *dst_info,
                 &src_info->non_valid_customization);
 
   copy_options_list (&dst_info->conf, &src_info->conf, 1);
+
+  if (src_info->translated_commands)
+    {
+      destroy_translated_commands (dst_info->translated_commands);
+      dst_info->translated_commands
+        = copy_translated_commands (src_info->translated_commands);
+    }
 }
 
 /* Next five functions are not called from Perl as the Perl equivalent
@@ -441,14 +449,14 @@ copy_converter_initialization_info 
(CONVERTER_INITIALIZATION_INFO *dst_info,
 /* corresponds to Perl $converter->converter_defaults() Converter */
 CONVERTER_INITIALIZATION_INFO *
 converter_defaults (enum converter_format converter_format,
-                    CONVERTER_INITIALIZATION_INFO *user_conf)
+                    const CONVERTER_INITIALIZATION_INFO *user_conf)
 {
   if (converter_format != COF_none
       && converter_format_data[converter_format].converter_defaults)
     {
       CONVERTER_INITIALIZATION_INFO *
          (* format_converter_defaults) (enum converter_format format,
-                                  CONVERTER_INITIALIZATION_INFO *conf)
+                             const CONVERTER_INITIALIZATION_INFO *conf)
         = converter_format_data[converter_format].converter_defaults;
       return format_converter_defaults (converter_format, user_conf);
     }
@@ -472,26 +480,19 @@ converter_initialize (CONVERTER *converter)
 /* only called from C, not from Perl */
 CONVERTER *
 converter_converter (enum converter_format format,
-                     const CONVERTER_INITIALIZATION_INFO *input_user_conf)
+                     const CONVERTER_INITIALIZATION_INFO *user_conf)
 {
   CONVERTER_INITIALIZATION_INFO *format_defaults;
 
   size_t converter_descriptor = new_converter (format);
   CONVERTER *converter = retrieve_converter (converter_descriptor);
 
-  CONVERTER_INITIALIZATION_INFO *user_conf
-     = new_converter_initialization_info ();
-
-  copy_converter_initialization_info (user_conf, input_user_conf);
-
   format_defaults = converter_defaults (converter->format, user_conf);
 
   set_converter_init_information (converter, format_defaults, user_conf);
 
   destroy_converter_initialization_info (format_defaults);
 
-  destroy_converter_initialization_info (user_conf);
-
   converter_initialize (converter);
 
   return converter;
diff --git a/tp/Texinfo/XS/convert/converter.h 
b/tp/Texinfo/XS/convert/converter.h
index f2437d6927..ef3a2729b9 100644
--- a/tp/Texinfo/XS/convert/converter.h
+++ b/tp/Texinfo/XS/convert/converter.h
@@ -95,7 +95,7 @@ typedef struct CONVERTER_FORMAT_DATA {
     const char *perl_converter_class;
     CONVERTER_INITIALIZATION_INFO *
        (* converter_defaults) (enum converter_format format,
-                               CONVERTER_INITIALIZATION_INFO *conf);
+                               const CONVERTER_INITIALIZATION_INFO *conf);
     void (* converter_initialize) (CONVERTER *self);
     char * (* converter_output) (CONVERTER *converter, DOCUMENT *document);
     char * (* converter_convert) (CONVERTER *converter, DOCUMENT *document);
@@ -139,11 +139,11 @@ size_t new_converter (enum converter_format format);
 
 void set_converter_init_information (CONVERTER *converter,
                             CONVERTER_INITIALIZATION_INFO *format_defaults,
-                            CONVERTER_INITIALIZATION_INFO *user_conf);
+                            const CONVERTER_INITIALIZATION_INFO *user_conf);
 
 CONVERTER_INITIALIZATION_INFO *converter_defaults (
                     enum converter_format converter_format,
-                    CONVERTER_INITIALIZATION_INFO *user_conf);
+                    const CONVERTER_INITIALIZATION_INFO *user_conf);
 CONVERTER *converter_converter (enum converter_format format,
                      const CONVERTER_INITIALIZATION_INFO *input_user_conf);
 void converter_initialize (CONVERTER *converter);
diff --git a/tp/Texinfo/XS/convert/html_converter_api.h 
b/tp/Texinfo/XS/convert/html_converter_api.h
index 922ad29fba..0b31fec226 100644
--- a/tp/Texinfo/XS/convert/html_converter_api.h
+++ b/tp/Texinfo/XS/convert/html_converter_api.h
@@ -28,7 +28,7 @@ void html_format_setup (void);
 /* in html_converter_init_options.c */
 CONVERTER_INITIALIZATION_INFO *html_converter_defaults (
                               enum converter_format format,
-                              CONVERTER_INITIALIZATION_INFO *format_defaults);
+                              const CONVERTER_INITIALIZATION_INFO *conf);
 
 /* implemented in html_converter_api.c using html_conversion_api.h functions */
 void html_converter_initialize (CONVERTER *converter);
diff --git a/tp/Texinfo/XS/convert/html_converter_init_options.c 
b/tp/Texinfo/XS/convert/html_converter_init_options.c
index 4fb9a888f9..97d2dd7011 100644
--- a/tp/Texinfo/XS/convert/html_converter_init_options.c
+++ b/tp/Texinfo/XS/convert/html_converter_init_options.c
@@ -185,7 +185,7 @@ add_texi2html_default_buttons_specifications (OPTIONS_LIST 
*options,
 
 CONVERTER_INITIALIZATION_INFO *
 html_converter_defaults (enum converter_format format,
-                         CONVERTER_INITIALIZATION_INFO *conf)
+                         const CONVERTER_INITIALIZATION_INFO *conf)
 {
   CONVERTER_INITIALIZATION_INFO *format_defaults
     = new_converter_initialization_info ();



reply via email to

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