summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-11-20 14:03:05 -0800
committerBen Straub <bs@github.com>2012-11-27 13:18:28 -0800
commiteecc80502975df5ef3aa9027d1b8b929cd6181bd (patch)
treeb743e635a5539290ea9d90fbffd38a3e2b29d1a7
parente120123e369a036cd40b8f085cebd55463466796 (diff)
downloadlibgit2-eecc80502975df5ef3aa9027d1b8b929cd6181bd.tar.gz
Update callback fn ptr for git_reference_foreach
As part of API review, use a typedef for the callback fn ptr.
-rw-r--r--include/git2/refs.h8
-rw-r--r--src/refs.c2
2 files changed, 8 insertions, 2 deletions
diff --git a/include/git2/refs.h b/include/git2/refs.h
index 4e5a691e6..c92646115 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -288,6 +288,8 @@ GIT_EXTERN(int) git_reference_packall(git_repository *repo);
*/
GIT_EXTERN(int) git_reference_list(git_strarray *array, git_repository *repo, unsigned int list_flags);
+typedef int (*git_reference_foreach_cb)(const char *refname, void *payload);
+
/**
* Perform a callback on each reference in the repository.
*
@@ -308,7 +310,11 @@ GIT_EXTERN(int) git_reference_list(git_strarray *array, git_repository *repo, un
* @param payload Additional data to pass to the callback
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
*/
-GIT_EXTERN(int) git_reference_foreach(git_repository *repo, unsigned int list_flags, int (*callback)(const char *, void *), void *payload);
+GIT_EXTERN(int) git_reference_foreach(
+ git_repository *repo,
+ unsigned int list_flags,
+ git_reference_foreach_cb callback,
+ void *payload);
/**
* Check if a reference has been loaded from a packfile.
diff --git a/src/refs.c b/src/refs.c
index 1aaf4f60f..1882093cf 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1478,7 +1478,7 @@ int git_reference_packall(git_repository *repo)
int git_reference_foreach(
git_repository *repo,
unsigned int list_flags,
- int (*callback)(const char *, void *),
+ git_reference_foreach_cb callback,
void *payload)
{
int result;