sval: take the type into consideration when doing an sval_cmp_val().
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 19 Nov 2012 18:47:26 +0000 (19 21:47 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Mon, 19 Nov 2012 18:47:26 +0000 (19 21:47 +0300)
The original code counted everything as signed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_sval.c

index 054c82b..61a3e1e 100644 (file)
@@ -201,11 +201,10 @@ int sval_cmp_t(struct symbol *type, sval_t one, sval_t two)
 
 int sval_cmp_val(sval_t one, long long val)
 {
-       if (one.value < val)
-               return -1;
-       if (one.value == val)
-               return 0;
-       return 1;
+       sval_t sval;
+
+       sval = sval_type_val(&llong_ctype, val);
+       return sval_cmp(one, sval);
 }
 
 sval_t sval_cast(struct symbol *type, sval_t sval)