summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2020-01-18 17:41:21 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2020-01-24 15:12:56 -0600
commit82154e586c830a94059c3cfbed2d5ab4985cf3ce (patch)
treeed2e2c028be02db473db4c941b9a0e5922cf2ce7
parent3351506aa8ef2b14d28fca5fb4edd55b2f15ad1b (diff)
downloadlibgit2-82154e586c830a94059c3cfbed2d5ab4985cf3ce.tar.gz
remote functions: return an int
Stop returning a void for functions, future-proofing them to allow them to fail.
-rw-r--r--include/git2/remote.h6
-rw-r--r--src/remote.c8
2 files changed, 10 insertions, 4 deletions
diff --git a/include/git2/remote.h b/include/git2/remote.h
index f9454d6d5..a6ed4cb5d 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -378,8 +378,9 @@ GIT_EXTERN(int) git_remote_connected(const git_remote *remote);
* the operation has been cancelled and if so stops the operation.
*
* @param remote the remote
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_remote_stop(git_remote *remote);
+GIT_EXTERN(int) git_remote_stop(git_remote *remote);
/**
* Disconnect from the remote
@@ -387,8 +388,9 @@ GIT_EXTERN(void) git_remote_stop(git_remote *remote);
* Close the connection to the remote.
*
* @param remote the remote to disconnect from
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_remote_disconnect(git_remote *remote);
+GIT_EXTERN(int) git_remote_disconnect(git_remote *remote);
/**
* Free the memory associated with a remote
diff --git a/src/remote.c b/src/remote.c
index 19aa45d0b..e65d036e3 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -1676,20 +1676,24 @@ int git_remote_connected(const git_remote *remote)
return remote->transport->is_connected(remote->transport);
}
-void git_remote_stop(git_remote *remote)
+int git_remote_stop(git_remote *remote)
{
assert(remote);
if (remote->transport && remote->transport->cancel)
remote->transport->cancel(remote->transport);
+
+ return 0;
}
-void git_remote_disconnect(git_remote *remote)
+int git_remote_disconnect(git_remote *remote)
{
assert(remote);
if (git_remote_connected(remote))
remote->transport->close(remote->transport);
+
+ return 0;
}
void git_remote_free(git_remote *remote)