summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-04-26 09:02:44 +0200
committerJim Meyering <meyering@redhat.com>2011-04-26 09:02:44 +0200
commitd891fe81f7f774aa19857c888e5924aecf421ebe (patch)
treed315a82bf6f4a5d5a9c83986dfea06125eb55f40 /src
parent512825f9ba25a679933e27dd7f80330e8fd9c905 (diff)
downloadcoreutils-d891fe81f7f774aa19857c888e5924aecf421ebe.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/dd.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/src/dd.c b/src/dd.c
index 3472442ea..cb626fc49 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. */