From 1e5f5f0a74a21dfe1119c3fdf5ee7410af609623 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Wed, 27 Jun 2007 01:33:26 +0100 Subject: [PATCH 2/3] 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. --- 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