tree-wide: Pacify some clang-analyzer "Dead nested assignment"

It doesn't understand the "$x_owned" pattern (which is really
much like Rust's `std::borrow::Cow`).
This commit is contained in:
Colin Walters 2021-02-05 14:29:18 +00:00 committed by OpenShift Merge Robot
parent 18c29fa5d6
commit 4d2a6e6de0
6 changed files with 10 additions and 2 deletions

View File

@ -130,6 +130,7 @@ rpmostree_builtin_rebase (int argc,
else
new_provided_refspec = opt_branch;
}
(void)new_refspec_owned; /* Pacify static analysis */
const char *remainder = NULL;
RpmOstreeRefspecType refspectype;

View File

@ -821,6 +821,7 @@ rpmostreed_daemon_publish (RpmostreedDaemon *self,
if (object == NULL)
object = owned_object = g_dbus_object_skeleton_new (path);
(void)owned_object; /* Pacify static analysis */
g_dbus_object_skeleton_add_interface (object, (GDBusInterfaceSkeleton*)iface);
}

View File

@ -465,6 +465,7 @@ add_all_commit_details_to_vardict (OstreeDeployment *deployment,
return FALSE;
refspec = refspec_remainder;
}
(void)refspec_owned; /* Pacify static analysis */
refspec_is_ostree = refspec_type == RPMOSTREE_REFSPEC_TYPE_OSTREE;
if (refspec_type == RPMOSTREE_REFSPEC_TYPE_CHECKSUM && !commit)
checksum = refspec;

View File

@ -793,12 +793,13 @@ os_handle_automatic_update_trigger (RPMOSTreeOS *interface,
}
/* if output-to-self is not explicitly set, default to TRUE */
g_autoptr(GVariant) new_dict = NULL;
g_autoptr(GVariant) arg_options_owned = NULL;
if (!g_variant_dict_contains (&dict, "output-to-self"))
{
g_variant_dict_insert (&dict, "output-to-self", "b", TRUE);
arg_options = new_dict = g_variant_ref_sink (g_variant_dict_end (&dict));
arg_options = arg_options_owned = g_variant_ref_sink (g_variant_dict_end (&dict));
}
(void) arg_options_owned; /* Pacify static analysis */
return os_merge_or_start_deployment_txn (
interface,

View File

@ -3077,6 +3077,7 @@ get_rpmdb_pkg_header (rpmts rpmdb_ts,
g_auto(rpmts) rpmdb_ts_owned = NULL;
if (!rpmdb_ts) /* allow callers to pass NULL */
rpmdb_ts = rpmdb_ts_owned = rpmtsCreate ();
(void)rpmdb_ts_owned; /* Pacify static analysis */
unsigned int dbid = dnf_package_get_rpmdbid (pkg);
g_assert (dbid > 0);
@ -3189,6 +3190,7 @@ delete_package_from_root (RpmOstreeContext *self,
if (fn_owned)
fn = fn_owned;
}
(void)fn_owned; /* Pacify static analysis */
/* for now, we only remove files from /usr */
if (!g_str_has_prefix (fn, "usr/"))

View File

@ -558,6 +558,7 @@ impl_run_rpm_script (const KnownRpmScriptKind *rpmscript,
g_assert (script);
if (expand)
script = script_owned = rpmExpand (script, NULL);
(void)script_owned; /* Pacify static analysis */
/* http://ftp.rpm.org/max-rpm/s1-rpm-inside-scripts.html#S2-RPM-INSIDE-ERASE-TIME-SCRIPTS */
const char *script_arg = NULL;
@ -855,6 +856,7 @@ rpmostree_transfiletriggers_run_sync (Header hdr,
continue;
if (flags & RPMSCRIPT_FLAG_EXPAND)
script = script_owned = rpmExpand (script, NULL);
(void)script_owned; /* Pacify static analysis */
g_autoptr(GPtrArray) patterns = g_ptr_array_new_with_free_func (g_free);