summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/utf8.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux/utf8.c')
-rw-r--r--usr.bin/tmux/utf8.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/usr.bin/tmux/utf8.c b/usr.bin/tmux/utf8.c
index bb4583dcb24..05de823f65e 100644
--- a/usr.bin/tmux/utf8.c
+++ b/usr.bin/tmux/utf8.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utf8.c,v 1.19 2015/11/12 22:04:37 nicm Exp $ */
+/* $OpenBSD: utf8.c,v 1.20 2015/11/13 08:09:28 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -352,10 +352,27 @@ static void utf8_build(void);
void
utf8_set(struct utf8_data *ud, u_char ch)
{
+ u_int i;
+
*ud->data = ch;
ud->size = 1;
ud->width = 1;
+
+ for (i = ud->size; i < sizeof ud->data; i++)
+ ud->data[i] = '\0';
+}
+
+/* Copy UTF-8 character. */
+void
+utf8_copy(struct utf8_data *to, const struct utf8_data *from)
+{
+ u_int i;
+
+ memcpy(to, from, sizeof *to);
+
+ for (i = to->size; i < sizeof to->data; i++)
+ to->data[i] = '\0';
}
/*