]> git.draconx.ca Git - cdecl99.git/commit
libcdecl: Don't dynamically allocate null declarators.
authorNick Bowler <nbowler@draconx.ca>
Sun, 23 Jul 2023 19:37:32 +0000 (15:37 -0400)
committerNick Bowler <nbowler@draconx.ca>
Sun, 23 Jul 2023 19:37:32 +0000 (15:37 -0400)
commit96b00735351dd8e39fc5d71ff31afbdddd83ecba
tree143123ed7ef62f7ab9f78f16be8b57af43c42918
parent1ef30936f5fdb253b397347b91521455d0c39172
libcdecl: Don't dynamically allocate null declarators.

Since identifiers now come with their own declarator allocations,
nothing actually modifies any part of an allocated null declarator.

And since null declarators are always the same (with all members zero),
we don't even need to allocate them at all.  Just use a single static
allocation and make every reference to a null declarator point to that.

Then we just need to not free null declarators in the various places
where that currently happens.
src/parse-decl.c
src/parse.y