introduce bb_putchar(). saves ~1800 on uclibc (less on glibc).
This commit is contained in:
@@ -38,12 +38,12 @@ int dmesg_main(int argc, char **argv)
|
||||
|
||||
for (in = 0; in<len;) {
|
||||
if (last == '\n' && buf[in] == '<') in += 3;
|
||||
else putchar(last = buf[in++]);
|
||||
else bb_putchar(last = buf[in++]);
|
||||
}
|
||||
if (last != '\n') putchar('\n');
|
||||
if (last != '\n') bb_putchar('\n');
|
||||
} else {
|
||||
write(1,buf,len);
|
||||
if (len && buf[len-1]!='\n') putchar('\n');
|
||||
if (len && buf[len-1]!='\n') bb_putchar('\n');
|
||||
}
|
||||
|
||||
if (ENABLE_FEATURE_CLEAN_UP) free(buf);
|
||||
|
||||
@@ -892,7 +892,7 @@ list_types(const char *const *sys)
|
||||
next = ++done;
|
||||
}
|
||||
} while (done < last[0]);
|
||||
putchar('\n');
|
||||
bb_putchar('\n');
|
||||
}
|
||||
#endif /* FEATURE_FDISK_WRITABLE */
|
||||
|
||||
@@ -2473,13 +2473,13 @@ print_buffer(char *pbuffer)
|
||||
printf("0x%03X:", i);
|
||||
printf(" %02X", (unsigned char) pbuffer[i]);
|
||||
if (l == MAX_PER_LINE - 1) {
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
l = -1;
|
||||
}
|
||||
}
|
||||
if (l > 0)
|
||||
puts("");
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
bb_putchar('\n');
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2527,7 +2527,7 @@ xselect(void)
|
||||
char c;
|
||||
|
||||
while (1) {
|
||||
putchar('\n');
|
||||
bb_putchar('\n');
|
||||
c = tolower(read_nonempty("Expert command (m for help): "));
|
||||
switch (c) {
|
||||
case 'a':
|
||||
@@ -2588,7 +2588,7 @@ xselect(void)
|
||||
break;
|
||||
case 'q':
|
||||
close(fd);
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
exit(0);
|
||||
case 'r':
|
||||
return;
|
||||
@@ -2867,7 +2867,7 @@ int fdisk_main(int argc, char **argv)
|
||||
|
||||
while (1) {
|
||||
int c;
|
||||
putchar('\n');
|
||||
bb_putchar('\n');
|
||||
c = tolower(read_nonempty("Command (m for help): "));
|
||||
switch (c) {
|
||||
case 'a':
|
||||
@@ -2947,7 +2947,7 @@ int fdisk_main(int argc, char **argv)
|
||||
break;
|
||||
case 'q':
|
||||
close(fd);
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
return 0;
|
||||
case 's':
|
||||
#if ENABLE_FEATURE_SUN_LABEL
|
||||
|
||||
@@ -394,7 +394,7 @@ bsd_select(void)
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
putchar('\n');
|
||||
bb_putchar('\n');
|
||||
switch (tolower(read_nonempty("BSD disklabel command (m for help): "))) {
|
||||
case 'd':
|
||||
xbsd_delete_part();
|
||||
@@ -521,7 +521,7 @@ xbsd_print_disklabel(int show_all)
|
||||
printf(" ecc");
|
||||
if (lp->d_flags & BSD_D_BADSECT)
|
||||
printf(" badsect");
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
/* On various machines the fields of *lp are short/int/long */
|
||||
/* In order to avoid problems, we cast them all to long. */
|
||||
printf("bytes/sector: %ld\n", (long) lp->d_secsize);
|
||||
@@ -588,7 +588,7 @@ xbsd_print_disklabel(int show_all)
|
||||
printf("%22.22s", "");
|
||||
break;
|
||||
}
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,12 +307,12 @@ static int ask(const char *string, int def)
|
||||
int c;
|
||||
|
||||
if (!repair) {
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
errors_uncorrected = 1;
|
||||
return 0;
|
||||
}
|
||||
if (automatic) {
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
if (!def)
|
||||
errors_uncorrected = 1;
|
||||
return def;
|
||||
|
||||
@@ -195,7 +195,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru
|
||||
printf(" --");
|
||||
while (optind < argc)
|
||||
printf(" %s", normalize(argv[optind++]));
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
}
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
@@ -555,7 +555,7 @@ static void print_sem(int semid)
|
||||
}
|
||||
printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);
|
||||
}
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
}
|
||||
|
||||
int ipcs_main(int argc, char **argv);
|
||||
@@ -603,19 +603,19 @@ int ipcs_main(int argc, char **argv)
|
||||
|
||||
if (!(flags & (flag_shm | flag_msg | flag_sem)))
|
||||
flags |= flag_msg | flag_shm | flag_sem;
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
|
||||
if (flags & flag_shm) {
|
||||
do_shm();
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
}
|
||||
if (flags & flag_sem) {
|
||||
do_sem();
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
}
|
||||
if (flags & flag_msg) {
|
||||
do_msg();
|
||||
puts("");
|
||||
bb_putchar('\n');
|
||||
}
|
||||
fflush_stdout_and_exit(0);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ struct globals {
|
||||
|
||||
static void gotsig(int sig)
|
||||
{
|
||||
putchar('\n');
|
||||
bb_putchar('\n');
|
||||
setTermSettings(cin_fileno, &initial_settings);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user