aboutsummaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2015-11-13 10:42:45 +0000
committerThomas Adam <thomas@xteddy.org>2015-11-13 10:42:45 +0000
commit3df4959f51a444a83e92894c390182dd48e02025 (patch)
tree31591c7d439c6d3841e1610e4c2cf70d5f5d115c /utf8.c
parenta7027ed8e5d8fd314c1fafaf0c809b575a753a09 (diff)
parentc5689a5a4031a43769b8b721cafa6d1eab6abc44 (diff)
downloadrtmux-3df4959f51a444a83e92894c390182dd48e02025.tar.gz
rtmux-3df4959f51a444a83e92894c390182dd48e02025.tar.bz2
rtmux-3df4959f51a444a83e92894c390182dd48e02025.zip
Merge branch 'obsd-master'
Conflicts: Makefile
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index 781dbbbf..350d6c06 100644
--- a/utf8.c
+++ b/utf8.c
@@ -351,10 +351,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';
}
/*