[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/tree.c (reset_obstacks)
From: |
Gavin D. Smith |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/tree.c (reset_obstacks): Do not call obstack_init more than once. Storage was not being reused in the obstack. (alloc_element): Zero element. (alloc_and_zero): Do not use for obstack_chunk_alloc definition, and remove. |
Date: |
Fri, 14 Apr 2023 06:39:31 -0400 |
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 da810ade43 * tp/Texinfo/XS/parsetexi/tree.c (reset_obstacks): Do not
call obstack_init more than once. Storage was not being reused in the obstack.
(alloc_element): Zero element. (alloc_and_zero): Do not use for
obstack_chunk_alloc definition, and remove.
da810ade43 is described below
commit da810ade43c4bcd4065be707a1ae58b658b42e97
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Fri Apr 14 11:39:13 2023 +0100
* tp/Texinfo/XS/parsetexi/tree.c (reset_obstacks):
Do not call obstack_init more than once. Storage was not
being reused in the obstack.
(alloc_element): Zero element.
(alloc_and_zero): Do not use for obstack_chunk_alloc definition,
and remove.
---
ChangeLog | 9 +++++++++
tp/Texinfo/XS/parsetexi/tree.c | 16 +++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index eb4aad897c..96787dc940 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-04-14 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/XS/parsetexi/tree.c (reset_obstacks):
+ Do not call obstack_init more than once. Storage was not
+ being reused in the obstack.
+ (alloc_element): Zero element.
+ (alloc_and_zero): Do not use for obstack_chunk_alloc definition,
+ and remove.
+
2023-04-14 Gavin Smith <gavinsmith0123@gmail.com>
* tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line):
diff --git a/tp/Texinfo/XS/parsetexi/tree.c b/tp/Texinfo/XS/parsetexi/tree.c
index 9aefea3d24..49b01e50d4 100644
--- a/tp/Texinfo/XS/parsetexi/tree.c
+++ b/tp/Texinfo/XS/parsetexi/tree.c
@@ -27,18 +27,12 @@
static struct obstack obs_element;
static int *obs_element_first = 0;
-static void *
-alloc_and_zero (size_t size)
-{
- return calloc (1, size);
-}
-
/* Used with destroy_element to reuse storage, e.g. from
abort_empty_line. Reduces memory use slightly (about 5% from testing)
for large manuals. */
static ELEMENT *spare_element;
-#define obstack_chunk_alloc alloc_and_zero
+#define obstack_chunk_alloc malloc
#define obstack_chunk_free free
void
@@ -48,14 +42,18 @@ reset_obstacks (void)
if (obs_element_first)
obstack_free (&obs_element, obs_element_first);
+ else
+ obstack_init (&obs_element);
- obstack_init (&obs_element);
obs_element_first = obstack_alloc (&obs_element, sizeof (int));
}
static ELEMENT *alloc_element (void)
{
- return (ELEMENT *) obstack_alloc (&obs_element, sizeof (ELEMENT));
+ ELEMENT *e;
+ e = (ELEMENT *) obstack_alloc (&obs_element, sizeof (ELEMENT));
+ memset (e, 0, sizeof (ELEMENT));
+ return e;
}
ELEMENT *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/tree.c (reset_obstacks): Do not call obstack_init more than once. Storage was not being reused in the obstack. (alloc_element): Zero element. (alloc_and_zero): Do not use for obstack_chunk_alloc definition, and remove.,
Gavin D. Smith <=