aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-09 13:30:53 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:04:14 -0700
commit82e54f31d5023c39bfddfa110ff565da3ecbc27c (patch)
tree50bab619534f9e5693a6b18856ef39bba95bae45 /pre-process.c
parentMake the pre-processor free the tokens that never make it (diff)
downloadsparse-82e54f31d5023c39bfddfa110ff565da3ecbc27c.tar.gz
sparse-82e54f31d5023c39bfddfa110ff565da3ecbc27c.tar.bz2
sparse-82e54f31d5023c39bfddfa110ff565da3ecbc27c.zip
Free more token memory for re-use
It now re-uses the '#' token for all preprocessor lines, and the 'define' token itself (even though it obviously can't free the tokens from the definition). This makes the 2004 IOCC entry a non-issue memory-wise. Now I just need to speed up the parser. Sixteen seconds on pre-processing is not acceptable..
Diffstat (limited to 'pre-process.c')
-rw-r--r--pre-process.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pre-process.c b/pre-process.c
index 1d31f88..85e922f 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -1001,6 +1001,7 @@ static int do_handle_define(struct stream *stream, struct token **line, struct t
if (stream->constant == CONSTANT_FILE_MAYBE)
MARK_STREAM_NONCONST(token->pos);
+ __free_token(token); /* Free the "define" token, but not the rest of the line */
name = left->ident;
arglist = NULL;
@@ -1492,6 +1493,7 @@ static void do_preprocess(struct token **list)
if (next->pos.newline && match_op(next, '#')) {
if (!next->pos.noexpand) {
preprocessor_line(stream, list);
+ __free_token(next); /* Free the '#' token */
continue;
}
}