From: Paul Eggert Date: Sat, 9 Nov 2024 07:16:45 +0000 (-0800) Subject: seq: seq_fast always exits now X-Git-Tag: v9.6~83 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6db4b33eb9f2461967a8e8305bf819b7976877eb;p=thirdparty%2Fcoreutils.git seq: seq_fast always exits now * src/seq.c (seq_fast): Always exit. Don’t bother freeing just before exit. --- diff --git a/src/seq.c b/src/seq.c index 613d3d66d9..1b3be26bae 100644 --- a/src/seq.c +++ b/src/seq.c @@ -453,8 +453,7 @@ trim_leading_zeros (char const *s) } /* Print all whole numbers from A to B, inclusive -- to stdout, each - followed by a newline. If B < A, return and print nothing. - Otherwise, do all the work and exit. */ + followed by a newline. Then exit. */ static void seq_fast (char const *a, char const *b, uintmax_t step) { @@ -521,18 +520,17 @@ seq_fast (char const *a, char const *b, uintmax_t step) p -= incr_grows (p, endp); } - /* If there was output, write the remaining buffered output with a - terminator instead of a separator; then exit. */ + /* Write the remaining buffered output with a terminator instead of + a separator. */ idx_t remaining = bufp - buf; if (remaining) { bufp[-1] = *terminator; if (full_write (STDOUT_FILENO, buf, remaining) != remaining) write_error (); - exit (EXIT_SUCCESS); } - free (p0); + exit (EXIT_SUCCESS); } /* Return true if S consists of at least one digit and no non-digits. */ @@ -652,8 +650,6 @@ main (int argc, char **argv) char const *s1 = n_args == 1 ? "1" : argv[optind]; char const *s2 = argv[optind + (n_args - 1)]; seq_fast (s1, s2, step.value); - - /* Upon any failure, let the more general code deal with it. */ } last = scan_arg (argv[optind++]);