This PR should make the YAEP library mostly reentrant without changing the public API. I haven't fixed the following three things:
Some of the callbacks the user is supposed to provide cannot be passed a user-provided pointer: syntax_error, parse_alloc, and parse_free. The other callbacks can receive such a pointer somewhat awkwardly, via struct _yaep_reentrant_hack. Changing this would require changing the public API.
The function read_rule has static local variables. But this function is only used for tests, so it should be OK.
The globals all_searches and all_collisions remain. In single-threaded usage, they'll work as intended. In multi-threaded usage, concurrent access is technically undefined behavior, though practically, the worst that can happen is that their value is trashed. Since these variables are used for debugging purposes only, they should not affect the behavior of the library per se.
This PR should make the YAEP library mostly reentrant without changing the public API. I haven't fixed the following three things:
syntax_error
,parse_alloc
, andparse_free
. The other callbacks can receive such a pointer somewhat awkwardly, viastruct _yaep_reentrant_hack
. Changing this would require changing the public API.read_rule
has static local variables. But this function is only used for tests, so it should be OK.all_searches
andall_collisions
remain. In single-threaded usage, they'll work as intended. In multi-threaded usage, concurrent access is technically undefined behavior, though practically, the worst that can happen is that their value is trashed. Since these variables are used for debugging purposes only, they should not affect the behavior of the library per se.This PR supersedes #21.