summaryrefslogtreecommitdiff
path: root/tools/vsh-table.c
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2020-01-17 13:40:54 +0000
committerDaniel P. Berrangé <berrange@redhat.com>2020-01-29 14:51:39 +0000
commit6485c2c0ae65225e52bb011f091df83ff3cdb1f5 (patch)
tree707935d2faafe68e2c3aa44f690504fefa99bf11 /tools/vsh-table.c
parent540cf039262d74993f490272fe54e329497b4446 (diff)
downloadlibvirt-6485c2c0ae65225e52bb011f091df83ff3cdb1f5.tar.gz
tools: replace wcwidth() with g_unichar_* APIs
The combination of g_unichar_iszerowidth and g_unichar_iswide is sufficient to replicate the logic of wcwidth() for libvirt. Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'tools/vsh-table.c')
-rw-r--r--tools/vsh-table.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/vsh-table.c b/tools/vsh-table.c
index a2365b2c32..e21514e86f 100644
--- a/tools/vsh-table.c
+++ b/tools/vsh-table.c
@@ -261,7 +261,7 @@ vshTableSafeEncode(const char *s, size_t *width)
} else {
memcpy(buf, p, len);
buf += len;
- *width += wcwidth(wc);
+ *width += g_unichar_iszerowidth(wc) ? 0 : (g_unichar_iswide(wc) ? 2 : 1);
}
p += len;
}