db, buf_size, parse_call_math: track the size of returned buffers
With this change, we try to be a bit clever about how we track the size of
returned buffers. There are lots of functions like alloc_foo() where you
pass the number of foos you want and it's allocation nr_foo * sizeof(foo)
and returns a buffer of that size. This patch tries to calculate that.
First we record in the database when how we allocate the buffer so if we
take 24 bytes * parameter number 2 then we store that in the database.
BUF_SIZE = "24 * <2>"
Then on the second pass if we can calculate the size we use that.
I had to fix some bugs in smatch_function_hooks.c to make this work and
those fixes got merged int this patch.
Originally the return_implies hooks and the return_states hooks were mixed
together, but now I've separated them so they are called separately.
Also there was a problem because the return_states hooks and the
implied_states hooks conflict. They both try to set SMATCH_EXTRA. In the
original code, we avoided this by only calling the implied_states hooks
because the implied_states are more important. In this we call them all
but if there are implied_states they over write the return_states.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>