mirror of
https://github.com/sheumann/hush.git
synced 2024-12-23 05:29:58 +00:00
expand: use printable_string instead of hard-coding implementation
function old new delta expand_main 709 690 -19 Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
0b3a38b9f5
commit
22bb81fa85
@ -78,11 +78,7 @@ static void expand(FILE *file, unsigned tab_size, unsigned opt)
|
|||||||
unsigned len;
|
unsigned len;
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
# if ENABLE_UNICODE_SUPPORT
|
# if ENABLE_UNICODE_SUPPORT
|
||||||
{
|
len = unicode_strwidth(ptr_strbeg);
|
||||||
uni_stat_t uni_stat;
|
|
||||||
printable_string(&uni_stat, ptr_strbeg);
|
|
||||||
len = uni_stat.unicode_width;
|
|
||||||
}
|
|
||||||
# else
|
# else
|
||||||
len = ptr - ptr_strbeg;
|
len = ptr - ptr_strbeg;
|
||||||
# endif
|
# endif
|
||||||
@ -138,12 +134,9 @@ static void unexpand(FILE *file, unsigned tab_size, unsigned opt)
|
|||||||
printf("%*s%.*s", len, "", n, ptr);
|
printf("%*s%.*s", len, "", n, ptr);
|
||||||
# if ENABLE_UNICODE_SUPPORT
|
# if ENABLE_UNICODE_SUPPORT
|
||||||
{
|
{
|
||||||
char c;
|
char c = ptr[n];
|
||||||
uni_stat_t uni_stat;
|
|
||||||
c = ptr[n];
|
|
||||||
ptr[n] = '\0';
|
ptr[n] = '\0';
|
||||||
printable_string(&uni_stat, ptr);
|
len = unicode_strwidth(ptr);
|
||||||
len = uni_stat.unicode_width;
|
|
||||||
ptr[n] = c;
|
ptr[n] = c;
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
|
Loading…
Reference in New Issue
Block a user