[hackers] [libgrapheme] Drop get_codepoint*() and set_codepoint*() functions || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Sun, 2 Oct 2022 22:31:09 +0200 (CEST)

commit f70ea8c12ab5b7ad6f90f8860544779a43ce8a9e
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Sun Oct 2 22:30:08 2022 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Sun Oct 2 22:30:58 2022 +0200

    Drop get_codepoint*() and set_codepoint*() functions
    
    These are, now that all code has been refactored with Herodotus and
    Proper, no longer used and can be dropped.
    
    Signed-off-by: Laslo Hunhold <dev_AT_frign.de>

diff --git a/src/util.c b/src/util.c
index 1b6a7cb..eba476a 100644
--- a/src/util.c
+++ b/src/util.c
_AT_@ -408,65 +408,3 @@ proper_advance(struct proper *p)
 
         return 0;
 }
-
-inline size_t
-get_codepoint(const void *str, size_t len, size_t offset, uint_least32_t *cp)
-{
- if (offset < len) {
- *cp = ((const uint_least32_t *)str)[offset];
- return 1;
- } else {
- *cp = GRAPHEME_INVALID_CODEPOINT;
- return 0;
- }
-}
-
-inline size_t
-get_codepoint_utf8(const void *str, size_t len, size_t offset, uint_least32_t *cp)
-{
- size_t ret;
-
- if (offset < len) {
- ret = grapheme_decode_utf8((const char *)str + offset,
- len - offset, cp);
-
- if (unlikely(len == SIZE_MAX && cp == 0)) {
- return 0;
- } else {
- return ret;
- }
- } else {
- *cp = GRAPHEME_INVALID_CODEPOINT;
- return 0;
- }
-}
-
-inline size_t
-set_codepoint(uint_least32_t cp, void *str, size_t len, size_t offset)
-{
- if (str == NULL || len == 0) {
- return 1;
- }
-
- if (offset < len) {
- ((uint_least32_t *)str)[offset] = cp;
- return 1;
- } else {
- return 0;
- }
-}
-
-inline size_t
-set_codepoint_utf8(uint_least32_t cp, void *str, size_t len, size_t offset)
-{
- if (str == NULL || len == 0) {
- return grapheme_encode_utf8(cp, NULL, 0);
- }
-
- if (offset < len) {
- return grapheme_encode_utf8(cp, (char *)str + offset,
- len - offset);
- } else {
- return grapheme_encode_utf8(cp, NULL, 0);
- }
-}
diff --git a/src/util.h b/src/util.h
index dd36ce3..adca641 100644
--- a/src/util.h
+++ b/src/util.h
_AT_@ -113,10 +113,4 @@ void proper_init(const HERODOTUS_READER *, void *, uint_least8_t,
                  struct proper *);
 int proper_advance(struct proper *);
 
-size_t get_codepoint(const void *, size_t, size_t, uint_least32_t *);
-size_t get_codepoint_utf8(const void *, size_t, size_t, uint_least32_t *);
-
-size_t set_codepoint(uint_least32_t, void *, size_t, size_t);
-size_t set_codepoint_utf8(uint_least32_t, void *, size_t, size_t);
-
 #endif /* UTIL_H */
Received on Sun Oct 02 2022 - 22:31:09 CEST

This archive was generated by hypermail 2.3.0 : Sun Oct 02 2022 - 22:36:39 CEST