mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Merge branch 'obsd-master'
This commit is contained in:
14
utf8.c
14
utf8.c
@ -218,6 +218,20 @@ utf8_strvis(char *dst, const char *src, size_t len, int flag)
|
||||
return (dst - start);
|
||||
}
|
||||
|
||||
/* Same as utf8_strvis but allocate the buffer. */
|
||||
int
|
||||
utf8_stravis(char **dst, const char *src, int flag)
|
||||
{
|
||||
char *buf;
|
||||
int len;
|
||||
|
||||
buf = xreallocarray(NULL, 4, strlen(src) + 1);
|
||||
len = utf8_strvis(buf, src, strlen(src), flag);
|
||||
|
||||
*dst = xrealloc(buf, len + 1);
|
||||
return (len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sanitize a string, changing any UTF-8 characters to '_'. Caller should free
|
||||
* the returned string. Anything not valid printable ASCII or UTF-8 is
|
||||
|
Reference in New Issue
Block a user