texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Do not use unnamed union for COMMAND_OR_TYPE


From: Patrice Dumas
Subject: branch master updated: Do not use unnamed union for COMMAND_OR_TYPE
Date: Thu, 06 Jun 2024 11:35:52 -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 ca6ddcaf24 Do not use unnamed union for COMMAND_OR_TYPE
ca6ddcaf24 is described below

commit ca6ddcaf2488bb8893c5aa1543073272bdfd240a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jun 6 17:35:43 2024 +0200

    Do not use unnamed union for COMMAND_OR_TYPE
    
    * tp/Texinfo/XS/main/converter_types.h (COMMAND_OR_TYPE): name the
    union as ct.  Update codes using the corresponding union fields.
---
 ChangeLog                            |  7 +++++++
 tp/Texinfo/XS/convert/ConvertXS.xs   |  4 ++--
 tp/Texinfo/XS/convert/convert_html.c | 14 +++++++-------
 tp/Texinfo/XS/main/command_stack.c   |  6 +++---
 tp/Texinfo/XS/main/converter_types.h |  2 +-
 5 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c87a74f565..7c8f5ac2e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-06-06  Patrice Dumas  <pertusus@free.fr>
+
+       Do not use unnamed union for COMMAND_OR_TYPE
+
+       * tp/Texinfo/XS/main/converter_types.h (COMMAND_OR_TYPE): name the
+       union as ct.  Update codes using the corresponding union fields.
+
 2024-06-06  Patrice Dumas  <pertusus@free.fr>
 
        Do not use unnamed union for OPTION
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index b320592926..e4ac9c4ec5 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -955,9 +955,9 @@ html_preformatted_classes_stack (SV *converter_in)
                = &preformatted_classes_stack->stack[i];
              const char *pre_class = 0;
              if (cmd_or_type->variety == CTV_type_command)
-               pre_class = builtin_command_data[cmd_or_type->cmd].cmdname;
+               pre_class = builtin_command_data[cmd_or_type->ct.cmd].cmdname;
              else if (cmd_or_type->variety == CTV_type_type)
-               pre_class = self->pre_class_types[cmd_or_type->type];
+               pre_class = self->pre_class_types[cmd_or_type->ct.type];
              SV *class_sv
                = newSVpv_utf8 (pre_class, 0);
              av_push (preformatted_classes_av, class_sv);
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 4a8f6395e1..a59fe513c1 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -864,7 +864,7 @@ html_in_align (const CONVERTER *self)
   context = top_command_or_type (&top_document_ctx->composition_context);
   if (context->variety == CTV_type_command)
     {
-      enum command_id cmd = context->cmd;
+      enum command_id cmd = context->ct.cmd;
       if (html_commands_data[cmd].flags & HF_HTML_align)
         return cmd;
     }
@@ -11914,7 +11914,7 @@ convert_item_command (CONVERTER *self, const enum 
command_id cmd,
                    = &pre_classes->stack[i];
                   if (cmd_or_type->variety == CTV_type_command)
                     {
-                      enum command_id pre_class_cmd = cmd_or_type->cmd;
+                      enum command_id pre_class_cmd = cmd_or_type->ct.cmd;
                       if (builtin_command_data[pre_class_cmd].flags
                                                 & CF_preformatted_code)
                         {
@@ -14043,12 +14043,12 @@ preformatted_class (const CONVERTER *self)
       const COMMAND_OR_TYPE *cmd_or_type = &pre_classes->stack[i];
       if (!(cur_pre_class
             && (cur_pre_class->variety == CTV_type_command
-                && builtin_command_data[cur_pre_class->cmd].flags
+                && builtin_command_data[cur_pre_class->ct.cmd].flags
                                    & CF_preformatted_code)
             && (!((cmd_or_type->variety == CTV_type_command
-                   && builtin_command_data[cmd_or_type->cmd].flags
+                   && builtin_command_data[cmd_or_type->ct.cmd].flags
                                      & CF_preformatted_code)
-                  || cmd_or_type->cmd == CM_menu))))
+                  || cmd_or_type->ct.cmd == CM_menu))))
          cur_pre_class = cmd_or_type;
     }
   if (cur_pre_class)
@@ -14057,13 +14057,13 @@ preformatted_class (const CONVERTER *self)
       if (cur_pre_class->variety == CTV_type_command)
         {
           xasprintf (&pre_class, "%s-preformatted",
-                     builtin_command_name (cur_pre_class->cmd));
+                     builtin_command_name (cur_pre_class->ct.cmd));
         }
       else if (cur_pre_class->variety == CTV_type_type)
 
         {
           xasprintf (&pre_class, "%s-preformatted",
-                     self->pre_class_types[cur_pre_class->type]);
+                     self->pre_class_types[cur_pre_class->ct.type]);
         }
       if (pre_class)
         return pre_class;
diff --git a/tp/Texinfo/XS/main/command_stack.c 
b/tp/Texinfo/XS/main/command_stack.c
index 2fdc45897a..cd60a01480 100644
--- a/tp/Texinfo/XS/main/command_stack.c
+++ b/tp/Texinfo/XS/main/command_stack.c
@@ -80,17 +80,17 @@ push_command_or_type (COMMAND_OR_TYPE_STACK *stack, enum 
command_id cmd,
 
   if (type)
     {
-      stack->stack[stack->top].type = type;
+      stack->stack[stack->top].ct.type = type;
       stack->stack[stack->top].variety = CTV_type_type;
     }
   else if (cmd)
     {
-      stack->stack[stack->top].cmd = cmd;
+      stack->stack[stack->top].ct.cmd = cmd;
       stack->stack[stack->top].variety = CTV_type_command;
     }
   else
     {
-      stack->stack[stack->top].cmd = 0;
+      stack->stack[stack->top].ct.cmd = 0;
       stack->stack[stack->top].variety = CTV_type_none;
     }
 
diff --git a/tp/Texinfo/XS/main/converter_types.h 
b/tp/Texinfo/XS/main/converter_types.h
index 05e6ca80e1..2625556dac 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -227,7 +227,7 @@ typedef struct {
     union {
       enum command_id cmd;
       enum element_type type;
-    };
+    } ct;
 } COMMAND_OR_TYPE;
 
 typedef struct {



reply via email to

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