* [PATCH] sparse/dissect: change do_file() to use __sparse()
@ 2025-12-28 12:55 Oleg Nesterov
0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2025-12-28 12:55 UTC (permalink / raw)
To: Chris Li, Luc Van Oostenryck; +Cc: Alexey Gladkov, linux-sparse
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-28 12:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-28 12:55 [PATCH] sparse/dissect: change do_file() to use __sparse() Oleg Nesterov
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).