mempack functions: return an int Stop returning a void for functions, future-proofing them to allow them to fail.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/include/git2/sys/mempack.h b/include/git2/sys/mempack.h
index 63fb38d..17da590 100644
--- a/include/git2/sys/mempack.h
+++ b/include/git2/sys/mempack.h
@@ -78,8 +78,9 @@ GIT_EXTERN(int) git_mempack_dump(git_buf *pack, git_repository *repo, git_odb_ba
* semantics to the Git repository.
*
* @param backend The mempack backend
+ * @return 0 on success; error code otherwise
*/
-GIT_EXTERN(void) git_mempack_reset(git_odb_backend *backend);
+GIT_EXTERN(int) git_mempack_reset(git_odb_backend *backend);
GIT_END_DECL
diff --git a/src/odb_mempack.c b/src/odb_mempack.c
index 6728c6c..69c423b 100644
--- a/src/odb_mempack.c
+++ b/src/odb_mempack.c
@@ -125,7 +125,7 @@ cleanup:
return err;
}
-void git_mempack_reset(git_odb_backend *_backend)
+int git_mempack_reset(git_odb_backend *_backend)
{
struct memory_packer_db *db = (struct memory_packer_db *)_backend;
struct memobject *object = NULL;
@@ -137,6 +137,8 @@ void git_mempack_reset(git_odb_backend *_backend)
git_array_clear(db->commits);
git_oidmap_clear(db->objects);
+
+ return 0;
}
static void impl__free(git_odb_backend *_backend)