summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-12-08 21:11:58 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2015-12-08 21:11:58 +0100
commit21b1e015a3584b8b5355ed3ed7d6e3c9dfdc1817 (patch)
treec6d7f30394900f30c6df5f828a993e29af078e2d
parentd698929cdd17b80e5c55a4f98c848f980c630cb1 (diff)
parentab273821ee0bf2c46ad9051266d3731cbc31b03b (diff)
downloadlibgit2-21b1e015a3584b8b5355ed3ed7d6e3c9dfdc1817.tar.gz
Merge pull request #3539 from libgit2/typedef-submodule-cb
Use a typedef for the submodule_foreach callback.
-rw-r--r--include/git2/submodule.h13
-rw-r--r--src/submodule.c2
2 files changed, 13 insertions, 2 deletions
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index 689fe4b64..bc94eacaa 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -108,6 +108,17 @@ typedef enum {
GIT_SUBMODULE_STATUS_WD_UNTRACKED)) != 0)
/**
+ * Function pointer to receive each submodule
+ *
+ * @param sm git_submodule currently being visited
+ * @param name name of the submodule
+ * @param payload value you passed to the foreach function as payload
+ * @return 0 on success or error code
+ */
+typedef int (*git_submodule_cb)(
+ git_submodule *sm, const char *name, void *payload);
+
+/**
* Submodule update options structure
*
* Use the GIT_SUBMODULE_UPDATE_OPTIONS_INIT to get the default settings,
@@ -239,7 +250,7 @@ GIT_EXTERN(void) git_submodule_free(git_submodule *submodule);
*/
GIT_EXTERN(int) git_submodule_foreach(
git_repository *repo,
- int (*callback)(git_submodule *sm, const char *name, void *payload),
+ git_submodule_cb callback,
void *payload);
/**
diff --git a/src/submodule.c b/src/submodule.c
index 1148f8790..6ec4c53e1 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -495,7 +495,7 @@ cleanup:
int git_submodule_foreach(
git_repository *repo,
- int (*callback)(git_submodule *sm, const char *name, void *payload),
+ git_submodule_cb callback,
void *payload)
{
git_vector snapshot = GIT_VECTOR_INIT;