Simplify print function, prints an extra space if no filename, but saves 4 bytes
No binary (build failed)
—
$ git checkout -f 1477ad8e8319a3ef4623b699083295a0fd560adf HEAD is now at 1477ad8e8 Simplify print function, prints an extra space if no filename, but saves 4 bytes $ git clean -fdx Removing .menuconfig.log Removing MCmenu0 Removing MCmenu1 Removing MCmenu2 Removing MCmenu3 Removing MCmenu4 Removing include/config/ Removing scripts/lxdialog/checklist.o Removing scripts/lxdialog/inputbox.o Removing scripts/lxdialog/lxdialog Removing scripts/lxdialog/lxdialog.o Removing scripts/lxdialog/menubox.o Removing scripts/lxdialog/msgbox.o Removing scripts/lxdialog/textbox.o Removing scripts/lxdialog/util.o Removing scripts/lxdialog/yesno.o $ make SHELL=/bin/bash CC=/root/asi_db/compat/cc-wrapper.sh HOSTCC=/root/asi_db/compat/cc-wrapper.sh defconfig make: *** No rule to make target 'defconfig'. Stop. $ make SHELL=/bin/bash CC=/root/asi_db/compat/cc-wrapper.sh HOSTCC=/root/asi_db/compat/cc-wrapper.sh allnoconfig make: *** No rule to make target 'allnoconfig'. Stop. $ make SHELL=/bin/bash CC=/root/asi_db/compat/cc-wrapper.sh HOSTCC=/root/asi_db/compat/cc-wrapper.sh include/bb_config.h make: *** No rule to make target 'include/bb_config.h'. Stop. $ make SHELL=/bin/bash CC=/root/asi_db/compat/cc-wrapper.sh HOSTCC=/root/asi_db/compat/cc-wrapper.sh -j3 V=1 [TIMEOUT]
| @@ -39,24 +39,21 @@ enum print_e { | |
| static void print_counts(int lines, int words, int chars, int length, | |
| const char *name) | |
| { | |
| - | char const *space = ""; |
| - | |
| if (print_type & print_lines) { | |
| - | printf("%7d", lines); |
| - | space = " "; |
| + | printf("%7d ", lines); |
| } | |
| if (print_type & print_words) { | |
| - | printf("%s%7d", space, words); |
| - | space = " "; |
| + | printf("%7d ", words); |
| } | |
| if (print_type & print_chars) { | |
| - | printf("%s%7d", space, chars); |
| - | space = " "; |
| + | printf("%7d ", chars); |
| + | } |
| + | if (print_type & print_length) { |
| + | printf("%7d ", length); |
| + | } |
| + | if (*name) { |
| + | printf("%s", name); |
| } | |
| - | if (print_type & print_length) |
| - | printf("%s%7d", space, length); |
| - | if (*name) |
| - | printf(" %s", name); |
| putchar('\n'); | |
| } | |
| @@ -142,7 +139,7 @@ int wc_main(int argc, char **argv) | |
| } | |
| if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) { | |
| - | wc_file(stdin, ""); |
| + | wc_file(stdin, NULL); |
| return EXIT_SUCCESS; | |
| } else { | |
| while (optind < argc) { | |