texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/structuring_transfo/transformatio


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/structuring_transfo/transformations.c (protect_hashchar_at_line_beginning_internal): define error_messages and options only where they are needed.
Date: Sat, 13 Apr 2024 17:48:46 -0400

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 c92f9307a6 * tp/Texinfo/XS/structuring_transfo/transformations.c 
(protect_hashchar_at_line_beginning_internal): define error_messages and 
options only where they are needed.
c92f9307a6 is described below

commit c92f9307a6f50817f13e7feec3c1e15b681a0894
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Apr 13 23:48:38 2024 +0200

    * tp/Texinfo/XS/structuring_transfo/transformations.c
    (protect_hashchar_at_line_beginning_internal): define error_messages
    and options only where they are needed.
    
    * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm: use
    Texinfo::Transformations methods fully qualified.
---
 ChangeLog                                           |  9 +++++++++
 Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm        |  7 +++----
 tp/Texinfo/XS/structuring_transfo/transformations.c | 19 +++++++++++++------
 3 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2e5203f31d..7df84e294a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-04-13  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/structuring_transfo/transformations.c
+       (protect_hashchar_at_line_beginning_internal): define error_messages
+       and options only where they are needed.
+
+       * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm: use
+       Texinfo::Transformations methods fully qualified.
+
 2024-04-13  Gavin Smith <gavinsmith0123@gmail.com>
 
        * README-hacking: use suppressions file for valgrind
diff --git a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm 
b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
index 1b3345cddd..34804f522d 100644
--- a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
+++ b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
@@ -54,8 +54,7 @@ use Texinfo::Convert::Texinfo;
 use Texinfo::Convert::TextContent;
 use Texinfo::Document;
 use Texinfo::ManipulateTree;
-use Texinfo::Transformations qw(protect_hashchar_at_line_beginning
-                                          reference_to_arg_in_tree);
+use Texinfo::Transformations;
 
 use vars qw(
   @ISA $VERSION
@@ -374,7 +373,7 @@ sub _protect_hashchar($)
   if ($texinfo =~ /#/) {
     my $document = parse_texi_piece(undef, $texinfo);
     my $tree = $document->tree();
-    protect_hashchar_at_line_beginning($tree);
+    Texinfo::Transformations::protect_hashchar_at_line_beginning($tree);
     # rebuild the tree
     $tree = $document->tree();
     return Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
@@ -388,7 +387,7 @@ sub _reference_to_text_in_texi($)
   my $texinfo = shift;
   my $document = parse_texi_piece(undef, $texinfo);
   my $tree = $document->tree();
-  reference_to_arg_in_tree($tree);
+  Texinfo::Transformations::reference_to_arg_in_tree($tree);
   # rebuild the tree
   $tree = $document->tree();
   return Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.c 
b/tp/Texinfo/XS/structuring_transfo/transformations.c
index 607285b157..52aa95891c 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.c
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.c
@@ -1264,17 +1264,19 @@ regenerate_master_menu (DOCUMENT *document, int 
use_sections)
   return 1;
 }
 
-/* NOTE in perl there is a customization_information, but here we use the
-   document for error registration and customization */
+/* NOTE in perl there is a separate registrar and customization_information,
+   here we directly use a document from ARGUMENT for error registration and
+   customization.
+   It would be more flexible to pass separately error_messages and
+   options, but would also require a specific structure, and we
+   always have a document in C/XS, so it is simpler to use it.
+   In Perl, the document may actually be used to get the registrar and
+   customization_information. */
 ELEMENT_LIST *
 protect_hashchar_at_line_beginning_internal (const char *type,
                                              ELEMENT *current,
                                              void *argument)
 {
-  DOCUMENT *document = (DOCUMENT *) argument;
-  ERROR_MESSAGE_LIST *error_messages = document->error_messages;
-  const OPTIONS *options = document->options;
-
   if (current->text.end > 0)
     {
       char *filename;
@@ -1322,6 +1324,11 @@ protect_hashchar_at_line_beginning_internal (const char 
*type,
                               if (parent_for_warn->cmd
                                   && parent_for_warn->source_info.line_nr)
                                 {
+                                  DOCUMENT *document = (DOCUMENT *) argument;
+                                  ERROR_MESSAGE_LIST *error_messages
+                                      = document->error_messages;
+                                  const OPTIONS *options = document->options;
+
                                   message_list_command_warn (
                                     error_messages, options,
                                     parent_for_warn, 0,



reply via email to

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