Debian Codegraph @

src/utf8-decoding.h

raw
1 /*
2 * Copyright © 2024 Pierre Le Marre <[email protected]>
3 * SPDX-License-Identifier: MIT
4 */
5 #pragma once
6
7 #include "config.h"
8
9 #include <stddef.h>
10 #include <stdint.h>
11
12 /* Check if a char is the start of a UTF-8 sequence */
13 #define is_utf8_start(c) (((c) & 0xc0) != 0x80)
14 #define INVALID_UTF8_CODE_POINT UINT32_MAX
15
16 uint8_t
17 utf8_sequence_length(const char *s);
18
19 uint32_t
20 utf8_next_code_point(const char *s, size_t max_size, size_t *size_out);