diff options
Diffstat (limited to 'wtf8.c')
-rw-r--r-- | wtf8.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -13,19 +13,15 @@ int is_utf8_cont(char c) { * trailing space, ending with a newline */ void print_octets(char *s) { + unsigned char c; /* - * Iterate through the string, printing each octet - */ - for (; *s; s++) { - putchar(is_utf8_cont(*s) ? '-' : ' '); - printf("%02x", (unsigned char) *s); - } - - /* - * End with a newline + * Iterate through the string, printing each octet, ending with a newline */ + while (c = *s++) + printf("%c%02x", (is_utf8_cont(c) ? '-' : ' '), c); putchar('\n'); + return; } |