Deduplicates the results allocation logic used in MPC_TYPE_MANY
and MPC_TYPE_MANY1 on a `grow_results` function.
This will aid in implementing new repeat parser types. A new one is
neeeded for `sepby1` as discussed on
https://github.com/orangeduck/mpc/pull/165#discussion_r1292878771.
Make is supposed to only compile dependencies when they change but
`make check` always compiles them, making the test suite run slow.
```
$ make check
cc ... build/mpc.o
$ make check
cc ... build/mpc.o
```
The same occurs for other targets like `build/test-dynamic` and
`build/test-static`.
This happens because these targets have the `$(DIST)` directory as a
dependency, and directories always change whenever members are added,
removed or renamed.
Fix this by changing the `$(DIST)` directory dependency to a
`$(DIST)/.dirstamp` file.
Now `make check` compiles dependencies only once.
After running `make install`, pkg-config only finds mpc with sudo:
```
$ sudo pkg-config --list-all | grep mpc
mpc - Library for creating parser combinators
$ pkg-config --list-all | grep mpc
```
This is because the Makefile runs `install -d -m644`, which doesn't
include permission to access the `/usr/local/lib/pkgconfig` directory.
Fix this by changing the created directories mode to 645.
Otherwise, the 'prefix' variable would be left undefined:
$ pkg-config --cflags mpc
Variable 'prefix' not defined in '/gnu/store/...-profile/lib/pkgconfig/mpc.pc'
$ cat /gnu/store/...-profile/lib/pkgconfig/mpc.pc
libdir=${prefix}/lib
includedir=${prefix}/include
[...]
* Makefile (install): Install the templated pkg-config from the build
directory.
(all): Add the libs and $(DIST)/$(PROJ).pc targets.
The mpcf_freefold is documented in the README but currently not declared
in the header file. As such, adding the latter was probably just
forgotten at some point. This change adds the required function
prototype.
Before we free our buffer we need to reset the underlying stream to its
original state by pushing the buffer contents back onto the input
stream.
Fixes#109