diff options
author | Colin Walters <walters@verbum.org> | 2021-10-08 08:59:52 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2021-10-13 17:13:14 -0400 |
commit | 520b45afdd97cab47d55aecab1407a857a7008df (patch) | |
tree | d160f6ffe0db12c4ed64360a78dbb1d0c0c71320 /src/libostree | |
parent | 9a7f9c2095a1fe834793978250be402bfb8237f6 (diff) | |
download | ostree-520b45afdd97cab47d55aecab1407a857a7008df.tar.gz |
sysroot: Fix gcc `-fanalyzer` warning
In general, we're probably going to need to change most of our
`g_return_if_fail` to `g_assert`. The analyzer flags that
the function can return `NULL`, but the caller isn't prepared for
this.
In practice, let's abort.
Diffstat (limited to 'src/libostree')
-rw-r--r-- | src/libostree/ostree-sysroot.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index be5306b7..04432cbc 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -1235,12 +1235,15 @@ ostree_sysroot_get_subbootversion (OstreeSysroot *self) * ostree_sysroot_get_booted_deployment: * @self: Sysroot * + * This function may only be called if the sysroot is loaded. + * * Returns: (transfer none) (nullable): The currently booted deployment, or %NULL if none */ OstreeDeployment * ostree_sysroot_get_booted_deployment (OstreeSysroot *self) { - g_return_val_if_fail (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED, NULL); + g_assert (self); + g_assert (self->loadstate == OSTREE_SYSROOT_LOAD_STATE_LOADED); return self->booted_deployment; } @@ -1390,7 +1393,8 @@ ostree_sysroot_get_repo (OstreeSysroot *self, OstreeRepo * ostree_sysroot_repo (OstreeSysroot *self) { - g_return_val_if_fail (self->loadstate >= OSTREE_SYSROOT_LOAD_STATE_LOADED, NULL); + g_assert (self); + g_assert (self->loadstate >= OSTREE_SYSROOT_LOAD_STATE_LOADED); g_assert (self->repo); return self->repo; } |