mirror of
https://gitee.com/openharmony/third_party_libnl
synced 2024-11-27 20:20:30 +00:00
cache: fix GCC warning and avoid variable shadowing
Fix the following GCC warning, introduced in commit66d032ad44
("cache_mngr: add include callback v2"): cache.c: In function ‘cache_include.isra.3’: cache.c:810:6: warning: ‘diff’ may be used uninitialized in this function [-Wmaybe-uninitialized] cb_v2(cache, clone, obj, diff, ^ Also don't redeclare the uint64_t diff variable, to avoid shadowing. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Thomas Haller <thaller@redhat.com> Fixes:66d032ad44
http://lists.infradead.org/pipermail/libnl/2016-December/002258.html
This commit is contained in:
parent
66d032ad44
commit
7e88d00c09
@ -789,7 +789,7 @@ static int cache_include(struct nl_cache *cache, struct nl_object *obj,
|
||||
{
|
||||
struct nl_object *old;
|
||||
struct nl_object *clone = NULL;
|
||||
uint64_t diff;
|
||||
uint64_t diff = 0;
|
||||
|
||||
switch (type->mt_act) {
|
||||
case NL_ACT_NEW:
|
||||
@ -837,7 +837,7 @@ static int cache_include(struct nl_cache *cache, struct nl_object *obj,
|
||||
} else if (cb)
|
||||
cb(cache, obj, NL_ACT_NEW, data);
|
||||
} else if (old) {
|
||||
uint64_t diff = 0;
|
||||
diff = 0;
|
||||
if (cb || cb_v2)
|
||||
diff = nl_object_diff64(old, obj);
|
||||
if (diff && cb_v2) {
|
||||
|
Loading…
Reference in New Issue
Block a user