From c0cf0ff431197fe02839ed05cd2e7dd2b6d5cdae Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Fri, 29 Jun 2007 17:33:29 +0100 Subject: [PATCH 2/4] add sparse_keep_tokens api to lib.h Adds sparse_keep_tokens, which is the same as __sparse, but doesn't free the tokens after parsing. Useful fow ehen you want to inspect macro symbols after parsing. Signed-off-by: Rob Taylor --- lib.c | 13 ++++++++++++- lib.h | 1 + 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/lib.c b/lib.c index 7fea474..aba547a 100644 --- a/lib.c +++ b/lib.c @@ -741,7 +741,7 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list return list; } -struct symbol_list * __sparse(char *filename) +struct symbol_list * sparse_keep_tokens(char *filename) { struct symbol_list *res; @@ -751,6 +751,17 @@ struct symbol_list * __sparse(char *filename) new_file_scope(); res = sparse_file(filename); + /* And return it */ + return res; +} + + +struct symbol_list * __sparse(char *filename) +{ + struct symbol_list *res; + + res = sparse_keep_tokens(filename); + /* Drop the tokens for this file after parsing */ clear_token_alloc(); diff --git a/lib.h b/lib.h index bc2a8c2..aacafea 100644 --- a/lib.h +++ b/lib.h @@ -113,6 +113,7 @@ extern void declare_builtin_functions(void); extern void create_builtin_stream(void); extern struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list **files); extern struct symbol_list *__sparse(char *filename); +extern struct symbol_list *sparse_keep_tokens(char *filename); extern struct symbol_list *sparse(char *filename); static inline int symbol_list_size(struct symbol_list *list) -- 1.5.2-rc3.GIT