From: Oleg Nesterov <oleg@redhat.com>
To: Chris Li <sparse@chrisli.org>, Luc Van Oostenryck <lucvoo@kernel.org>
Cc: Alexey Gladkov <legion@kernel.org>, linux-sparse@vger.kernel.org
Subject: [PATCH] sparse/dissect: change do_file() to use __sparse()
Date: Sun, 28 Dec 2025 13:55:15 +0100 [thread overview]
Message-ID: <aVEos-vrx34olo6s@redhat.com> (raw)
rather than do sparse_keep_tokens/clear_token_alloc by hand.
dissect/semind doesn't need/use tokens, we can safely do
drop_all_allocations(token_allocator) after parsing.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
dissect.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/dissect.c b/dissect.c
index 62f927c5..55e76846 100644
--- a/dissect.c
+++ b/dissect.c
@@ -681,14 +681,10 @@ static inline bool valid_namespace(enum namespace ns)
return (ns == NS_TYPEDEF || ns == NS_MACRO || ns == NS_UNDEF || ns == NS_STRUCT || ns == NS_SYMBOL);
}
-static void do_file(char *file)
+static void do_file(struct symbol_list *res)
{
- struct symbol_list *res = sparse_keep_tokens(file);
-
- if (!dissect_show_all_symbols) {
- do_sym_list(res);
- goto end;
- }
+ if (!dissect_show_all_symbols)
+ return do_sym_list(res);
DO_LIST(file_scope->symbols, sym,
if (input_streams[sym->pos.stream].fd != -1 && valid_namespace(sym->namespace)) {
@@ -719,10 +715,6 @@ static void do_file(char *file)
do_symbol(sym);
}
);
-
-end:
- /* Drop the tokens for this file after parsing */
- clear_token_alloc();
}
void dissect(struct reporter *rep, struct string_list *filelist)
@@ -730,5 +722,5 @@ void dissect(struct reporter *rep, struct string_list *filelist)
dissect_mode = 1;
reporter = rep;
- DO_LIST(filelist, file, do_file(file));
+ DO_LIST(filelist, file, do_file(__sparse(file)));
}
--
2.52.0
reply other threads:[~2025-12-28 12:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=aVEos-vrx34olo6s@redhat.com \
--to=oleg@redhat.com \
--cc=legion@kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=lucvoo@kernel.org \
--cc=sparse@chrisli.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.