[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/xspara.c (xspara__add_next): When
From: |
Gavin D. Smith |
Subject: |
branch master updated: * tp/Texinfo/XS/xspara.c (xspara__add_next): When getting display length of text, optimize for the common case of printable ASCII characters, not calling mbrtowc or wcwidth for such. |
Date: |
Sun, 09 Apr 2023 08:58:12 -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 5b039bc533 * tp/Texinfo/XS/xspara.c (xspara__add_next): When getting
display length of text, optimize for the common case of printable ASCII
characters, not calling mbrtowc or wcwidth for such.
5b039bc533 is described below
commit 5b039bc5334258d43595383f2c7e4ef20cc9ab88
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Apr 9 13:58:03 2023 +0100
* tp/Texinfo/XS/xspara.c (xspara__add_next): When getting
display length of text, optimize for the common case of printable
ASCII characters, not calling mbrtowc or wcwidth for such.
---
ChangeLog | 6 ++++++
tp/Texinfo/XS/xspara.c | 12 +++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 81e9f8ff8a..8b12a04cf2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-04-09 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/XS/xspara.c (xspara__add_next): When getting
+ display length of text, optimize for the common case of printable
+ ASCII characters, not calling mbrtowc or wcwidth for such.
+
2023-04-09 Gavin Smith <gavinsmith0123@gmail.com>
* tp/Texinfo/XS/xspara.c (xspara_add_text):
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index 4cb48fa40d..e0c2fa09ea 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -706,8 +706,6 @@ xspara__add_next (TEXT *result, char *word, int word_len,
int transparent)
}
else
{
- /* The possibility of two-column characters is ignored here. */
-
/* Calculate length of multibyte string in characters. */
int len = 0;
int left = word_len;
@@ -717,7 +715,15 @@ xspara__add_next (TEXT *result, char *word, int word_len,
int transparent)
while (left > 0)
{
int columns;
- int char_len = mbrtowc (&w, p, left, NULL);
+ int char_len;
+
+ if (0x20 <= *p && *p <= 0x7E) /* in printable ASCII range */
+ {
+ len++; p++; left--;
+ continue;
+ }
+
+ char_len = mbrtowc (&w, p, left, NULL);
if (char_len == (size_t) -2) {
/* unfinished multibyte character */
char_len = left;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/xspara.c (xspara__add_next): When getting display length of text, optimize for the common case of printable ASCII characters, not calling mbrtowc or wcwidth for such.,
Gavin D. Smith <=