texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Thu, 6 Jun 2024 11:22:17 -0400 (EDT)

branch: master
commit 218e80753f838850471dff4fd7d8a8cfdb86ac33
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jun 6 07:43:54 2024 +0200

    Do not use unnamed union for KEY_PAIR and BUTTON_SPECIFICATION*
    
    * tp/Texinfo/XS/main/tree_types.h (KEY_PAIR): name the main union as
    k.  Update codes using the corresponding union fields.
    
    * tp/Texinfo/XS/main/option_types.h (BUTTON_SPECIFICATION_INFO)
    (BUTTON_SPECIFICATION): name the main union as b or bi.  Update codes
    using the corresponding union fields.
---
 ChangeLog                            | 11 +++++
 tp/TODO                              |  2 +
 tp/Texinfo/XS/convert/convert_html.c | 88 ++++++++++++++++++------------------
 tp/Texinfo/XS/main/build_perl_info.c | 18 ++++----
 tp/Texinfo/XS/main/debug.c           | 16 +++----
 tp/Texinfo/XS/main/extra.c           | 48 ++++++++++----------
 tp/Texinfo/XS/main/get_perl_info.c   | 18 ++++----
 tp/Texinfo/XS/main/manipulate_tree.c | 52 ++++++++++-----------
 tp/Texinfo/XS/main/option_types.h    |  4 +-
 tp/Texinfo/XS/main/tree.c            | 15 +++---
 tp/Texinfo/XS/main/tree_types.h      |  2 +-
 tp/Texinfo/XS/main/utils.c           |  2 +-
 tp/Texinfo/XS/parsetexi/end_line.c   | 19 ++++----
 tp/Texinfo/XS/parsetexi/macro.c      |  2 +-
 14 files changed, 155 insertions(+), 142 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cba4b622dd..7c80cdb1af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-06-06  Patrice Dumas  <pertusus@free.fr>
+
+       Do not use unnamed union for KEY_PAIR and BUTTON_SPECIFICATION*
+
+       * tp/Texinfo/XS/main/tree_types.h (KEY_PAIR): name the main union as
+       k.  Update codes using the corresponding union fields.
+
+       * tp/Texinfo/XS/main/option_types.h (BUTTON_SPECIFICATION_INFO)
+       (BUTTON_SPECIFICATION): name the main union as b or bi.  Update codes
+       using the corresponding union fields.
+
 2024-06-05  Gavin Smith <gavinsmith0123@gmail.com>
 
        * po/POTFILES.in: update
diff --git a/tp/TODO b/tp/TODO
index 2425d62339..f90e622232 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -754,6 +754,8 @@ The system perl may not be suitable to build XS modules, 
and the
 system gawk may be too old, openCSW may be needed.  For example: 
 ./configure PERL=/opt/csw/bin/perl GAWK=/opt/csw/bin/gawk CFLAGS='-g'
 
+./configure PERL=/opt/csw/bin/perl GAWK=/opt/csw/bin/gawk CFLAGS='-g' 
LDFLAGS=-L/opt/csw/lib/ CPPFLAGS='-I/opt/csw/include/' 
PERL_EXT_LDFLAGS=-L/opt/csw/lib/ LIBS=-liconv
+
 
 Misc notes
 ==========
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index c4e1cdc964..00efca9d3c 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -1385,7 +1385,7 @@ html_get_file_information (const CONVERTER *self, const 
char *key,
       *status = -2;
       return 0;
     }
-  return k->integer;
+  return k->k.integer;
 }
 
 void
@@ -7181,16 +7181,16 @@ get_links (CONVERTER* self, const char *filename,
           char *link_href;
           if (link->type != BST_direction)
             fatal ("LINKS_BUTTONS should only contain directions");
-          link_href = from_element_direction (self, link->direction,
+          link_href = from_element_direction (self, link->b.direction,
                                               HTT_href, output_unit,
                                               filename, node_command);
           if (link_href)
             {
               char *link_string
-                = from_element_direction (self, link->direction, HTT_string,
+                = from_element_direction (self, link->b.direction, HTT_string,
                                           output_unit, 0, 0);
               const char *button_rel
-                = direction_string (self, link->direction, TDS_type_rel,
+                = direction_string (self, link->b.direction, TDS_type_rel,
                                     TDS_context_string);
               text_printf (result, "<link href=\"%s\"", link_href);
               if (button_rel)
@@ -7484,14 +7484,14 @@ html_default_format_button (CONVERTER *self,
 {
   if (button->type == BST_function)
     {
-      return call_button_simple_function (self, button->sv_reference);
+      return call_button_simple_function (self, button->b.sv_reference);
     }
   else if (button->type == BST_direction_info
-           && button->button_info->type == BIT_function)
+           && button->b.button_info->type == BIT_function)
     {
       return button_direction_function (self,
-                      &button->button_info->button_function,
-                      button->button_info->direction, element);
+                      &button->b.button_info->bi.button_function,
+                      button->b.button_info->direction, element);
     }
   else
     {
@@ -7503,17 +7503,17 @@ html_default_format_button (CONVERTER *self,
       if (button->type == BST_string)
         {
           formatted_button->active
-            = get_perl_scalar_reference_value (button->sv_string);
+            = get_perl_scalar_reference_value (button->b.sv_string);
           formatted_button->need_delimiter = 1;
         }
       else if (button->type == BST_direction_info)
         {
-          int direction = button->button_info->direction;
-          if (button->button_info->type == BIT_string)
+          int direction = button->b.button_info->direction;
+          if (button->b.button_info->type == BIT_string)
             {
               /* use given text */
               char *text = get_perl_scalar_reference_value
-                                      (button->button_info->sv_string);
+                                      (button->b.button_info->bi.sv_string);
               if (text)
                 {
                   char *href = from_element_direction (self, direction,
@@ -7531,27 +7531,27 @@ html_default_format_button (CONVERTER *self,
                     }
                 }
             }
-          else if (button->button_info->type
+          else if (button->b.button_info->type
                    == BIT_selected_direction_information_type)
             {
          /* this case is mostly for tests, to test the direction type
             in direction_information_type with the direction direction */
-              if (button->button_info->direction_information_type >= 0)
+              if (button->b.button_info->bi.direction_information_type >= 0)
                 formatted_button->active
                   = from_element_direction (self, direction,
-                         button->button_info->direction_information_type,
+                         button->b.button_info->bi.direction_information_type,
                                                            0, 0, element);
             }
-          else if (button->button_info->type
+          else if (button->b.button_info->type
                    == BIT_href_direction_information_type)
             {
               char *href = from_element_direction (self, direction,
                                                    HTT_href, 0, 0, element);
-              if (button->button_info->direction_information_type >= 0)
+              if (button->b.button_info->bi.direction_information_type >= 0)
                 {
                   char *text_formatted = from_element_direction (self,
                                                                  direction,
-                            button->button_info->direction_information_type,
+                        button->b.button_info->bi.direction_information_type,
                                                                  0, 0, 0);
                   if (href && text_formatted)
                     {
@@ -7568,26 +7568,26 @@ html_default_format_button (CONVERTER *self,
           formatted_button->need_delimiter = 1;
         }
       /* for the next cases, button->type == BST_direction */
-      else if (button->direction == D_direction_Space)
+      else if (button->b.direction == D_direction_Space)
         {
           /* handle space button */
           if (self->conf->ICONS.integer > 0
               && self->conf->ACTIVE_ICONS.icons->number > 0
-              && self->conf->ACTIVE_ICONS.icons->list[button->direction]
+              && self->conf->ACTIVE_ICONS.icons->list[button->b.direction]
               && strlen
-                  (self->conf->ACTIVE_ICONS.icons->list[button->direction]))
+                  (self->conf->ACTIVE_ICONS.icons->list[button->b.direction]))
             {
               const char *button_name_string = direction_string (self,
-                                     button->direction, TDS_type_button,
+                                     button->b.direction, TDS_type_button,
                                                       TDS_context_string);
               formatted_button->active
                 = format_button_icon_img (self, button_name_string,
-                   self->conf->ACTIVE_ICONS.icons->list[button->direction], 0);
+                 self->conf->ACTIVE_ICONS.icons->list[button->b.direction], 0);
             }
           else
             {
               const char *button_text = direction_string (self,
-                                    button->direction, TDS_type_text, 0);
+                                    button->b.direction, TDS_type_text, 0);
               if (!button_text)
                 button_text = "";
               formatted_button->active = strdup (button_text);
@@ -7596,7 +7596,7 @@ html_default_format_button (CONVERTER *self,
         }
       else
         {
-          char *href = from_element_direction (self, button->direction,
+          char *href = from_element_direction (self, button->b.direction,
                                                HTT_href, 0, 0, element);
           if (href)
             {
@@ -7604,17 +7604,17 @@ html_default_format_button (CONVERTER *self,
               TEXT active_text;
               const char *active_icon = 0;
               const char *description
-               = direction_string (self, button->direction,
+               = direction_string (self, button->b.direction,
                                    TDS_type_description, TDS_context_string);
 
               if (self->conf->ICONS.integer > 0
                   && self->conf->ACTIVE_ICONS.icons->number > 0
-                  && self->conf->ACTIVE_ICONS.icons->list[button->direction]
+                  && self->conf->ACTIVE_ICONS.icons->list[button->b.direction]
                   && strlen (self->conf->ACTIVE_ICONS.icons
-                                                ->list[button->direction]))
+                                             ->list[button->b.direction]))
                 {
                   active_icon = self->conf->ACTIVE_ICONS.icons
-                                                  ->list[button->direction];
+                                               ->list[button->b.direction];
                 }
 
               text_init (&active_text);
@@ -7626,7 +7626,7 @@ html_default_format_button (CONVERTER *self,
               if (self->conf->USE_ACCESSKEY.integer > 0)
                 {
                   const char *accesskey
-                    = direction_string (self, button->direction,
+                    = direction_string (self, button->b.direction,
                                         TDS_type_accesskey, 
TDS_context_string);
                   if (accesskey && strlen (accesskey))
                     text_printf (&active_text, " accesskey=\"%s\"", accesskey);
@@ -7634,7 +7634,7 @@ html_default_format_button (CONVERTER *self,
               if (self->conf->USE_REL_REV.integer > 0)
                 {
                   const char *button_rel
-                    = direction_string (self, button->direction,
+                    = direction_string (self, button->b.direction,
                                         TDS_type_rel, TDS_context_string);
                   if (button_rel && strlen (button_rel))
                     text_printf (&active_text, " rel=\"%s\"", button_rel);
@@ -7643,10 +7643,10 @@ html_default_format_button (CONVERTER *self,
               if (active_icon)
                 {
                   const char *button_name_string = direction_string (self,
-                                       button->direction, TDS_type_button,
+                                       button->b.direction, TDS_type_button,
                                                       TDS_context_string);
                   char *icon_name = from_element_direction (self,
-                                                        button->direction,
+                                                        button->b.direction,
                                                                HTT_string,
                                                                  0, 0, 0);
                   char *icon_img
@@ -7660,7 +7660,7 @@ html_default_format_button (CONVERTER *self,
               else
                 {
                   const char *button_text_string = direction_string (self,
-                                     button->direction, TDS_type_text, 0);
+                                     button->b.direction, TDS_type_text, 0);
                   if (button_text_string)
                     text_append (&active_text, button_text_string);
                 }
@@ -7682,20 +7682,20 @@ html_default_format_button (CONVERTER *self,
 
               if (self->conf->ICONS.integer > 0
                   && self->conf->PASSIVE_ICONS.icons->number > 0
-                  && self->conf->PASSIVE_ICONS.icons->list[button->direction]
+                  && self->conf->PASSIVE_ICONS.icons->list[button->b.direction]
                   && strlen (self->conf->PASSIVE_ICONS.icons
-                                              ->list[button->direction]))
+                                              ->list[button->b.direction]))
                 {
                   passive_icon
-                    = self->conf->PASSIVE_ICONS.icons->list[button->direction];
+                    = 
self->conf->PASSIVE_ICONS.icons->list[button->b.direction];
                 }
               if (passive_icon)
                 {
                   const char *button_name_string
-                    = direction_string (self, button->direction,
+                    = direction_string (self, button->b.direction,
                                         TDS_type_button, TDS_context_string);
                   char *icon_name = from_element_direction (self,
-                                                        button->direction,
+                                                        button->b.direction,
                                                                HTT_string,
                                                                  0, 0, 0);
                   char *icon_img
@@ -7709,7 +7709,7 @@ html_default_format_button (CONVERTER *self,
               else
                 {
                   const char *button_text_string
-                    = direction_string (self, button->direction,
+                    = direction_string (self, button->b.direction,
                                         TDS_type_text, 0);
                   text_append_n (&passive_text, "[", 1);
                   if (button_text_string)
@@ -7774,9 +7774,9 @@ html_default_format_navigation_panel (CONVERTER *self,
       int need_delimiter = 0;
       int direction = -1;
       if (button->type == BST_direction_info)
-        direction = button->button_info->direction;
+        direction = button->b.button_info->direction;
       else if (button->type == BST_direction)
-        direction = button->direction;
+        direction = button->b.direction;
 
       if (direction >= 0 && direction == D_direction_Space
           && nr_of_buttons_shown == 0)
@@ -15715,9 +15715,9 @@ default_format_special_body_about (CONVERTER *self,
       const char *button_example;
 
       if (button->type == BST_direction_info)
-        direction = button->button_info->direction;
+        direction = button->b.button_info->direction;
       else if (button->type == BST_direction)
-        direction = button->direction;
+        direction = button->b.direction;
 
       if (direction < 0 || direction == D_direction_Space)
         continue;
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index 7977ebe240..3d5c191676 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -321,7 +321,7 @@ build_additional_info (HV *extra, const ASSOCIATED_INFO *a,
                  happens for root commands (sections, nodes) and associated
                  commands, and could also happen for subentry as it is not
                  a children of the associated index command */
-              ELEMENT *f = k->element;
+              ELEMENT *f = k->k.element;
               if (!f->hv)
                 f->hv = newHV ();
               STORE(newRV_inc ((SV *)f->hv));
@@ -352,7 +352,7 @@ build_additional_info (HV *extra, const ASSOCIATED_INFO *a,
                   fprintf (stderr, message.text);
                 }
                    */
-              ELEMENT *f = k->element;
+              ELEMENT *f = k->k.element;
               if (!f->hv || !avoid_recursion)
                 element_to_perl_hash (f, avoid_recursion);
               STORE(newRV_inc ((SV *)f->hv));
@@ -360,26 +360,26 @@ build_additional_info (HV *extra, const ASSOCIATED_INFO 
*a,
               }
             case extra_container:
               {
-              ELEMENT *f = k->element;
+              ELEMENT *f = k->k.element;
               build_perl_container (f, avoid_recursion);
               STORE(newRV_inc ((SV *)f->hv));
               break;
               }
             case extra_contents:
               {
-              const ELEMENT_LIST *l = k->list;
+              const ELEMENT_LIST *l = k->k.list;
               if (l && l->number)
                 STORE(build_perl_array (l, avoid_recursion));
               break;
               }
             case extra_directions:
               {
-              STORE(build_perl_directions (k->list, avoid_recursion));
+              STORE(build_perl_directions (k->k.list, avoid_recursion));
               break;
               }
             case extra_string:
               { /* A simple string. */
-              const char *value = k->string;
+              const char *value = k->k.string;
               STORE(newSVpv_utf8 (value, 0));
               break;
               }
@@ -387,14 +387,14 @@ build_additional_info (HV *extra, const ASSOCIATED_INFO 
*a,
               { /* A simple integer.  The intptr_t cast here prevents
                    a warning on MinGW ("cast from pointer to integer of
                    different size"). */
-              IV value = (IV) (intptr_t) k->integer;
+              IV value = (IV) (intptr_t) k->k.integer;
               STORE(newSViv (value));
               break;
               }
             case extra_misc_args:
               {
               size_t j;
-              const ELEMENT *f = k->element;
+              const ELEMENT *f = k->k.element;
               AV *av = newAV ();
               av_unshift (av, f->contents.number);
 
@@ -406,7 +406,7 @@ build_additional_info (HV *extra, const ASSOCIATED_INFO *a,
                   k_integer = lookup_extra (f->contents.list[j], "integer");
                   if (k_integer)
                     {
-                      IV value = (IV) (intptr_t) k_integer->integer;
+                      IV value = (IV) (intptr_t) k_integer->k.integer;
                       av_store (av, j, newSViv (value));
                     }
                   else if (f->contents.list[j]->text.end > 0)
diff --git a/tp/Texinfo/XS/main/debug.c b/tp/Texinfo/XS/main/debug.c
index 3aaf91255b..706d1748b6 100644
--- a/tp/Texinfo/XS/main/debug.c
+++ b/tp/Texinfo/XS/main/debug.c
@@ -129,31 +129,31 @@ print_associate_info_debug (const ASSOCIATED_INFO *info)
           text_printf (&text, "deleted");
           break;
         case extra_integer:
-          text_printf (&text, "integer: %d", k->integer);
+          text_printf (&text, "integer: %d", k->k.integer);
           break;
         case extra_string:
-          text_printf (&text, "string: %s", k->string);
+          text_printf (&text, "string: %s", k->k.string);
           break;
         case extra_element:
         case extra_element_oot:
           {
-            char *element_str = print_element_debug (k->element, 0);
+            char *element_str = print_element_debug (k->k.element, 0);
             if (k->type == extra_element_oot)
               text_append (&text, "oot ");
-            text_printf (&text, "element %p: %s", k->element, element_str);
+            text_printf (&text, "element %p: %s", k->k.element, element_str);
             free (element_str);
             break;
           }
         case extra_misc_args:
           {
             int j;
-            const ELEMENT *f = k->element;
+            const ELEMENT *f = k->k.element;
             text_append (&text, "array: ");
             for (j = 0; j < f->contents.number; j++)
               {
                 KEY_PAIR *k_integer = lookup_extra (f->contents.list[j], 
"integer");
                 if (k_integer)
-                  text_printf (&text, "%d|", k_integer->integer);
+                  text_printf (&text, "%d|", k_integer->k.integer);
                 else
                   text_printf (&text, "%s|", f->contents.list[j]->text.text);
               }
@@ -162,7 +162,7 @@ print_associate_info_debug (const ASSOCIATED_INFO *info)
         case extra_contents:
           {
             int j;
-            const ELEMENT_LIST *l = k->list;
+            const ELEMENT_LIST *l = k->k.list;
             text_append (&text, "contents: ");
             for (j = 0; j < l->number; j++)
               {
@@ -176,7 +176,7 @@ print_associate_info_debug (const ASSOCIATED_INFO *info)
         case extra_container:
           {
             int j;
-            const ELEMENT *f = k->element;
+            const ELEMENT *f = k->k.element;
             text_append (&text, "contents: ");
             for (j = 0; j < f->contents.number; j++)
               {
diff --git a/tp/Texinfo/XS/main/extra.c b/tp/Texinfo/XS/main/extra.c
index 69884782a9..ca62129dd4 100644
--- a/tp/Texinfo/XS/main/extra.c
+++ b/tp/Texinfo/XS/main/extra.c
@@ -63,7 +63,7 @@ add_extra_element (ELEMENT *e, const char *key, ELEMENT 
*value)
 {
   KEY_PAIR *k = get_associated_info_key (&e->extra_info, key,
                                          extra_element);
-  k->element = value;
+  k->k.element = value;
 }
 
 /* Add an extra key that is a reference to another element that is
@@ -75,7 +75,7 @@ add_extra_element_oot (ELEMENT *e, char *key, ELEMENT *value)
 {
   KEY_PAIR *k = get_associated_info_key (&e->extra_info, key,
                                          extra_element_oot);
-  k->element = value;
+  k->k.element = value;
 }
 
 /* Add an extra key that is a reference to elements elsewhere in the tree,
@@ -89,7 +89,7 @@ add_extra_container (ELEMENT *e, char *key, ELEMENT *value)
 {
   KEY_PAIR *k = get_associated_info_key (&e->extra_info, key,
                                          extra_container);
-  k->element = value;
+  k->k.element = value;
 }
 
 void
@@ -97,7 +97,7 @@ add_info_element_oot (ELEMENT *e, char *key, ELEMENT *value)
 {
   KEY_PAIR *k = get_associated_info_key (&e->info_info, key,
                                          extra_element_oot);
-  k->element = value;
+  k->k.element = value;
 }
 
 /* Add an extra key that is a reference to an array of other
@@ -120,7 +120,7 @@ add_extra_contents (ELEMENT *e, const char *key, int 
no_lookup)
   n_list = new_list ();
   KEY_PAIR *k = get_associated_info_key (&e->extra_info, key,
                                          extra_contents);
-  k->list = n_list;
+  k->k.list = n_list;
   return n_list;
 }
 
@@ -142,7 +142,7 @@ add_extra_directions (ELEMENT *e, const char *key)
       list_set_empty_contents (n_list, directions_length);
       KEY_PAIR *k = get_associated_info_key (&e->extra_info, key,
                                              extra_directions);
-      k->list = n_list;
+      k->k.list = n_list;
       return n_list;
     }
 }
@@ -152,42 +152,42 @@ add_extra_misc_args (ELEMENT *e, char *key, ELEMENT 
*value)
 {
   if (!value) return;
   KEY_PAIR *k = get_associated_info_key (&e->extra_info, key, extra_misc_args);
-  k->element = value;
+  k->k.element = value;
 }
 
 void
 add_extra_string (ELEMENT *e, const char *key, char *value)
 {
   KEY_PAIR *k = get_associated_info_key (&e->extra_info, key, extra_string);
-  k->string = value;
+  k->k.string = value;
 }
 
 void
 add_info_string (ELEMENT *e, char *key, char *value)
 {
   KEY_PAIR *k = get_associated_info_key (&e->info_info, key, extra_string);
-  k->string = value;
+  k->k.string = value;
 }
 
 void
 add_extra_string_dup (ELEMENT *e, const char *key, const char *value)
 {
   KEY_PAIR *k = get_associated_info_key (&e->extra_info, key, extra_string);
-  k->string = strdup (value);
+  k->k.string = strdup (value);
 }
 
 void
 add_info_string_dup (ELEMENT *e, const char *key, const char *value)
 {
   KEY_PAIR *k = get_associated_info_key (&e->info_info, key, extra_string);
-  k->string = strdup (value);
+  k->k.string = strdup (value);
 }
 
 void
 add_associated_info_integer (ASSOCIATED_INFO *a, const char *key, int value)
 {
   KEY_PAIR *k = get_associated_info_key (a, key, extra_integer);
-  k->integer = value;
+  k->k.integer = value;
 }
 
 void
@@ -195,21 +195,21 @@ add_associated_info_string_dup (ASSOCIATED_INFO *a, const 
char *key,
                                 const char *value)
 {
   KEY_PAIR *k = get_associated_info_key (a, key, extra_string);
-  k->string = strdup (value);
+  k->k.string = strdup (value);
 }
 
 void
 add_extra_integer (ELEMENT *e, char *key, long value)
 {
   KEY_PAIR *k = get_associated_info_key (&e->extra_info, key, extra_integer);
-  k->integer = value;
+  k->k.integer = value;
 }
 
 void
 add_info_integer (ELEMENT *e, char *key, long value)
 {
   KEY_PAIR *k = get_associated_info_key (&e->info_info, key, extra_integer);
-  k->integer = value;
+  k->k.integer = value;
 }
 
 KEY_PAIR *
@@ -243,7 +243,7 @@ lookup_extra_element (const ELEMENT *e, const char *key)
       fatal (msg);
       free (msg);
     }
-  return k->element;
+  return k->k.element;
 }
 
 char *
@@ -263,9 +263,9 @@ lookup_extra_string (const ELEMENT *e, const char *key)
           fatal (msg);
           free (msg);
         }
-      if (!k->string)
+      if (!k->k.string)
         return (0);
-      return k->string;
+      return k->k.string;
     }
 }
 
@@ -293,7 +293,7 @@ lookup_key_pair_integer (const KEY_PAIR *k, const char 
*key, int *ret)
       free (msg);
     }
   *ret = 0;
-  return k->integer;
+  return k->k.integer;
 }
 
 /* *ret is negative if not found or not an integer */
@@ -328,7 +328,7 @@ lookup_extra_contents (const ELEMENT *e, const char *key)
       fatal (msg);
       free (msg);
     }
-  return k->list;
+  return k->k.list;
 }
 
 const ELEMENT_LIST *
@@ -345,7 +345,7 @@ lookup_extra_directions (const ELEMENT *e, const char *key)
       fatal (msg);
       free (msg);
     }
-  return k->list;
+  return k->k.list;
 }
 
 ELEMENT *
@@ -355,7 +355,7 @@ lookup_info_element (const ELEMENT *e, const char *key)
   k = lookup_associated_info (&e->info_info, key);
   if (!k)
     return 0;
-  return k->element;
+  return k->k.element;
 }
 
 
@@ -370,9 +370,9 @@ lookup_info_string (const ELEMENT *e, const char *key)
 {
   const KEY_PAIR *k;
   k = lookup_associated_info (&e->info_info, key);
-  if (!k || !k->string)
+  if (!k || !k->k.string)
     return 0;
-  return k->string;
+  return k->k.string;
 }
 
 /* only called in tree copy to optimize for speed */
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index bcb4839e0b..14b5d85eff 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -1119,7 +1119,7 @@ html_get_button_specification_list (const CONVERTER 
*converter,
           if (SvTYPE (SvRV(*button_sv)) == SVt_PVCV) /* CODE */
             {
               button->type = BST_function;
-              button->sv_reference = *button_sv;
+              button->b.sv_reference = *button_sv;
             }
           else if (SvTYPE (SvRV(*button_sv)) == SVt_PVAV)
             {
@@ -1134,7 +1134,7 @@ html_get_button_specification_list (const CONVERTER 
*converter,
               memset (button_spec, 0, sizeof (BUTTON_SPECIFICATION_INFO));
 
               button->type = BST_direction_info;
-              button->button_info = button_spec;
+              button->b.button_info = button_spec;
 
               button_spec->direction
                 = html_get_direction_index (converter,
@@ -1148,7 +1148,7 @@ html_get_button_specification_list (const CONVERTER 
*converter,
                       char *button_fun_name;
                       enum button_function_type button_fun_type = 0;
                       button_spec->type = BIT_function;
-                      button_spec->button_function.sv_reference
+                      button_spec->bi.button_function.sv_reference
                                           = *button_spec_info_type;
                       button_fun_name
                        = SvPV_nolen (cv_name ((CV *) SvRV 
(*button_spec_info_type),
@@ -1161,14 +1161,14 @@ html_get_button_specification_list (const CONVERTER 
*converter,
                             break;
                           }
                       if (button_fun_type)
-                        button_spec->button_function.type = button_fun_type;
+                        button_spec->bi.button_function.type = button_fun_type;
                       else
                         result->BIT_user_function_number++;
                     }
                   else
                     {
                       button_spec->type = BIT_string;
-                      button_spec->sv_string = *button_spec_info_type;
+                      button_spec->bi.sv_string = *button_spec_info_type;
                     }
                 }
               else
@@ -1191,13 +1191,13 @@ html_get_button_specification_list (const CONVERTER 
*converter,
                       button_spec->type
                         = BIT_href_direction_information_type;
                     }
-                  button_spec->direction_information_type = -1;
+                  button_spec->bi.direction_information_type = -1;
                   for (j = 0; j < HTT_section +1; j++)
                     {
                       if (!strcmp (html_command_text_type_name[j],
                                    text_type_p))
                         {
-                          button_spec->direction_information_type = j;
+                          button_spec->bi.direction_information_type = j;
                           break;
                         }
                     }
@@ -1206,13 +1206,13 @@ html_get_button_specification_list (const CONVERTER 
*converter,
           else
             {
               button->type = BST_string;
-              button->sv_string = *button_sv;
+              button->b.sv_string = *button_sv;
             }
         }
       else
         {
           button->type = BST_direction;
-          button->direction = html_get_direction_index (converter,
+          button->b.direction = html_get_direction_index (converter,
                                               SvPVutf8_nolen (*button_sv));
         }
     }
diff --git a/tp/Texinfo/XS/main/manipulate_tree.c 
b/tp/Texinfo/XS/main/manipulate_tree.c
index a3c9545153..531b794bbf 100644
--- a/tp/Texinfo/XS/main/manipulate_tree.c
+++ b/tp/Texinfo/XS/main/manipulate_tree.c
@@ -48,7 +48,7 @@ increase_ref_counter (ELEMENT *element)
   if (!k_counter)
     add_extra_integer (element, "_counter", 0);
   k_counter = lookup_extra_by_index (element, "_counter", -1);
-  counter_ptr = &k_counter->integer;
+  counter_ptr = &k_counter->k.integer;
   (*counter_ptr) ++;
 }
 
@@ -61,7 +61,7 @@ copy_associated_info (ASSOCIATED_INFO *info, ASSOCIATED_INFO* 
new_info)
     {
       KEY_PAIR *k_ref = &info->info[i];
       const char *key = k_ref->key;
-      ELEMENT *f = k_ref->element;
+      ELEMENT *f = k_ref->k.element;
       ELEMENT *new_extra_element;
       ELEMENT_LIST *new_extra_contents;
       KEY_PAIR *k_copy = 0;
@@ -81,7 +81,7 @@ copy_associated_info (ASSOCIATED_INFO *info, ASSOCIATED_INFO* 
new_info)
             {
               KEY_PAIR *k
                 = get_associated_info_key (new_info, key, k_ref->type);
-              k->element = k_copy->element;
+              k->k.element = k_copy->k.element;
             }
           else
             {
@@ -94,10 +94,10 @@ copy_associated_info (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO* new_info)
           {
           KEY_PAIR *k = get_associated_info_key (new_info, key, k_ref->type);
           new_extra_contents = new_list ();
-          k->list = new_extra_contents;
-          for (j = 0; j < k_ref->list->number; j++)
+          k->k.list = new_extra_contents;
+          for (j = 0; j < k_ref->k.list->number; j++)
             {
-              ELEMENT *e = k_ref->list->list[j];
+              ELEMENT *e = k_ref->k.list->list[j];
               if (!e && info->info[i].type == extra_directions)
                 {
                   add_to_element_list (new_extra_contents, 0);
@@ -107,7 +107,7 @@ copy_associated_info (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO* new_info)
                   k_copy = lookup_extra_by_index (e, "_copy", -1);
                   if (k_copy)
                     add_to_element_list (new_extra_contents,
-                                         k_copy->element);
+                                         k_copy->k.element);
                   else
                     {
                       increase_ref_counter (e);
@@ -122,14 +122,14 @@ copy_associated_info (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO* new_info)
           {
           KEY_PAIR *k = get_associated_info_key (new_info, key, k_ref->type);
           new_extra_element = new_element (ET_NONE);
-          k->element = new_extra_element;
+          k->k.element = new_extra_element;
           for (j = 0; j < f->contents.number; j++)
             {
               ELEMENT *e = f->contents.list[j];
               k_copy = lookup_extra_by_index (e, "_copy", -1);
               if (k_copy)
                 add_to_contents_as_array (new_extra_element,
-                                          k_copy->element);
+                                          k_copy->k.element);
               else
                 {
                   increase_ref_counter (e);
@@ -155,7 +155,7 @@ copy_tree_internal (ELEMENT* current, ELEMENT *parent)
   k_copy = lookup_extra_by_index (current, "_copy", -1);
   if (k_copy)
     {
-      new = k_copy->element;
+      new = k_copy->k.element;
       if (parent && !new->parent)
         new->parent = parent;
       return new;
@@ -196,10 +196,10 @@ get_copy_ref (ELEMENT *element)
   ELEMENT *result;
 
   k_copy = lookup_extra_by_index (element, "_copy", -1);
-  result = k_copy->element;
+  result = k_copy->k.element;
 
   k_counter = lookup_extra_by_index (element, "_counter", -2);
-  counter_ptr = &k_counter->integer;
+  counter_ptr = &k_counter->k.integer;
   (*counter_ptr) --;
 
   if (*counter_ptr == 0)
@@ -222,7 +222,7 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
     {
       KEY_PAIR *k_ref = &info->info[i];
       const char *key = k_ref->key;
-      ELEMENT *f = k_ref->element;
+      ELEMENT *f = k_ref->k.element;
       ELEMENT *new_extra_element;
       int j;
 
@@ -244,22 +244,22 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
                 ELEMENT *e = get_copy_ref (f);
                 k = get_associated_info_key (new_info, key,
                                              info->info[i].type);
-                k->element = e;
+                k->k.element = e;
               }
             k_copy = lookup_extra_by_index (f, "_copy", -1);
             if (k_copy)
-              copy_extra_info (f, k_copy->element);
+              copy_extra_info (f, k_copy->k.element);
             break;
           }
         case extra_contents:
         case extra_directions:
           {
             KEY_PAIR *k = lookup_associated_info (new_info, key);
-            ELEMENT_LIST *new_extra_contents = k->list;
-            for (j = 0; j < k_ref->list->number; j++)
+            ELEMENT_LIST *new_extra_contents = k->k.list;
+            for (j = 0; j < k_ref->k.list->number; j++)
               {
                 KEY_PAIR *k_copy;
-                ELEMENT *e = k_ref->list->list[j];
+                ELEMENT *e = k_ref->k.list->list[j];
                 ELEMENT *new_e = new_extra_contents->list[j];
                 if (!e && info->info[i].type == extra_directions)
                   {
@@ -273,7 +273,7 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
                       }
                     k_copy = lookup_extra_by_index (e, "_copy", -1);
                     if (k_copy)
-                      copy_extra_info (e, k_copy->element);
+                      copy_extra_info (e, k_copy->k.element);
                   }
               }
             break;
@@ -281,7 +281,7 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
         case extra_container:
           {
             KEY_PAIR *k = lookup_associated_info (new_info, key);
-            new_extra_element = k->element;
+            new_extra_element = k->k.element;
             for (j = 0; j < f->contents.number; j++)
               {
                 KEY_PAIR *k_copy;
@@ -295,15 +295,15 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
 
                 k_copy = lookup_extra_by_index (e, "_copy", -1);
                 if (k_copy)
-                  copy_extra_info (e, k_copy->element);
+                  copy_extra_info (e, k_copy->k.element);
               }
             break;
           }
         case extra_string:
           { /* A simple string. */
-            char *value = k_ref->string;
+            char *value = k_ref->k.string;
             KEY_PAIR *k = get_associated_info_key (new_info, key, k_ref->type);
-            k->string = strdup (value);
+            k->k.string = strdup (value);
             break;
           }
         case extra_integer:
@@ -311,7 +311,7 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
             break;
           { /* A simple integer. */
             KEY_PAIR *k = get_associated_info_key (new_info, key, k_ref->type);
-            k->integer = k_ref->integer;
+            k->k.integer = k_ref->k.integer;
             break;
           }
         case extra_misc_args:
@@ -319,14 +319,14 @@ associate_info_references (ASSOCIATED_INFO *info, 
ASSOCIATED_INFO *new_info)
           int j;
           new_extra_element = new_element (ET_NONE);
           KEY_PAIR *k = get_associated_info_key (new_info, key, k_ref->type);
-          k->element = new_extra_element;
+          k->k.element = new_extra_element;
           for (j = 0; j < f->contents.number; j++)
             {
               ELEMENT *e = new_element (ET_NONE);
               KEY_PAIR *k_integer = lookup_extra (f->contents.list[j], 
"integer");
               if (k_integer)
                 {
-                  add_extra_integer (e, "integer", k_integer->integer);
+                  add_extra_integer (e, "integer", k_integer->k.integer);
                 }
               else
                 {
diff --git a/tp/Texinfo/XS/main/option_types.h 
b/tp/Texinfo/XS/main/option_types.h
index 82df5b7cc2..ec4ca19bfe 100644
--- a/tp/Texinfo/XS/main/option_types.h
+++ b/tp/Texinfo/XS/main/option_types.h
@@ -105,7 +105,7 @@ typedef struct BUTTON_SPECIFICATION_INFO {
      /* both global and relative directions index */
       int direction_information_type; /* BIT_direction_information_type
             text string in perl, element direction information type */
-    };
+    } bi;
 } BUTTON_SPECIFICATION_INFO;
 
 typedef struct BUTTON_SPECIFICATION {
@@ -122,7 +122,7 @@ typedef struct BUTTON_SPECIFICATION {
       void *sv_string; /* BST_string scalar reference */
       BUTTON_SPECIFICATION_INFO *button_info; /* BST_direction_info
                                               array reference of length 2 */
-    };
+    } b;
 } BUTTON_SPECIFICATION;
 
 typedef struct BUTTON_SPECIFICATION_LIST {
diff --git a/tp/Texinfo/XS/main/tree.c b/tp/Texinfo/XS/main/tree.c
index 4c87914c09..eb13742840 100644
--- a/tp/Texinfo/XS/main/tree.c
+++ b/tp/Texinfo/XS/main/tree.c
@@ -138,24 +138,25 @@ destroy_associated_info (ASSOCIATED_INFO *a)
 
   for (i = 0; i < a->info_number; i++)
     {
-      switch (a->info[i].type)
+      KEY_PAIR *k_pair = &a->info[i];
+      switch (k_pair->type)
         {
         case extra_string:
-          free (a->info[i].string);
+          free (k_pair->k.string);
           break;
         case extra_element_oot:
-          destroy_element_and_children (a->info[i].element);
+          destroy_element_and_children (k_pair->k.element);
           break;
         case extra_contents:
         case extra_directions:
-          destroy_list (a->info[i].list);
+          destroy_list (k_pair->k.list);
           break;
         case extra_container:
-          if (a->info[i].element)
-            destroy_element (a->info[i].element);
+          if (k_pair->k.element)
+            destroy_element (k_pair->k.element);
           break;
         case extra_misc_args:
-          destroy_element_and_children (a->info[i].element);
+          destroy_element_and_children (k_pair->k.element);
           break;
 
         default:
diff --git a/tp/Texinfo/XS/main/tree_types.h b/tp/Texinfo/XS/main/tree_types.h
index c619b135f1..b19427216c 100644
--- a/tp/Texinfo/XS/main/tree_types.h
+++ b/tp/Texinfo/XS/main/tree_types.h
@@ -143,7 +143,7 @@ typedef struct KEY_PAIR {
       ELEMENT_LIST *list;
       char *string;
       int integer;
-    };
+    } k;
 } KEY_PAIR;
 
 typedef struct SOURCE_INFO {
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index b90549afab..4fd41c666f 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -1535,7 +1535,7 @@ html_free_button_specification_list 
(BUTTON_SPECIFICATION_LIST *buttons)
         {
           BUTTON_SPECIFICATION *button = &buttons->list[i];
           if (button->type == BST_direction_info)
-            free (button->button_info);
+            free (button->b.button_info);
           unregister_perl_button (button);
         }
     }
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index bda394d1ef..4c775768a7 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -806,7 +806,7 @@ end_line_starting_block (ELEMENT *current)
   if (command == CM_multitable
       && (k = lookup_extra (current->parent, "columnfractions")))
     {
-      ELEMENT *misc_cmd = k->element;
+      ELEMENT *misc_cmd = k->k.element;
       ELEMENT *misc_args = lookup_extra_element (misc_cmd, "misc_args");
 
       if (misc_args)
@@ -942,7 +942,7 @@ end_line_starting_block (ELEMENT *current)
             }
           else
             {
-              ELEMENT *e = k_command_as_arg->element;
+              ELEMENT *e = k_command_as_arg->k.element;
               if (!(command_flags(e) & CF_brace)
                   || (command_data(e->cmd).data == BRACE_noarg))
                 {
@@ -970,7 +970,7 @@ end_line_starting_block (ELEMENT *current)
               for (i = 0; i < e->contents.number; i++)
                 {
                   if (contents_child_by_index (e, i)
-                             == k_command_as_arg->element)
+                             == k_command_as_arg->k.element)
                     {
                       i++;
                       break;
@@ -985,7 +985,7 @@ end_line_starting_block (ELEMENT *current)
                            && !*(f->text.text
                                  + strspn (f->text.text, whitespace_chars))))
                     {
-                      k_command_as_arg->element->type = ET_NONE;
+                      k_command_as_arg->k.element->type = ET_NONE;
                       k_command_as_arg->key = "";
                       k_command_as_arg->type = extra_deleted;
                       k_command_as_arg = 0;
@@ -997,11 +997,11 @@ end_line_starting_block (ELEMENT *current)
           /* if the command as argument does not have braces but it is
              a brace command and not a mark (noarg) command, warn */
           if (k_command_as_arg
-              && (k_command_as_arg->element->args.number <= 0
-                  || k_command_as_arg->element->args.list[0]->type
+              && (k_command_as_arg->k.element->args.number <= 0
+                  || k_command_as_arg->k.element->args.list[0]->type
                        != ET_brace_command_arg))
             {
-              enum command_id as_argument_cmd = k_command_as_arg->element->cmd;
+              enum command_id as_argument_cmd = 
k_command_as_arg->k.element->cmd;
               if ((command_data(as_argument_cmd).flags & CF_brace)
                   && command_data(as_argument_cmd).data != BRACE_noarg)
                 {
@@ -1013,9 +1013,9 @@ end_line_starting_block (ELEMENT *current)
 
       /* Check if command_as_argument isn't an accent command */
       k = lookup_extra (current, "command_as_argument");
-      if (k && k->element)
+      if (k && k->k.element)
         {
-          enum command_id as_argument_cmd = k->element->cmd;
+          enum command_id as_argument_cmd = k->k.element->cmd;
           if (as_argument_cmd
               && (command_data(as_argument_cmd).flags & CF_accent))
             {
@@ -1024,7 +1024,6 @@ end_line_starting_block (ELEMENT *current)
                             command_name(as_argument_cmd),
                             command_name(command));
               k->key = "";
-              k->element = 0;
               k->type = extra_deleted;
             }
         }
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 4a530dbc81..432c5d5cd2 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -648,7 +648,7 @@ expand_linemacro_arguments (const ELEMENT *macro, const 
char **line_inout,
                    = lookup_extra (argument_content, "toplevel_braces_nr");
       if (k_toplevel_braces_nr)
         {
-          if (k_toplevel_braces_nr->integer == 1)
+          if (k_toplevel_braces_nr->k.integer == 1)
             {
               int text_len = strlen (argument_content->text.text);
               if (argument_content->text.text[0] == '{'



reply via email to

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