texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Reset linemacro counter


From: Gavin D. Smith
Subject: branch master updated: Reset linemacro counter
Date: Tue, 31 Dec 2024 15:58:02 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 9b0e4a9188 Reset linemacro counter
9b0e4a9188 is described below

commit 9b0e4a91881158f41b74c88b4007c6700410e9a8
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Dec 31 20:57:53 2024 +0000

    Reset linemacro counter
    
    * tp/Texinfo/XS/parsetexi/macro.c (expand_linemacro_arguments):
    Declare COUNTER object as a local variable as it is not used
    outside the function.  Call counter_reset before and after using
    it.
    * tp/Texinfo/XS/parsetexi/counter.c (counter_element_value):
    adjust formatting.
---
 ChangeLog                         | 11 +++++++++++
 tp/Texinfo/XS/parsetexi/counter.c |  2 +-
 tp/Texinfo/XS/parsetexi/counter.h |  2 +-
 tp/Texinfo/XS/parsetexi/macro.c   |  5 +++--
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7c588ba90f..06c7c9de8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-12-31  Gavin Smith <gavinsmith0123@gmail.com>
+
+       Reset linemacro counter
+
+       * tp/Texinfo/XS/parsetexi/macro.c (expand_linemacro_arguments):
+       Declare COUNTER object as a local variable as it is not used
+       outside the function.  Call counter_reset before and after using
+       it.
+       * tp/Texinfo/XS/parsetexi/counter.c (counter_element_value):
+       adjust formatting.
+
 2024-12-31  Gavin Smith <gavinsmith0123@gmail.com>
 
        Separate sui generis tp/t tests
diff --git a/tp/Texinfo/XS/parsetexi/counter.c 
b/tp/Texinfo/XS/parsetexi/counter.c
index 66865c9a0e..7437c4c783 100644
--- a/tp/Texinfo/XS/parsetexi/counter.c
+++ b/tp/Texinfo/XS/parsetexi/counter.c
@@ -128,7 +128,7 @@ counter_element_value (COUNTER *c, ELEMENT *elt)
 /* If NOT_EMPTY_MESSAGE is set, check that the counter values list
    is empty, if not, show a debugging message */
 void
-counter_reset (COUNTER *c, const char* not_empty_message)
+counter_reset (COUNTER *c, const char *not_empty_message)
 {
   if (not_empty_message && c->nvalues > 0)
     {
diff --git a/tp/Texinfo/XS/parsetexi/counter.h 
b/tp/Texinfo/XS/parsetexi/counter.h
index 82a81e2fa9..41d14c8756 100644
--- a/tp/Texinfo/XS/parsetexi/counter.h
+++ b/tp/Texinfo/XS/parsetexi/counter.h
@@ -32,7 +32,7 @@ void counter_inc (COUNTER *c);
 void counter_dec (COUNTER *c);
 int counter_remove_element (COUNTER *c, ELEMENT *elt);
 int counter_value (COUNTER *c, ELEMENT *e);
-void counter_reset (COUNTER *c, const char* not_empty_message);
+void counter_reset (COUNTER *c, const char *not_empty_message);
 int counter_element_value (COUNTER *c, ELEMENT *elt);
 
 void print_counter_top (COUNTER *c);
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 944edab45f..82beed1966 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -50,7 +50,6 @@ static size_t macro_space;
 
 static size_t free_slots_nr;
 
-COUNTER argument_brace_groups;
 
 
 /* Macro definition. */
@@ -463,6 +462,8 @@ expand_linemacro_arguments (const ELEMENT *macro, const 
char **line_inout,
   add_to_element_contents (argument, argument_content);
   arg = argument_content->e.text;
 
+  static COUNTER argument_brace_groups;
+  counter_reset (&argument_brace_groups, "argument_brace_groups");
   counter_push (&argument_brace_groups, argument_content, 0);
 
   spaces_nr = strspn (pline, whitespace_chars_except_newline);
@@ -631,8 +632,8 @@ expand_linemacro_arguments (const ELEMENT *macro, const 
char **line_inout,
               argument_content->type = ET_bracketed_linemacro_arg;
             }
         }
-      counter_remove_element (&argument_brace_groups, argument_content);
     }
+  counter_reset (&argument_brace_groups, 0);
   debug ("END LINEMACRO ARGS EXPANSION");
 
   *line_inout = line;



reply via email to

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