Use a typedef for the submodule_foreach callback.

This fits with the style for the rest of the project, but more
importantly, makes life easier for bindings authors who auto-generate
code.
This commit is contained in:
joshaber 2015-12-08 11:34:00 -05:00
parent a3dc4190e7
commit eda726cfb5
2 changed files with 14 additions and 2 deletions

View File

@ -107,6 +107,18 @@ typedef enum {
GIT_SUBMODULE_STATUS_WD_WD_MODIFIED | \
GIT_SUBMODULE_STATUS_WD_UNTRACKED)) != 0)
/**
* Function pointer to receive each submodule
*
* `sm` is the `git_submodule` currently being visited.
*
* `name` is the name of the submodule.
*
* `payload` is the value you passed to the foreach function as payload.
*/
typedef int (*git_submodule_cb)(
git_submodule *sm, const char *name, void *payload);
/**
* Submodule update options structure
*
@ -239,7 +251,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);
/**

View File

@ -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;