lib/repo: Add return value to _ostree_repo_add_remote()

Return whether the remote already existed. This is an internal API, so
it’s not an API break. The return value will be useful in upcoming
commits for working out whether to later remove a remote again.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #875
Approved by: cgwalters
This commit is contained in:
Philip Withnall authored and Atomic Bot committed 2017-05-19 15:01:59 +00:00
1 parent ed7905d000
commit b6ac28b0da
2 files changed
+10 -6

No files matched your search

+1 -1
View File
@@ -351,7 +351,7 @@ gboolean
_ostree_repo_update_mtime (OstreeRepo *self,
GError **error);
void
gboolean
_ostree_repo_add_remote (OstreeRepo *self,
OstreeRemote *remote);
OstreeRemote *
+9 -5
View File
@@ -150,19 +150,23 @@ _ostree_repo_get_remote_inherited (OstreeRepo *self,
return g_steal_pointer (&remote);
}
void
gboolean
_ostree_repo_add_remote (OstreeRepo *self,
OstreeRemote *remote)
{
g_return_if_fail (self != NULL);
g_return_if_fail (remote != NULL);
g_return_if_fail (remote->name != NULL);
gboolean already_existed;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (remote != NULL, FALSE);
g_return_val_if_fail (remote->name != NULL, FALSE);
g_mutex_lock (&self->remotes_lock);
g_hash_table_replace (self->remotes, remote->name, ostree_remote_ref (remote));
already_existed = g_hash_table_replace (self->remotes, remote->name, ostree_remote_ref (remote));
g_mutex_unlock (&self->remotes_lock);
return already_existed;
}
static gboolean