utf8_width(): allow non NUL-terminated input

The original interface assumed that the input string is
always terminated with a NUL, but that wasn't too useful.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2008-01-02 01:49:58 -08:00
parent 396ccf1fcb
commit 44b25b872f
2 changed files with 54 additions and 34 deletions

4
utf8.h
View File

@ -3,8 +3,8 @@
typedef unsigned int ucs_char_t; /* assuming 32bit int */
ucs_char_t pick_one_utf8_char(const char **start);
int utf8_width(const char **start);
ucs_char_t pick_one_utf8_char(const char **start, size_t *remainder_p);
int utf8_width(const char **start, size_t *remainder_p);
int is_utf8(const char *text);
int is_encoding_utf8(const char *name);