From 0f884dab9140c5dd097019e62daad22518f8f1bc Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Thu, 4 Feb 2021 20:35:56 +0200 Subject: [PATCH] pvv_is_int(): Be even more flexible This patch further improves commit 6191f278a, where the macro will now also work with code such as: (excerpt from pv_set_count()): ... pv_val.flags = PV_TYPE_INT; pv_val.ri = pv_name->pvp.pvi.u.ival-1; ... Notice how the flags are poorly set, since the PV_VAL_INT bit should have been used instead. (cherry picked from commit 34af3c45446ff7cef8ebd6176a94bb4a841418b7) --- pvar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvar.h b/pvar.h index f31c14df92b..2e5e123e23f 100644 --- a/pvar.h +++ b/pvar.h @@ -61,7 +61,7 @@ /* @v: a (pv_value_t *) */ #define pvv_is_int(v) \ - ((v)->flags & PV_VAL_INT && \ + ((v)->flags & (PV_VAL_INT|PV_TYPE_INT) && \ ((v)->flags & PV_TYPE_INT || !((v)->flags & PV_VAL_STR))) #define pvv_is_str(v) \ ((v)->flags & PV_VAL_STR && !((v)->flags & PV_TYPE_INT))