links, var_sym: allocate fewer states
When we merge link states we end up allocating new smatch_states when we
don't need to.
The link states a list of variables we need to modify. When we merge them
then we just combine both lists. If one list is empty, then we don't need
to allocate a new state, we can just re-use the state we already had. If
the lists are the same then we again don't need to allocate a new state
but can just re-use one of the earlier states.
There was some infrastructure needed to make this work. First store the
states in sorted order so it's easier to compare two of them. Then add a
var_sym_lists_equiv() to see if they are the same.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>