From 761402e86debe50ece432c3693135508bd03a1a0 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Thu, 9 May 2024 03:18:00 +0200 Subject: Add ASSUME()s --- lib/unicode/string/u8casefold.c | 4 ++++ lib/unicode/string/u8lower.c | 4 ++++ lib/unicode/string/u8title.c | 4 ++++ lib/unicode/string/u8upper.c | 4 ++++ 4 files changed, 16 insertions(+) (limited to 'lib') 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 #include +#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 #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 #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 #include +#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, -- cgit v1.2.3