texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/main/output_unit.c (units_directi


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/main/output_unit.c (units_directions), tp/Texinfo/XS/main/tree_types.h (OUTPUT_UNIT): make OUTPUT_UNIT directions field an array on const output units pointers. Cast to remove the const in units_directions in the cases where the directions are set based on other directions.
Date: Sun, 29 Sep 2024 09:09:59 -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 bfe4d51ce7 * tp/Texinfo/XS/main/output_unit.c (units_directions), 
tp/Texinfo/XS/main/tree_types.h (OUTPUT_UNIT): make OUTPUT_UNIT directions 
field an array on const output units pointers.  Cast to remove the const in 
units_directions in the cases where the directions are set based on other 
directions.
bfe4d51ce7 is described below

commit bfe4d51ce75196fcbc01e2557068dfb172ade1aa
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jun 29 16:42:04 2024 +0200

    * tp/Texinfo/XS/main/output_unit.c (units_directions),
    tp/Texinfo/XS/main/tree_types.h (OUTPUT_UNIT): make OUTPUT_UNIT
    directions field an array on const output units pointers.  Cast to
    remove the const in units_directions in the cases where the directions
    are set based on other directions.
---
 ChangeLog                        |  8 ++++++++
 tp/Texinfo/XS/main/output_unit.c | 21 +++++++++++++++------
 tp/Texinfo/XS/main/tree_types.h  |  2 +-
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b67d890d80..94a1537fcf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-06-29  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/output_unit.c (units_directions),
+       tp/Texinfo/XS/main/tree_types.h (OUTPUT_UNIT): make OUTPUT_UNIT
+       directions field an array on const output units pointers.  Cast to
+       remove the const in units_directions in the cases where the directions
+       are set based on other directions.
+
 2024-06-29  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm (relocate_source_marks): check if source_mark
diff --git a/tp/Texinfo/XS/main/output_unit.c b/tp/Texinfo/XS/main/output_unit.c
index ac0722e954..bbb87a0b3a 100644
--- a/tp/Texinfo/XS/main/output_unit.c
+++ b/tp/Texinfo/XS/main/output_unit.c
@@ -588,7 +588,7 @@ units_directions (const LABEL_LIST *identifiers_target,
   for (i = 0; i < output_units->number; i++)
     {
       OUTPUT_UNIT *output_unit = output_units->list[i];
-      OUTPUT_UNIT **directions = output_unit->directions;
+      const OUTPUT_UNIT **directions = output_unit->directions;
       const ELEMENT *node = output_unit_node (output_unit);
       const ELEMENT * const *node_directions;
       const ELEMENT *section = output_unit_section (output_unit);
@@ -692,8 +692,13 @@ units_directions (const LABEL_LIST *identifiers_target,
               && directions[RUD_type_NodeForward]->unit_type == OU_unit
               && !directions[RUD_type_NodeForward]
                               ->directions[RUD_type_NodeBack])
-            directions[RUD_type_NodeForward]->directions[RUD_type_NodeBack]
-               = output_unit;
+            {
+             /* to modify the NodeForward element direction, we remove
+                the const by casting */
+              OUTPUT_UNIT *forward_unit
+                = (OUTPUT_UNIT *)directions[RUD_type_NodeForward];
+              forward_unit->directions[RUD_type_NodeBack] = output_unit;
+            }
         }
       if (!section)
         {
@@ -821,11 +826,15 @@ units_directions (const LABEL_LIST *identifiers_target,
 
               if (status >= 0 && section_level <= 1
                   && directions[RUD_type_FastForward])
+                {
                  /* the element is a top level element, we adjust the next
                     toplevel element fastback */
-                directions[RUD_type_FastForward]
-                   ->directions[RUD_type_FastBack] = output_unit;
-
+                 /* to modify the FastForward element direction, we remove
+                    the const by casting */
+                  OUTPUT_UNIT *fastf_unit
+                     = (OUTPUT_UNIT *)directions[RUD_type_FastForward];
+                  fastf_unit->directions[RUD_type_FastBack] = output_unit;
+                }
             }
         }
     }
diff --git a/tp/Texinfo/XS/main/tree_types.h b/tp/Texinfo/XS/main/tree_types.h
index 254a218729..fbb1f5dc33 100644
--- a/tp/Texinfo/XS/main/tree_types.h
+++ b/tp/Texinfo/XS/main/tree_types.h
@@ -309,7 +309,7 @@ typedef struct OUTPUT_UNIT {
     struct OUTPUT_UNIT *tree_unit_directions[2];
 
     struct OUTPUT_UNIT *first_in_page;
-    struct OUTPUT_UNIT *directions[RUD_type_FirstInFileNodeBack+1];
+    const struct OUTPUT_UNIT *directions[RUD_type_FirstInFileNodeBack+1];
 
     /* for special output units only */
     /* could be an enum as for now new special types cannot be customized



reply via email to

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