]> git.draconx.ca Git - cdecl99.git/commit
libcdecl: Perform all parser allocations via cdecl__alloc_item.
authorNick Bowler <nbowler@draconx.ca>
Tue, 25 Jul 2023 00:56:56 +0000 (20:56 -0400)
committerNick Bowler <nbowler@draconx.ca>
Fri, 28 Jul 2023 04:20:58 +0000 (00:20 -0400)
commit39aa5b577e6b01f53ed68e7851dcd982e0bb8015
treec02a3ab0f5d087995a9da1e27c84a76e7de354dd
parentccab8e9fa4419c944f831612d5b5474c847485fa
libcdecl: Perform all parser allocations via cdecl__alloc_item.

The cdecl__alloc_item function internally does some basic initialization
and handles error reporting, so by using it consistently we can avoid
some of this stuff being repeated throughout the parser actions, which
gives a slight reduction in the size of the parser.

As this function allocates a fixed-sized union of all the parse tree
structures, this means a small amount of runtime memory may be wasted
for the smaller ones, but it should be less than 12 bytes per allocation.
src/cdecl-internal.h
src/parse.y