[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/xspara.c (xspara_add_text): Use a
From: |
Gavin D. Smith |
Subject: |
branch master updated: * tp/Texinfo/XS/xspara.c (xspara_add_text): Use a static buffer rather than calling malloc and free. This is significant as it is done for nearly every character output. |
Date: |
Sun, 09 Apr 2023 08:31:17 -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 e3b7a911cd * tp/Texinfo/XS/xspara.c (xspara_add_text): Use a static
buffer rather than calling malloc and free. This is significant as it is done
for nearly every character output.
e3b7a911cd is described below
commit e3b7a911cde898e4a4861b1ec2d9168592b8a5f4
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Apr 9 13:31:09 2023 +0100
* tp/Texinfo/XS/xspara.c (xspara_add_text):
Use a static buffer rather than calling malloc and free. This
is significant as it is done for nearly every character output.
---
ChangeLog | 6 ++++++
tp/Texinfo/XS/xspara.c | 4 +---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 052e76d4e9..81e9f8ff8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-04-09 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/XS/xspara.c (xspara_add_text):
+ Use a static buffer rather than calling malloc and free. This
+ is significant as it is done for nearly every character output.
+
2023-04-09 Gavin Smith <gavinsmith0123@gmail.com>
* tp/Texinfo/XS/xspara.c (xspara__add_next): Do not use mbrlen
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index 5bcceeabb4..4cb48fa40d 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -987,13 +987,11 @@ xspara_add_text (char *text, int len)
Perl code does, though. */
else if (width == 1 || width == 0)
{
- char *added_word;
- added_word = malloc (char_len + 1);
+ static char added_word[8]; /* long enough for one UTF-8 character */
memcpy (added_word, p, char_len);
added_word[char_len] = '\0';
xspara__add_next (&result, added_word, char_len, 0);
- free (added_word);
/* Now check if it is considered as an end of sentence, and
set state.end_sentence if it is. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/xspara.c (xspara_add_text): Use a static buffer rather than calling malloc and free. This is significant as it is done for nearly every character output.,
Gavin D. Smith <=