Commit 43521d0688c744e98f07f19dd0b15e6b2c763693

Vicent Marti 2011-06-16T02:27:43

refs: Rename git_referece_listcb to _foreach Same name as `git_config_foreach`

diff --git a/include/git2/refs.h b/include/git2/refs.h
index 298c66d..35c72ac 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -299,10 +299,9 @@ GIT_EXTERN(int) git_reference_listall(git_strarray *array, git_repository *repo,
 
 
 /**
- * List all the references in the repository, calling a custom
- * callback for each one.
+ * Perform an operation on each reference in the repository
  *
- * The listed references may be filtered by type, or using
+ * The processed references may be filtered by type, or using
  * a bitwise OR of several types. Use the magic value
  * `GIT_REF_LISTALL` to obtain all references, including
  * packed ones.
@@ -318,7 +317,7 @@ GIT_EXTERN(int) git_reference_listall(git_strarray *array, git_repository *repo,
  * @param payload Additional data to pass to the callback
  * @return 0 on success; error code otherwise
  */
-GIT_EXTERN(int) git_reference_listcb(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, int (*callback)(const char *, void *), void *payload);
 
 /** @} */
 GIT_END_DECL
diff --git a/src/refs.c b/src/refs.c
index 555650a..2aedb85 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1086,7 +1086,7 @@ static int reference_available(git_repository *repo, const char *ref, const char
 	git_vector_insert(&refs, (void *)ref);
 	git_vector_insert(&refs, (void *)old_ref);
 
-	error = git_reference_listcb(repo, GIT_REF_LISTALL, _reference_available_cb, (void *)&refs);
+	error = git_reference_foreach(repo, GIT_REF_LISTALL, _reference_available_cb, (void *)&refs);
 
 	git_vector_free(&refs);
 
@@ -1573,7 +1573,7 @@ int git_reference_packall(git_repository *repo)
 	return packed_write(repo);
 }
 
-int git_reference_listcb(git_repository *repo, unsigned int list_flags, int (*callback)(const char *, void *), void *payload)
+int git_reference_foreach(git_repository *repo, unsigned int list_flags, int (*callback)(const char *, void *), void *payload)
 {
 	int error;
 	struct dirent_list_data data;
@@ -1625,7 +1625,7 @@ int git_reference_listall(git_strarray *array, git_repository *repo, unsigned in
 	if (git_vector_init(&ref_list, 8, NULL) < GIT_SUCCESS)
 		return GIT_ENOMEM;
 
-	error = git_reference_listcb(repo, list_flags, &cb__reflist_add, (void *)&ref_list);
+	error = git_reference_foreach(repo, list_flags, &cb__reflist_add, (void *)&ref_list);
 
 	if (error < GIT_SUCCESS) {
 		git_vector_free(&ref_list);
diff --git a/src/tag.c b/src/tag.c
index 10ed9c0..4a0710f 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -450,7 +450,7 @@ int git_tag_list(git_strarray *tag_names, git_repository *repo)
 	if (git_vector_init(&taglist, 8, NULL) < GIT_SUCCESS)
 		return GIT_ENOMEM;
 
-	error = git_reference_listcb(repo, GIT_REF_OID|GIT_REF_PACKED, &tag_list_cb, (void *)&taglist);
+	error = git_reference_foreach(repo, GIT_REF_OID|GIT_REF_PACKED, &tag_list_cb, (void *)&taglist);
 	if (error < GIT_SUCCESS) {
 		git_vector_free(&taglist);
 		return git__rethrow(error, "Failed to list tags");