texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Mon, 20 May 2024 10:17:00 -0400 (EDT)

branch: master
commit 1ebba064df8d29636128d2b9902b8e8fcd359aa9
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon May 20 16:16:59 2024 +0200

    * tp/Texinfo/XS/parsetexi/source_marks.c (source_marks_counters)
    (register_source_mark, transfer_source_marks): add
    source_marks_counters array to hold the source marks counters.
---
 ChangeLog                              |  6 ++++++
 tp/Texinfo/XS/parsetexi/source_marks.c | 30 +++++-------------------------
 2 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b70ba0bccb..1da3640630 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-05-20  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/source_marks.c (source_marks_counters)
+       (register_source_mark, transfer_source_marks): add
+       source_marks_counters array to hold the source marks counters.
+
 2024-05-20  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/parsetexi/api.c (parser_conf_reset_values)
diff --git a/tp/Texinfo/XS/parsetexi/source_marks.c 
b/tp/Texinfo/XS/parsetexi/source_marks.c
index a0fee655ae..e1d18090ba 100644
--- a/tp/Texinfo/XS/parsetexi/source_marks.c
+++ b/tp/Texinfo/XS/parsetexi/source_marks.c
@@ -26,11 +26,6 @@
 #include "manipulate_tree.h"
 #include "source_marks.h"
 
-#define sm_type(name) \
-static int name##_counter = 0;
- SM_TYPES_LIST
-#undef sm_type
-
 static const char *source_marks_names[SM_type_expanded_conditional_command + 
1] =
 {
   0,
@@ -39,6 +34,8 @@ static const char 
*source_marks_names[SM_type_expanded_conditional_command + 1]
   #undef sm_type
 };
 
+static int source_marks_counters[SM_type_expanded_conditional_command + 1];
+
 SOURCE_MARK *
 new_source_mark (enum source_mark_type type)
 {
@@ -97,23 +94,8 @@ register_source_mark (ELEMENT *e, SOURCE_MARK *source_mark)
 {
   if (source_mark->counter == -1)
     {
-      switch (source_mark->type)
-        {
-#define sm_type(name) \
-          case SM_type_##name: \
-            {                     \
-              name##_counter++;   \
-              source_mark->counter = name##_counter; \
-            } \
-          break;
-
-        SM_TYPES_LIST
-
-#undef sm_type
-        default:
-          /* do nothing; just silence -Wswitch about SM_type_none */
-          break;
-        }
+      source_marks_counters[source_mark->type]++;
+      source_mark->counter = source_marks_counters[source_mark->type];
     }
 
   place_source_mark (e, source_mark);
@@ -138,8 +120,6 @@ transfer_source_marks (ELEMENT *from_e, ELEMENT *e)
 void
 source_marks_reset_counters (void)
 {
-#define sm_type(name) name##_counter = 0;
- SM_TYPES_LIST
-#undef sm_type
+  memset (source_marks_counters, 0, sizeof (source_marks_counters));
 }
 



reply via email to

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