mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
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>
This commit is contained in:
parent
540cf03926
commit
6485c2c0ae
@ -19,6 +19,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <wchar.h>
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
@ -261,7 +261,7 @@ vshTableSafeEncode(const char *s, size_t *width)
|
|||||||
} else {
|
} else {
|
||||||
memcpy(buf, p, len);
|
memcpy(buf, p, len);
|
||||||
buf += len;
|
buf += len;
|
||||||
*width += wcwidth(wc);
|
*width += g_unichar_iszerowidth(wc) ? 0 : (g_unichar_iswide(wc) ? 2 : 1);
|
||||||
}
|
}
|
||||||
p += len;
|
p += len;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user