[LTP] [PATCH v2 1/2] lib: Add generic boolean expression parser and eval

Cyril Hrubis chrubis@suse.cz
Tue Oct 27 16:45:29 CET 2020


Hi!
> > +/*
> > + * Note that we avoid modifying the list until the end so that the caller can
> > + * free memory correctly, which is the reason we have a stack for
> > parentesis
> 
> If you use a new vector/stack for the output queue instead of an
> intrusive list then this problem should go away. We have an upper bound
> for any token/expr vector which is the length of the input string. So it
> is possible to preallocate an input array instead of using a dynamically
> allocated linked list.

Or we can run the tokenizer twice and first time only record number of
tokens...

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list