| * Unicode support routines. |
| * Copyright (C) 2010 Denys Vlasenko |
| * Licensed under GPL version 2, see file LICENSE in this tarball for details. |
| const char* FAST_FUNC printable_string(uni_stat_t *stats, const char *str) |
| static unsigned cur_saved; /* = 0 */ |
| /* 99+% of inputs do not need conversion */ |
| stats->byte_count = (s - str); |
| stats->unicode_count = (s - str); |
| stats->unicode_width = (s - str); |
| #if ENABLE_UNICODE_SUPPORT |
| dst = unicode_conv_to_printable(stats, str); |
| char *d = dst = xstrdup(str); |
| if (c < ' ' || c >= 0x7f) |
| stats->byte_count = (d - dst); |
| stats->unicode_count = (d - dst); |
| stats->unicode_width = (d - dst); |
| cur_saved = (cur_saved + 1) & (ARRAY_SIZE(saved)-1); |