diff options
author | Denys Vlasenko | 2010-10-23 21:06:06 +0200 |
---|---|---|
committer | Denys Vlasenko | 2010-10-23 21:06:06 +0200 |
commit | 53600591311a129717abd2e3bcaa302622a6ce67 (patch) | |
tree | 4b0d08ed429d4b73a9739339e74d84a8a72fe25e /coreutils/printf.c | |
parent | 6a0d7490ea6ad97aeafb9da04acab13bd3c38e4d (diff) | |
download | busybox-53600591311a129717abd2e3bcaa302622a6ce67.zip busybox-53600591311a129717abd2e3bcaa302622a6ce67.tar.gz |
libbb: introduce and use strcpy_and_process_escape_sequences
function old new delta
strcpy_and_process_escape_sequences - 50 +50
bb_process_escape_sequence 148 138 -10
printf_main 789 776 -13
getty_main 1897 1831 -66
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 50/-89) Total: -39 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/printf.c')
-rw-r--r-- | coreutils/printf.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/coreutils/printf.c b/coreutils/printf.c index 2cc2384..c8395fa 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c @@ -122,16 +122,14 @@ static double my_xstrtod(const char *arg) return result; } -static void print_esc_string(char *str) +static void print_esc_string(const char *str) { - while (*str) { - if (*str == '\\') { - str++; - bb_putchar(bb_process_escape_sequence((const char **)&str)); - } else { - bb_putchar(*str); - str++; - } + char c; + while ((c = *str) != '\0') { + str++; + if (c == '\\') + c = bb_process_escape_sequence(&str); + putchar(c); } } @@ -344,7 +342,7 @@ static char **print_formatted(char *f, char **argv, int *conv_err) f--; break; default: - bb_putchar(*f); + putchar(*f); } } |