diff options
Diffstat (limited to 'source/shared.h')
| -rw-r--r-- | source/shared.h | 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 12 insertions, 0 deletions
diff --git a/source/shared.h b/source/shared.h index d61c1f1..ca2ac6a 100644 --- a/source/shared.h +++ b/source/shared.h @@ -90,6 +90,18 @@ extern int cgit_read_first_line(const char *path, char **buf, size_t *size); extern char *cgit_strdup_first_line(const char *text); /* + * How many bytes the UTF-8 sequence at p holds, or 0 when it is invalid, + * looking at most left bytes ahead. + */ +extern size_t cgit_utf8_seq_len(const unsigned char *p, size_t left); + +/* + * Replace every byte of text that is not part of a valid UTF-8 sequence with + * a question mark, in place. + */ +extern void cgit_utf8_sanitize(char *text); + +/* * Replace every $token in text with the matching environment variable. The * result is a static buffer, so a caller that needs to keep it must copy it. */ |
