summaryrefslogtreecommitdiff
path: root/src/seq.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-10-15 23:10:35 +0100
committerPádraig Brady <P@draigBrady.com>2016-10-16 12:23:55 +0100
commit492dcb2eb191b844a2fd5e51db3eed85289bea1f (patch)
tree910f93d88891b573520ebd5c812d61ddc7fbeed8 /src/seq.c
parentd035eacfdeba2da0134e606c8a63b2f3c0bd05bb (diff)
downloadcoreutils-492dcb2eb191b844a2fd5e51db3eed85289bea1f.tar.xz
all: use die() rather than error(EXIT_FAILURE)
die() has the advantage of being apparent to the compiler that it doesn't return, which will avoid warnings in some cases, and possibly generate better code. * cfg.mk (sc_die_EXIT_FAILURE): A new syntax check rule to catch any new uses of error (CONSTANT, ...);
Diffstat (limited to 'src/seq.c')
-rw-r--r--src/seq.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/seq.c b/src/seq.c
index 1b9da40fb..d2e4602df 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -22,6 +22,7 @@
#include <sys/types.h>
#include "system.h"
+#include "die.h"
#include "c-strtod.h"
#include "error.h"
#include "quote.h"
@@ -235,8 +236,8 @@ long_double_format (char const *fmt, struct layout *layout)
for (i = 0; ! (fmt[i] == '%' && fmt[i + 1] != '%'); i += (fmt[i] == '%') + 1)
{
if (!fmt[i])
- error (EXIT_FAILURE, 0,
- _("format %s has no %% directive"), quote (fmt));
+ die (EXIT_FAILURE, 0,
+ _("format %s has no %% directive"), quote (fmt));
prefix_len++;
}
@@ -253,15 +254,15 @@ long_double_format (char const *fmt, struct layout *layout)
has_L = (fmt[i] == 'L');
i += has_L;
if (fmt[i] == '\0')
- error (EXIT_FAILURE, 0, _("format %s ends in %%"), quote (fmt));
+ die (EXIT_FAILURE, 0, _("format %s ends in %%"), quote (fmt));
if (! strchr ("efgaEFGA", fmt[i]))
- error (EXIT_FAILURE, 0,
- _("format %s has unknown %%%c directive"), quote (fmt), fmt[i]);
+ die (EXIT_FAILURE, 0,
+ _("format %s has unknown %%%c directive"), quote (fmt), fmt[i]);
for (i++; ; i += (fmt[i] == '%') + 1)
if (fmt[i] == '%' && fmt[i + 1] != '%')
- error (EXIT_FAILURE, 0, _("format %s has too many %% directives"),
- quote (fmt));
+ die (EXIT_FAILURE, 0, _("format %s has too many %% directives"),
+ quote (fmt));
else if (fmt[i])
suffix_len++;
else
@@ -282,9 +283,8 @@ static void ATTRIBUTE_NORETURN
io_error (void)
{
/* FIXME: consider option to silently ignore errno=EPIPE */
- error (0, errno, _("standard output"));
clearerr (stdout);
- exit (EXIT_FAILURE);
+ die (EXIT_FAILURE, errno, _("standard output"));
}
/* Actually print the sequence of numbers in the specified range, with the