diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-05-09 03:18:00 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-05-09 03:18:00 +0200 |
commit | 761402e86debe50ece432c3693135508bd03a1a0 (patch) | |
tree | 8215d7089bc181c8ec63eaf63b6335503996a9bb | |
parent | edcd0ecf5cadebe0c971a5a67df5962c2bf5cb95 (diff) |
Add ASSUME()s
-rw-r--r-- | lib/unicode/string/u8casefold.c | 4 | ||||
-rw-r--r-- | lib/unicode/string/u8lower.c | 4 | ||||
-rw-r--r-- | lib/unicode/string/u8title.c | 4 | ||||
-rw-r--r-- | lib/unicode/string/u8upper.c | 4 |
4 files changed, 16 insertions, 0 deletions
diff --git a/lib/unicode/string/u8casefold.c b/lib/unicode/string/u8casefold.c index aba08f3..eff1e48 100644 --- a/lib/unicode/string/u8casefold.c +++ b/lib/unicode/string/u8casefold.c @@ -1,6 +1,7 @@ #include <errno.h> #include <stdckdint.h> +#include "macros.h" #include "mbstring.h" #include "unicode/prop.h" #include "unicode/string.h" @@ -9,6 +10,9 @@ char8_t * u8casefold(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, void *alloc_ctx) { + ASSUME(dstn != nullptr); + ASSUME(alloc != nullptr); + size_t bufsz; if (ckd_mul(&bufsz, sv.len, (size_t)U8CASEFOLD_SCALE)) { errno = EOVERFLOW; diff --git a/lib/unicode/string/u8lower.c b/lib/unicode/string/u8lower.c index 47c32f5..d5eb58c 100644 --- a/lib/unicode/string/u8lower.c +++ b/lib/unicode/string/u8lower.c @@ -2,6 +2,7 @@ #include <stdckdint.h> #include "_attrs.h" +#include "macros.h" #include "mbstring.h" #include "unicode/prop.h" #include "unicode/string.h" @@ -19,6 +20,9 @@ char8_t * u8lower(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, void *alloc_ctx) { + ASSUME(dstn != nullptr); + ASSUME(alloc != nullptr); + struct lcctx ctx = { .az_or_tr = flags & CF_LANG_AZ, .lt = flags & CF_LANG_LT, diff --git a/lib/unicode/string/u8title.c b/lib/unicode/string/u8title.c index 1adf110..0c3620e 100644 --- a/lib/unicode/string/u8title.c +++ b/lib/unicode/string/u8title.c @@ -2,6 +2,7 @@ #include <stdckdint.h> #include "_attrs.h" +#include "macros.h" #include "mbstring.h" #include "unicode/prop.h" #include "unicode/string.h" @@ -20,6 +21,9 @@ char8_t * u8title(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, void *alloc_ctx) { + ASSUME(dstn != nullptr); + ASSUME(alloc != nullptr); + struct tcctx ctx_t; struct lcctx ctx_l; diff --git a/lib/unicode/string/u8upper.c b/lib/unicode/string/u8upper.c index 5da49ba..df25ee7 100644 --- a/lib/unicode/string/u8upper.c +++ b/lib/unicode/string/u8upper.c @@ -1,6 +1,7 @@ #include <errno.h> #include <stdckdint.h> +#include "macros.h" #include "mbstring.h" #include "unicode/prop.h" #include "unicode/string.h" @@ -9,6 +10,9 @@ char8_t * u8upper(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, void *alloc_ctx) { + ASSUME(dstn != nullptr); + ASSUME(alloc != nullptr); + struct ucctx ctx = { .az_or_tr = flags & CF_LANG_AZ, .lt = flags & CF_LANG_LT, |