summaryrefslogtreecommitdiffstats
path: root/utf8.c
diff options
context:
space:
mode:
authornicm <nicm>2016-05-27 22:57:27 +0000
committernicm <nicm>2016-05-27 22:57:27 +0000
commit9892d80d6fbc09c882cb7161938a59c5a1636f89 (patch)
tree35eba4a7722ec9475f0028d6a61fe93d13121945 /utf8.c
parentfcb00a4161f5634189322f42a5769ca83d4be8c8 (diff)
Most of the utf8_data is fixed so simplify utf8_set to use a memcpy.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/utf8.c b/utf8.c
index 56281aa2..eadefa11 100644
--- a/utf8.c
+++ b/utf8.c
@@ -32,16 +32,10 @@ static int utf8_width(wchar_t);
void
utf8_set(struct utf8_data *ud, u_char ch)
{
- u_int i;
+ static const struct utf8_data empty = { { 0 }, 1, 1, 1 };
+ memcpy(ud, &empty, sizeof *ud);
*ud->data = ch;
- ud->have = 1;
- ud->size = 1;
-
- ud->width = 1;
-
- for (i = ud->size; i < sizeof ud->data; i++)
- ud->data[i] = '\0';
}
/* Copy UTF-8 character. */