GCC6 will warn about: lib/rpmplugins.c: In function ‘rpmpluginsCallInit’: lib/rpmplugins.c:217:5: warning: this ‘if’ clause does not guard... if (hookFunc) ^~ lib/rpmplugins.c:219:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ if (rc != RPMRC_OK && rc != RPMRC_NOTFOUND) ^~
GCC is right, this is misleading and causes the if statement to be executed even when it isn't necessary. It doesn't actually cause wrong results because rc is initialized to RPMRC_OK earlier and can only change when hookFunc != NULL. Signed-off-by: Mark Wielaard <m...@redhat.com> --- lib/rpmplugins.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rpmplugins.c b/lib/rpmplugins.c index 1022024..97e5d30 100644 --- a/lib/rpmplugins.c +++ b/lib/rpmplugins.c @@ -214,10 +214,11 @@ static rpmRC rpmpluginsCallInit(rpmPlugin plugin, rpmts ts) rpmRC rc = RPMRC_OK; plugin_init_func hookFunc; RPMPLUGINS_SET_HOOK_FUNC(init); - if (hookFunc) + if (hookFunc) { rc = hookFunc(plugin, ts); if (rc != RPMRC_OK && rc != RPMRC_NOTFOUND) rpmlog(RPMLOG_ERR, "Plugin %s: hook init failed\n", plugin->name); + } return rc; } -- 2.7.4 _______________________________________________ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint