From 1b161c3404f1d781ac95c4ad29e21ec1f61e63b6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 31 Jan 2022 08:42:07 -0800 Subject: [PATCH 24/43] cut: simplify -fsanitize=leak pacification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/set-fields.c (reset_fields): Remove, as it’s not needed for -fsanitize=leak even when ‘lint’ is defined. All uses removed. --- src/cut.c | 2 -- src/set-fields.c | 9 --------- src/set-fields.h | 3 --- 3 files changed, 14 deletions(-) diff --git a/src/cut.c b/src/cut.c index 5143c8bd9..ac874c3f8 100644 --- a/src/cut.c +++ b/src/cut.c @@ -602,7 +602,5 @@ main (int argc, char **argv) ok = false; } - IF_LINT (reset_fields ()); - return ok ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/src/set-fields.c b/src/set-fields.c index e3cce30d9..575dc2784 100644 --- a/src/set-fields.c +++ b/src/set-fields.c @@ -308,12 +308,3 @@ set_fields (char const *fieldstr, unsigned int options) frp = xrealloc (frp, n_frp * sizeof (struct field_range_pair)); frp[n_frp - 1].lo = frp[n_frp - 1].hi = UINTMAX_MAX; } - -void -reset_fields (void) -{ - n_frp = 0 ; - n_frp_allocated = 0; - free (frp); - frp = NULL; -} diff --git a/src/set-fields.h b/src/set-fields.h index 7bc9b3afe..3e7613a98 100644 --- a/src/set-fields.h +++ b/src/set-fields.h @@ -41,7 +41,4 @@ enum /* allocates and initializes the FRP array and N_FRP count */ extern void set_fields (char const *fieldstr, unsigned int options); -/* frees memory allocated by set_fields() */ -extern void reset_fields (void); - #endif -- 2.32.0