From: Jim Meyering Date: Tue, 26 Apr 2011 07:02:44 +0000 (+0200) Subject: maint: move two small functions, so we can remove a fwd decl X-Git-Tag: v8.12~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d891fe81f7f774aa19857c888e5924aecf421ebe;p=platform%2Fupstream%2Fcoreutils.git 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. --- diff --git a/src/dd.c b/src/dd.c index 3472442..cb626fc 100644 --- a/src/dd.c +++ b/src/dd.c @@ -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. */