]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/gunicode.h
headers: add spdx tags to imported files with a known license
[thirdparty/systemd.git] / src / basic / gunicode.h
CommitLineData
448e7440 1/* SPDX-License-Identifier: LGPL-2.1+ */
f405e86d
SL
2/* gunicode.h - Unicode manipulation functions
3 *
4 * Copyright (C) 1999, 2000 Tom Tromey
96b2fb93 5 * Copyright © 2000, 2005 Red Hat, Inc.
f405e86d 6 */
448e7440 7#pragma once
f405e86d 8
f405e86d 9#include <stdbool.h>
71d35b6b 10#include <stdint.h>
f405e86d
SL
11#include <stdlib.h>
12
13char *utf8_prev_char (const char *p);
14
15extern const char utf8_skip_data[256];
16
17/**
18 * g_utf8_next_char:
19 * @p: Pointer to the start of a valid UTF-8 character
20 *
21 * Skips to the next character in a UTF-8 string. The string must be
22 * valid; this macro is as fast as possible, and has no error-checking.
23 * You would use this macro to iterate over a string character by
24 * character. The macro returns the start of the next UTF-8 character.
25 * Before using this macro, use g_utf8_validate() to validate strings
26 * that may contain invalid UTF-8.
27 */
28#define utf8_next_char(p) (char *)((p) + utf8_skip_data[*(const unsigned char *)(p)])
29
30bool unichar_iswide (uint32_t c);