diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-03-07 14:06:39 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-03-07 14:06:39 +0100 |
commit | d2f62c83d6e3e60ebcb4810ecfe2e0429fef6c03 (patch) | |
tree | 1c2552166326200360d04815c3f6c8b090c6f337 | |
parent | 39ff31be4c955d1fb72b2ac5a0e05531f2377c6c (diff) |
Prefer macros
-rw-r--r-- | include/mbstring.h | 12 | ||||
-rw-r--r-- | include/rune.h | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/include/mbstring.h b/include/mbstring.h index 9545f1a..15250ff 100644 --- a/include/mbstring.h +++ b/include/mbstring.h @@ -24,10 +24,12 @@ struct u8view { #define U8_BYTE_C(x) (((x) & 0xC0) == 0x80) /* clang-format on */ -static const rune U8_1B_MAX = 0x00007FL; -static const rune U8_2B_MAX = 0x0007FFL; -static const rune U8_3B_MAX = 0x00FFFFL; -static const rune U8_4B_MAX = 0x10FFFFL; +#define U8_1B_MAX RUNE_C(0x00007FL) +#define U8_2B_MAX RUNE_C(0x0007FFL) +#define U8_3B_MAX RUNE_C(0x00FFFFL) +#define U8_4B_MAX RUNE_C(0x10FFFFL) + +#define U8_LEN_MAX 4 #define PRIsU8 ".*s" #define U8_PRI_ARGS(sv) ((int)(sv).len), ((sv).p) @@ -50,6 +52,4 @@ size_t u8spn(const char8_t *, size_t, const rune *, size_t); # define u8rchr(s, ch, n) __MLIB_Q_PTR(char8_t, u8rchr, (s), (s), (ch), (n)) #endif -static const int U8_LEN_MAX = 4; - #endif /* !MLIB_MBSTRING_H */ diff --git a/include/rune.h b/include/rune.h index 2f8ce59..61404de 100644 --- a/include/rune.h +++ b/include/rune.h @@ -28,9 +28,9 @@ #define RUNE_C(x) UINT32_C(x) -static const rune ASCII_MAX = RUNE_C(0x00007F); -static const rune LATIN1_MAX = RUNE_C(0x0000FF); -static const rune RUNE_ERROR = RUNE_C(0x00FFFD); -static const rune RUNE_MAX = RUNE_C(0x10FFFF); +#define ASCII_MAX RUNE_C(0x00007F) +#define LATIN1_MAX RUNE_C(0x0000FF) +#define RUNE_ERROR RUNE_C(0x00FFFD) +#define RUNE_MAX RUNE_C(0x10FFFF) #endif /* !MLIB_RUNE_H */ |