maint: move two small functions, so we can remove a fwd decl

* src/dd.c (cleanup, quit): Move the definition of quit to follow the
definition of process_signals, so we can remove the declaration of
the latter.
This commit is contained in:
Jim Meyering committed 2011-04-26 09:02:44 +02:00
1 parent 512825f9ba
commit d891fe81f7
1 file changed
+24 -26
+24 -26
View File
@@ -37,8 +37,6 @@
#include "xstrtol.h"
#include "xtime.h"
static void process_signals (void);
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "dd"
@@ -674,30 +672,6 @@ print_stats (void)
fprintf (stderr, _(", %g s, %s/s\n"), delta_s, bytes_per_second);
}
static void
cleanup (void)
{
if (close (STDIN_FILENO) < 0)
error (EXIT_FAILURE, errno,
_("closing input file %s"), quote (input_file));
/* Don't remove this call to close, even though close_stdout
closes standard output. This close is necessary when cleanup
is called as part of a signal handler. */
if (close (STDOUT_FILENO) < 0)
error (EXIT_FAILURE, errno,
_("closing output file %s"), quote (output_file));
}
static void ATTRIBUTE_NORETURN
quit (int code)
{
cleanup ();
print_stats ();
process_signals ();
exit (code);
}
/* An ordinary signal was received; arrange for the program to exit. */
static void
@@ -772,6 +746,21 @@ install_signal_handlers (void)
#endif
}
static void
cleanup (void)
{
if (close (STDIN_FILENO) < 0)
error (EXIT_FAILURE, errno,
_("closing input file %s"), quote (input_file));
/* Don't remove this call to close, even though close_stdout
closes standard output. This close is necessary when cleanup
is called as part of a signal handler. */
if (close (STDOUT_FILENO) < 0)
error (EXIT_FAILURE, errno,
_("closing output file %s"), quote (output_file));
}
/* Process any pending signals. If signals are caught, this function
should be called periodically. Ideally there should never be an
unbounded amount of time when signals are not being processed. */
@@ -805,6 +794,15 @@ process_signals (void)
}
}
static void ATTRIBUTE_NORETURN
quit (int code)
{
cleanup ();
print_stats ();
process_signals ();
exit (code);
}
/* Return LEN rounded down to a multiple of PAGE_SIZE
while storing the remainder internally per FD.
Pass LEN == 0 to get the current remainder. */