texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Gavin D. Smith
Date: Tue, 15 Aug 2023 08:51:03 -0400 (EDT)

branch: master
commit 8ad2a8fc0b17356ffd435daa3ef1f899016f93e4
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Aug 15 13:50:54 2023 +0100

    parsetexi compiler warnings
    
    * tp/Texinfo/XS/parsetexi/parser.c (isolate_last_space):
    Change a condition to make it easier to see that a variable is
    not used uninitialised.
    * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line):
    Restructure to make it clearer that a variable is not used
    uninitialised, especially as this is quite a long function.
    
    * tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block) <float>:
    Comment out declaration of unused variable.
---
 ChangeLog                          | 14 ++++++++++++++
 tp/Texinfo/XS/parsetexi/end_line.c | 23 +++++++++++++----------
 tp/Texinfo/XS/parsetexi/parser.c   |  4 ++--
 3 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 18f8e6beff..7e3dfbffa8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2023-08-15  Gavin Smith <gavinsmith0123@gmail.com>
+
+       parsetexi compiler warnings
+
+       * tp/Texinfo/XS/parsetexi/parser.c (isolate_last_space):
+       Change a condition to make it easier to see that a variable is
+       not used uninitialised.
+       * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line):
+       Restructure to make it clearer that a variable is not used
+       uninitialised, especially as this is quite a long function.
+
+       * tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block) <float>:
+       Comment out declaration of unused variable.
+
 2023-08-15  Gavin Smith <gavinsmith0123@gmail.com>
 
        parsetexi compiler warnings
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index b96e1857e2..1a5ff19bfb 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -844,7 +844,7 @@ end_line_starting_block (ELEMENT *current)
 
   if (command == CM_float)
     {
-      char *float_type = "";
+      /* char *float_type = ""; */
       ELEMENT *float_label_element = 0;
       current->source_info = current_source_info;
       if (current->args.number >= 2)
@@ -1186,7 +1186,7 @@ end_line_misc_line (ELEMENT *current)
   char *end_command = 0;
   enum command_id end_id = CM_NONE;
   int included_file = 0;
-  SOURCE_MARK *include_source_mark;
+  SOURCE_MARK *include_source_mark = 0;
 
   data_cmd = cmd = current->parent->cmd;
   /* we are in a command line context, so the @item command information is
@@ -1666,18 +1666,21 @@ end_line_misc_line (ELEMENT *current)
         Also ignore @setfilename in included file, as said in the manual. */
       if (included_file || (cmd == CM_setfilename && top_file_index () > 0))
         {
-          SOURCE_MARK *source_mark;
-          if (included_file)
+          SOURCE_MARK *source_mark = 0;
+          if (included_file && include_source_mark)
             source_mark = include_source_mark;
           else
             source_mark = new_source_mark (SM_type_setfilename);
 
-          /* this is in order to keep source marks that are within a
-            removed element.  For the XS parser it is also easier to
-            manage the source mark memory which can stay associated
-            to the element. */
-          source_mark->element = pop_element_from_contents (current);
-          register_source_mark (current, source_mark);
+          if (source_mark)
+            {
+              /* this is in order to keep source marks that are within a
+                removed element.  For the XS parser it is also easier to
+                manage the source mark memory which can stay associated
+                to the element. */
+              source_mark->element = pop_element_from_contents (current);
+              register_source_mark (current, source_mark);
+            }
         }
       if (close_preformatted_command (cmd))
         current = begin_preformatted (current);
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index ed664f823c..ced78cd376 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -942,7 +942,7 @@ void
 isolate_last_space (ELEMENT *current)
 {
   char *text;
-  ELEMENT *last_elt;
+  ELEMENT *last_elt = 0;
   int text_len;
 
   if (current->contents.number == 0)
@@ -990,7 +990,7 @@ isolate_last_space (ELEMENT *current)
   debug_nonl ("NOT ISOLATING p ");
   debug_print_element (current, 0);
   debug_nonl ("; c ");
-  if (current->contents.number != 0)
+  if (last_elt)
     debug_print_element (last_elt, 0);
   debug ("");
 



reply via email to

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