summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-12 12:49:40 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-12 12:49:40 -0600
commitcd5e55ebb7d5a51c0a8bd62137ab75a0f6ff1356 (patch)
tree214eb605f42ea83a4e378914422b3b6ff0747c18
parentc474fa0ade3409efa9eb1e45743afb82fd377cbd (diff)
parent6b45663cbb556e252fc6a2b04a1ccc221ad77ba9 (diff)
Merge branch 'lukeshu/measurestack-fixes-round3'
-rw-r--r--lib9p/core_utf8.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib9p/core_utf8.h b/lib9p/core_utf8.h
index 636d4eb..2c451e0 100644
--- a/lib9p/core_utf8.h
+++ b/lib9p/core_utf8.h
@@ -7,10 +7,12 @@
#ifndef _LIB9P_CORE_UTF8_H_
#define _LIB9P_CORE_UTF8_H_
+#include <stddef.h> /* for size_t */
+#include <stdint.h> /* for uint{n}_t */
+
static inline bool _is_valid_utf8(uint8_t *str, size_t len, bool forbid_nul) {
uint32_t ch;
uint8_t chlen;
- assert(str);
for (size_t pos = 0; pos < len;) {
if ((str[pos] & 0b10000000) == 0b00000000) { ch = str[pos] & 0b01111111; chlen = 1; }
else if ((str[pos] & 0b11100000) == 0b11000000) { ch = str[pos] & 0b00011111; chlen = 2; }