[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sun, 29 Sep 2024 06:47:36 -0400 (EDT) |
branch: master
commit 2345d14a739a771dfae7d7221191f7346af940a3
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Jun 21 17:58:55 2024 +0200
* tp/Texinfo/XS/structuring_transfo/structuring.c (number_floats): do
not use a static TEXT variable, instead initialize the TEXT variable
at the beginning of the function and reuse the storage. The function
should only be called once per document.
---
ChangeLog | 7 +++++++
tp/TODO | 2 --
tp/Texinfo/XS/structuring_transfo/structuring.c | 5 ++++-
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e08d22bad7..f202c6b029 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-06-21 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/structuring_transfo/structuring.c (number_floats): do
+ not use a static TEXT variable, instead initialize the TEXT variable
+ at the beginning of the function and reuse the storage. The function
+ should only be called once per document.
+
2024-06-21 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/parser.c
diff --git a/tp/TODO b/tp/TODO
index 6c9f611684..56846ea169 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,8 +10,6 @@ This is the todo list for texi2any
Before next release
===================
-Remove static for number floats, free at the end.
-
Free special output unit setup for consistency in label_target_unit_element
==1817037== by 0x7C7C32C: new_output_unit (output_unit.c:125)
==1817037== by 0x7C7CE86: label_target_unit_element (output_unit.c:501)
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index 610bf90674..ccaf00de7d 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -1614,6 +1614,9 @@ number_floats (DOCUMENT *document)
if (!listoffloats_list)
return;
+ TEXT number;
+ text_init (&number);
+
document->modified_information |= F_DOCM_tree;
for (i = 0; i < listoffloats_list->number; i++)
@@ -1626,7 +1629,6 @@ number_floats (DOCUMENT *document)
size_t j;
for (j = 0; j < listoffloats->float_list.number; j++)
{
- static TEXT number;
ELEMENT *float_elt = listoffloats->float_list.list[j];
const char *normalized
= lookup_extra_string (float_elt, AI_key_normalized);
@@ -1676,6 +1678,7 @@ number_floats (DOCUMENT *document)
add_extra_string_dup (float_elt, AI_key_float_number, number.text);
}
}
+ free (number.text);
}
/*