texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/xspara.c (xspara_add_text): Use b


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/XS/xspara.c (xspara_add_text): Use btowc instead of mbrtowc for printable ASCII characters.
Date: Sun, 09 Apr 2023 15:03:54 -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 d7df01e4a3 * tp/Texinfo/XS/xspara.c (xspara_add_text): Use btowc 
instead of mbrtowc for printable ASCII characters.
d7df01e4a3 is described below

commit d7df01e4a35755b9cd2ddd6d91c7044c9495407f
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Apr 9 20:03:46 2023 +0100

    * tp/Texinfo/XS/xspara.c (xspara_add_text):
    Use btowc instead of mbrtowc for printable ASCII characters.
---
 ChangeLog              |  5 +++++
 tp/Texinfo/XS/xspara.c | 12 +++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index f9e96ddfda..3a523f0e13 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-04-09  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/XS/xspara.c (xspara_add_text):
+       Use btowc instead of mbrtowc for printable ASCII characters.
+
 2023-04-09  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/XS/api.c (element_to_perl_hash): Precompute
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index 4d01751586..6832da328c 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -955,7 +955,17 @@ xspara_add_text (char *text, int len)
         }
 
       /************** Not a white space character. *****************/
-      char_len = mbrtowc (&wc, p, len, NULL);
+      if (!PRINTABLE_ASCII(*p))
+        {
+          char_len = mbrtowc (&wc, p, len, NULL);
+        }
+      else
+        {
+          /* Functonally the same as mbrtowc but (tested) slightly quicker. */
+          char_len = 1;
+          wc = btowc (*p);
+        }
+
       if ((long) char_len == 0)
         break; /* Null character. Shouldn't happen. */
       else if ((long) char_len < 0)



reply via email to

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