Skip to content

Commit 4cae9e7

Browse files
committed
git_libgit2_version: return an int
Stop returning a void for functions, future-proofing them to allow them to fail.
1 parent f78f6bd commit 4cae9e7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/git2/common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ GIT_BEGIN_DECL
117117
* @param major Store the major version number
118118
* @param minor Store the minor version number
119119
* @param rev Store the revision (patch) number
120+
* @return 0 on success or an error code on failure
120121
*/
121-
GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
122+
GIT_EXTERN(int) git_libgit2_version(int *major, int *minor, int *rev);
122123

123124
/**
124125
* Combinations of these values describe the features with which libgit2

src/settings.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929
#include "streams/openssl.h"
3030
#include "streams/mbedtls.h"
3131

32-
void git_libgit2_version(int *major, int *minor, int *rev)
32+
int git_libgit2_version(int *major, int *minor, int *rev)
3333
{
3434
*major = LIBGIT2_VER_MAJOR;
3535
*minor = LIBGIT2_VER_MINOR;
3636
*rev = LIBGIT2_VER_REVISION;
37+
38+
return 0;
3739
}
3840

3941
int git_libgit2_features(void)

0 commit comments

Comments
 (0)