groff-commit
[Top][All Lists]
Advanced

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

[groff] 21/28: [libgroff]: Add `{UNI,GLYPH}BUFSZ` constants.


From: G. Branden Robinson
Subject: [groff] 21/28: [libgroff]: Add `{UNI,GLYPH}BUFSZ` constants.
Date: Sun, 25 Aug 2024 23:03:31 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 147589d2562980093bf22debdfb99196912aa34c
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Aug 24 23:04:10 2024 -0500

    [libgroff]: Add `{UNI,GLYPH}BUFSZ` constants.
    
    * src/include/unicode.h: Declare new constants `UNIBUFSZ` and
      `GLYPHBUFSZ` to help callers of `glyph_name_to_unicode()` and
      `unicode_to_glyph_name()` allocate sufficient memory to hold any
      returned special character identifiers.
---
 ChangeLog             | 7 +++++++
 src/include/unicode.h | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c48a9ddf0..a6351f954 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-08-24  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/include/unicode.h: Declare new constants `UNIBUFSZ` and
+       `GLYPHBUFSZ` to help callers of `glyph_name_to_unicode()` and
+       `unicode_to_glyph_name()` allocate sufficient memory to hold any
+       returned special character identifiers.
+
 2024-08-24  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [libgroff]: Modify `valid_unicode_code_sequence()` function to
diff --git a/src/include/unicode.h b/src/include/unicode.h
index 04138b588..f07cbafe5 100644
--- a/src/include/unicode.h
+++ b/src/include/unicode.h
@@ -74,6 +74,14 @@ const char *valid_unicode_code_sequence(const char *,
 // valid_unicode_code_sequence() writes to an error message buffer.
 const size_t ERRBUFSZ = 256;
 
+// Track the length of the longest Unicode special character identifier
+// that `glyph_name_to_unicode` might return.
+const size_t UNIBUFSZ = sizeof "u10FFFF"; // see glyphuni.cpp
+
+// Track the length of the longest special character identifier that
+// `unicode_to_glyph_name` might return.
+const size_t GLYPHBUFSZ = sizeof "bracketrighttp"; // see uniglyph.cpp
+
 // Local Variables:
 // fill-column: 72
 // mode: C++



reply via email to

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