*: introduce and use ffulsh_all()

function                                             old     new   delta
buffer_fill_and_print                                179     196     +17
fflush_all                                             -       9      +9
spawn                                                 87      92      +5
rtcwake_main                                         455     453      -2
...
alarm_intr                                            93      84      -9
readcmd                                             1072    1062     -10
bb_ask                                               345     333     -12
more_main                                            845     832     -13
flush_stdout_stderr                                   42      23     -19
xfflush_stdout                                        27       -     -27
flush_stderr                                          30       -     -30
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397)         Total: -366 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2009-11-02 14:19:51 +01:00
parent 0d8ea64af6
commit 8131eea3dc
49 changed files with 84 additions and 96 deletions

View File

@@ -189,7 +189,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
memset(&Z, 0, sizeof(Z));
INIT_G();
//fflush(NULL); - is this needed because of NOEXEC?
//fflush_all(); - is this needed because of NOEXEC?
for (n = 1; argv[n]; n++) {
int what;

View File

@@ -23,5 +23,5 @@ int dirname_main(int argc, char **argv)
puts(dirname(argv[1]));
return fflush(stdout);
return fflush_all();
}

View File

@@ -141,7 +141,7 @@ int echo_main(int argc UNUSED_PARAM, char **argv)
bb_putchar('\n');
}
ret:
return fflush(stdout);
return fflush_all();
}
/*-

View File

@@ -22,5 +22,5 @@ int hostid_main(int argc, char **argv UNUSED_PARAM)
printf("%lx\n", gethostid());
return fflush(stdout);
return fflush_all();
}

View File

@@ -18,5 +18,5 @@ int length_main(int argc, char **argv)
printf("%u\n", (unsigned)strlen(*argv));
return fflush(stdout);
return fflush_all();
}

View File

@@ -36,7 +36,7 @@ int logname_main(int argc, char **argv UNUSED_PARAM)
/* Using _r function - avoid pulling in static buffer from libc */
if (getlogin_r(buf, sizeof(buf)) == 0) {
puts(buf);
return fflush(stdout);
return fflush_all();
}
bb_perror_msg_and_die("getlogin");

View File

@@ -20,7 +20,7 @@ int pwd_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
if (buf != NULL) {
puts(buf);
free(buf);
return fflush(stdout);
return fflush_all();
}
return EXIT_FAILURE;

View File

@@ -95,5 +95,5 @@ int seq_main(int argc, char **argv)
if (n) /* if while loop executed at least once */
bb_putchar('\n');
return fflush(stdout);
return fflush_all();
}

View File

@@ -22,5 +22,5 @@ int whoami_main(int argc, char **argv UNUSED_PARAM)
/* Will complain and die if username not found */
puts(xuid2uname(geteuid()));
return fflush(stdout);
return fflush_all();
}