summaryrefslogtreecommitdiffstats
path: root/utf8.c
diff options
context:
space:
mode:
authornicm <nicm>2020-07-21 05:24:33 +0000
committernicm <nicm>2020-07-21 05:24:33 +0000
commit743ab5728da1ce950a3782d5bc08831f61c5d744 (patch)
treeb34d8f6f4c9a3bf2883da0c6a1120d14bebbcb41 /utf8.c
parent3b089fc69f3b111797e36bd2a881fff6b8cb5213 (diff)
Fix show-buffer when run from inside tmux, GitHub issue 2314.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index e3fe570d..36c9daad 100644
--- a/utf8.c
+++ b/utf8.c
@@ -341,6 +341,20 @@ utf8_stravis(char **dst, const char *src, int flag)
return (len);
}
+/* Same as utf8_strvis but allocate the buffer. */
+int
+utf8_stravisx(char **dst, const char *src, size_t srclen, int flag)
+{
+ char *buf;
+ int len;
+
+ buf = xreallocarray(NULL, 4, srclen + 1);
+ len = utf8_strvis(buf, src, srclen, flag);
+
+ *dst = xrealloc(buf, len + 1);
+ return (len);
+}
+
/* Does this string contain anything that isn't valid UTF-8? */
int
utf8_isvalid(const char *s)