Skip to content

Commit 1a90dcf

Browse files
Nico von GeysoNico von Geyso
authored andcommitted
use git_note_iterator type instead of non-public git_iterator one
1 parent 6edb427 commit 1a90dcf

4 files changed

Lines changed: 3481 additions & 10 deletions

File tree

include/git2/notes.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ typedef int (*git_note_foreach_cb)(
3232
/**
3333
* note iterator
3434
*/
35-
typedef struct git_iterator git_iterator;
35+
typedef struct git_iterator git_note_iterator;
3636

3737
/**
3838
* Creates a new iterator for notes
@@ -47,10 +47,17 @@ typedef struct git_iterator git_iterator;
4747
* @return 0 or an error code
4848
*/
4949
GIT_EXTERN(int) git_note_iterator_new(
50-
git_iterator **out,
50+
git_note_iterator **out,
5151
git_repository *repo,
5252
const char *notes_ref);
5353

54+
/**
55+
* Frees an git_note_iterator
56+
*
57+
* @param it pointer to the iterator
58+
*/
59+
GIT_EXTERN(void) git_note_iterator_free(git_note_iterator *it);
60+
5461
/**
5562
* Next iteration step for note iteration
5663
*
@@ -65,7 +72,7 @@ GIT_EXTERN(int) git_note_iterator_new(
6572
GIT_EXTERN(int) git_note_next(
6673
git_oid* note_id,
6774
git_oid* annotated_id,
68-
git_iterator *it);
75+
git_note_iterator *it);
6976

7077

7178
/**

src/notes.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ int git_note_foreach(
584584
void *payload)
585585
{
586586
int error;
587-
git_iterator *iter = NULL;
587+
git_note_iterator *iter = NULL;
588588
git_tree *tree = NULL;
589589
git_commit *commit = NULL;
590590
git_oid annotated_object_id;
@@ -612,8 +612,17 @@ int git_note_foreach(
612612
return error;
613613
}
614614

615+
void git_note_iterator_free(git_note_iterator *it)
616+
{
617+
if (it == NULL)
618+
return;
619+
620+
git_iterator_free(it);
621+
}
622+
623+
615624
int git_note_iterator_new(
616-
git_iterator **it,
625+
git_note_iterator **it,
617626
git_repository *repo,
618627
const char *notes_ref
619628
)
@@ -624,7 +633,7 @@ int git_note_iterator_new(
624633

625634
error = retrieve_note_tree_and_commit(&tree, &commit, repo, &notes_ref);
626635
if (!error) {
627-
*it = (git_iterator *)git__malloc(sizeof(git_iterator));
636+
*it = (git_note_iterator *)git__malloc(sizeof(git_iterator));
628637
GITERR_CHECK_ALLOC(*it);
629638

630639
error = git_iterator_for_tree(it, tree);
@@ -641,7 +650,7 @@ int git_note_iterator_new(
641650
int git_note_next(
642651
git_oid* note_id,
643652
git_oid* annotated_id,
644-
git_iterator *it
653+
git_note_iterator *it
645654
)
646655
{
647656
int error;

0 commit comments

Comments
 (0)