From: Florian Westphal <fw@strlen.de>
To: Thomas Haller <thaller@redhat.com>
Cc: NetFilter <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH nft 2/3] parser: remove "const" from argument of input_descriptor_destroy()
Date: Wed, 15 Nov 2023 10:42:04 +0100 [thread overview]
Message-ID: <20231115094204.GB23632@breakpoint.cc> (raw)
In-Reply-To: <20231109190032.669575-2-thaller@redhat.com>
Thomas Haller <thaller@redhat.com> wrote:
> It's not a const pointer, as the destroy() function clearly
> modifies/free is. Drop the const from the argument of
> input_descriptor_destroy().
>
> Signed-off-by: Thomas Haller <thaller@redhat.com>
> ---
> src/scanner.l | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/scanner.l b/src/scanner.l
> index 00a09485d420..31284d7358fa 100644
> --- a/src/scanner.l
> +++ b/src/scanner.l
> @@ -1258,11 +1258,11 @@ void *scanner_init(struct parser_state *state)
> return scanner;
> }
>
> -static void input_descriptor_destroy(const struct input_descriptor *indesc)
> +static void input_descriptor_destroy(struct input_descriptor *indesc)
> {
> if (indesc->name)
> free_const(indesc->name);
> - free_const(indesc);
> + free(indesc);
I don't agree, this is fine as-is.
next prev parent reply other threads:[~2023-11-15 9:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-09 18:59 [PATCH nft 1/3] parser: don't mark "string" as const Thomas Haller
2023-11-09 18:59 ` [PATCH nft 2/3] parser: remove "const" from argument of input_descriptor_destroy() Thomas Haller
2023-11-15 9:42 ` Florian Westphal [this message]
2023-11-09 18:59 ` [PATCH nft 3/3] parser: use size_t type for strlen() results Thomas Haller
2023-11-15 9:41 ` Florian Westphal
2023-11-09 19:22 ` [PATCH nft 1/3] parser: don't mark "string" as const Pablo Neira Ayuso
2023-11-09 20:34 ` Thomas Haller
2023-11-09 23:10 ` Florian Westphal
2023-11-10 8:09 ` Thomas Haller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231115094204.GB23632@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=thaller@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).