mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
tree-wide: [scan-build]: Add some asserts that pointers are non-NULL
More "scan-build doesn't understand GError and our out-param conventions" AKA "these errors would be impossible with Rust's sum type Result<> approach".
This commit is contained in:
parent
4a38b11159
commit
a8dc90b02f
@ -313,6 +313,7 @@ cleanup_old_deployments (OstreeSysroot *self,
|
||||
if (!list_all_deployment_directories (self, &all_deployment_dirs,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
g_assert (all_deployment_dirs); /* Pacify static analysis */
|
||||
for (guint i = 0; i < all_deployment_dirs->len; i++)
|
||||
{
|
||||
OstreeDeployment *deployment = all_deployment_dirs->pdata[i];
|
||||
|
@ -945,6 +945,7 @@ ostree_sysroot_load_if_changed (OstreeSysroot *self,
|
||||
|
||||
g_autoptr(GPtrArray) deployments = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
|
||||
|
||||
g_assert (boot_loader_configs); /* Pacify static analysis */
|
||||
for (guint i = 0; i < boot_loader_configs->len; i++)
|
||||
{
|
||||
OstreeBootconfigParser *config = boot_loader_configs->pdata[i];
|
||||
|
@ -434,6 +434,7 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
|
||||
if (opt_add_tombstones)
|
||||
{
|
||||
guint i;
|
||||
g_assert (tombstones); /* Pacify static analysis */
|
||||
if (tombstones->len)
|
||||
{
|
||||
if (!ot_enable_tombstone_commits (repo, error))
|
||||
|
@ -125,7 +125,10 @@ dump_commit (GVariant *variant,
|
||||
timestamp = GUINT64_FROM_BE (timestamp);
|
||||
str = format_timestamp (timestamp, &local_error);
|
||||
if (!str)
|
||||
errx (1, "Failed to read commit: %s", local_error->message);
|
||||
{
|
||||
g_assert (local_error); /* Pacify static analysis */
|
||||
errx (1, "Failed to read commit: %s", local_error->message);
|
||||
}
|
||||
g_autofree char *contents = ostree_commit_get_content_checksum (variant) ?: "<invalid commit>";
|
||||
g_print ("ContentChecksum: %s\n", contents);
|
||||
g_print ("Date: %s\n", str);
|
||||
|
Loading…
Reference in New Issue
Block a user