coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Jim Meyering
Subject: [PATCH] maint: move two small functions, so we can remove a fwd decl
Date: Tue, 26 Apr 2011 09:41:58 +0200

Looking at dd.c I noticed an unnecessary forward declaration
and saw it was easy to remove, so...

>From d891fe81f7f774aa19857c888e5924aecf421ebe Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 26 Apr 2011 09:02:44 +0200
Subject: [PATCH] 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.
---
 src/dd.c |   50 ++++++++++++++++++++++++--------------------------
 1 files changed, 24 insertions(+), 26 deletions(-)

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.  */
--
1.7.5.rc3.316.gd1ff9



reply via email to

[Prev in Thread] Current Thread [Next in Thread]