1 /* vi: set sw=4 ts=4: */
3 * Unicode support routines.
5 * Copyright (C) 2010 Denys Vlasenko
7 * Licensed under GPLv2, see file LICENSE in this source tree.
12 const char* FAST_FUNC printable_string(uni_stat_t *stats, const char *str)
21 /* 99+% of inputs do not need conversion */
23 stats->byte_count = (s - str);
24 stats->unicode_count = (s - str);
25 stats->unicode_width = (s - str);
36 #if ENABLE_UNICODE_SUPPORT
37 dst = unicode_conv_to_printable(stats, str);
40 char *d = dst = xstrdup(str);
45 if (c < ' ' || c >= 0x7f)
50 stats->byte_count = (d - dst);
51 stats->unicode_count = (d - dst);
52 stats->unicode_width = (d - dst);
56 return auto_string(dst);