Paolo Bonzini wrote:
> * src/dfa.c (alloc_posset): New function, use it throughout.
> ---
> src/dfa.c | 22 ++++++++++++++--------
> 1 files changed, 14 insertions(+), 8 deletions(-)
ACK, but I would prefer a name like alloc_pos_set or
even alloc_position_set. "posset" is not as readable.
...
> +static void
> +alloc_posset (position_set *s, size_t size)
> +{
> + MALLOC(s->elems, size);
> + s->nelem = 0;
> +}
> +
> /* Insert position P in set S. S is maintained in sorted order on
> decreasing index. If there is already an entry in S with P.index
> then merge (logically-OR) P's constraints into the one in S.
> @@ -1934,7 +1941,7 @@ state_index (struct dfa *d, position_set const *s, int
> newline, int letter)
> /* We'll have to create a new state. */
> REALLOC_IF_NECESSARY(d->states, d->salloc, d->sindex + 1);
> d->states[i].hash = hash;
> - MALLOC(d->states[i].elems.elems, s->nelem);
> + alloc_posset(&d->states[i].elems, s->nelem);
...