mtag/mtag_data: re-use the same code to store data and retrieve it
commitd381feafa7b3c020c6dad8aed5bad54c5eb617c9
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 27 Jul 2018 12:49:16 +0000 (27 15:49 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 27 Jul 2018 12:58:32 +0000 (27 15:58 +0300)
tree3641c4f95aa4ce1e78d7b2d5ae2d8a0e4b82824b
parent1d9526fce7496cc447e4ad6ed376d02385eb0cc5
mtag/mtag_data: re-use the same code to store data and retrieve it

I have a bunch of basically duplicate code to get the mtag and the offset.
It should just be two functions.  The get_mtag_sval() funtion tells you
what __smatch_implied(&foo.x) is and the get_mtag_rl() function tells you
what __smatch_implied(foo.x) is.

The way get_mtag_rl() works is that it takes "foo.x", it adds an '&' so
it becomes "&foo.x", then it looks the mtag and offset in mtag_data and
gives you an rl.  But the point of this patch is that now when we're
looking up data we can re-use the code we use to store it.

Also in get_mtag_sval(), I originally thought I could rely on
smatch_extra.c to use the implied_mtag_offset().  That would be true
if I were always accessing it through smatch_math.c but now we're calling
it directly, then we need to look it here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_expressions.c
smatch_extra.h
smatch_mtag.c
smatch_mtag_data.c