Skip to content

Commit

Permalink
lib/repo: do no return a NULL on failure
Browse files Browse the repository at this point in the history
This turns an existing check into an assert. The previously returned
NULL may result in confusing callers, as none of them is checking for
that.
  • Loading branch information
lucab committed Dec 7, 2021
1 parent 4a0ebe5 commit 58bdfb9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libostree/ostree-repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,8 @@ _ostree_repo_update_mtime (OstreeRepo *self,
GKeyFile *
ostree_repo_get_config (OstreeRepo *self)
{
g_return_val_if_fail (self->inited, NULL);
g_assert (self != NULL);
g_assert (self->inited);

return self->config;
}
Expand All @@ -1617,7 +1618,8 @@ ostree_repo_copy_config (OstreeRepo *self)
char *data;
gsize len;

g_return_val_if_fail (self->inited, NULL);
g_assert (self != NULL);
g_assert (self->inited);

copy = g_key_file_new ();
data = g_key_file_to_data (self->config, &len, NULL);
Expand Down

0 comments on commit 58bdfb9

Please sign in to comment.