gbranden pushed a commit to branch master
in repository groff.
commit 84777a0b77257d7b02718ea3063141d950f30c42
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Mar 22 20:38:28 2025 -0500
[troff]: Unpessimize `token::next()`.
* src/roff/troff/input.cpp (token::next): Discard local array variable
`errbuf`. Pass a null pointer instead of it to
`valid_unicode_code_sequence()`, so that the latter function does not
waste resources constructing a diagnostic message that we are not
going to emit.
Continues commit b4397231a0, earlier today. Thanks to Dave Kemper for
pointing out the lingering pessimization.
---
ChangeLog | 11 +++++++++++
src/roff/troff/input.cpp | 3 +--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7b451386b..8ee2f4fa4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2025-03-22 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (token::next): Discard local array
+ variable `errbuf`. Pass a null pointer instead of it to
+ `valid_unicode_code_sequence()`, so that the latter function
+ does not waste resources constructing a diagnostic message that
+ we are not going to emit.
+
+ Continues commit b4397231a0, earlier today. Thanks to Dave
+ Kemper for pointing out the lingering pessimization.
+
2025-03-22 G. Branden Robinson <[email protected]>
* src/libs/libgroff/json_encode.cpp (json_encode_char): Kill off
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index def138e7b..d46939292 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2561,11 +2561,10 @@ void token::next()
nm = composite_glyph_name(s);
}
else {
- char errbuf[ERRBUFSZ];
const char *sc = s.contents();
const char *gn = 0 /* nullptr */;
if ((strlen(sc) > 2) && (sc[0] == 'u'))
- gn = valid_unicode_code_sequence(sc, errbuf);
+ gn = valid_unicode_code_sequence(sc, 0 /* nullptr */);
if (gn != 0 /* nullptr */) {
const char *gn_decomposed = decompose_unicode(gn);
if (gn_decomposed)
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit