From d86632fba3fb2839edfefc5e67b929040c73fc61 Mon Sep 17 00:00:00 2001 From: Anuradha Karuppiah Date: Fri, 15 Nov 2019 11:42:32 -0800 Subject: [PATCH] pimd: fixup pim_channel_oil_empty macro The macro was always returning non-empty because of comparing an array of u8_t with an array of u32_t. Signed-off-by: Anuradha Karuppiah --- pimd/pim_oil.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index 979bc669fe..ed4ef6e700 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -646,19 +646,11 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif, int pim_channel_oil_empty(struct channel_oil *c_oil) { - static uint32_t zero[MAXVIFS]; - static int inited = 0; + static struct mfcctl null_oil; if (!c_oil) return 1; - /* - * Not sure that this is necessary, but I would rather ensure - * that this works. - */ - if (!inited) { - memset(&zero, 0, sizeof(uint32_t) * MAXVIFS); - inited = 1; - } - return !memcmp(c_oil->oil.mfcc_ttls, zero, MAXVIFS * sizeof(uint32_t)); + return !memcmp(c_oil->oil.mfcc_ttls, + null_oil.mfcc_ttls, sizeof(null_oil.mfcc_ttls)); }