diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-05-16 21:21:24 +0200 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-05-16 21:51:45 +0200 |
commit | ee7680d53b7328020576813914ac739b66bb8f8d (patch) | |
tree | 4c8b7d51cc184226150f22c17a67137bcfaeafd0 /src/notes.c | |
parent | 9d0011fd83ff38561e75667451d2b6a55320d7d4 (diff) | |
download | libgit2-ee7680d53b7328020576813914ac739b66bb8f8d.tar.gz |
notes: make git_note_foreach() callback signature easier to cope with from a binding perspective
Diffstat (limited to 'src/notes.c')
-rw-r--r-- | src/notes.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/notes.c b/src/notes.c index 1da2ac442..a86a75b01 100644 --- a/src/notes.c +++ b/src/notes.c @@ -451,13 +451,13 @@ void git_note_free(git_note *note) static int process_entry_path( const char* entry_path, - git_oid note_oid, - int (*note_cb)(const git_oid *note_oid, const git_oid *annotated_object_oid, void *payload), + const git_oid *note_oid, + int (*note_cb)(git_note_data *note_data, void *payload), void *payload) { int i = 0, j = 0, error = -1, len; - git_oid target_oid; git_buf buf = GIT_BUF_INIT; + git_note_data note_data; if (git_buf_puts(&buf, entry_path) < 0) goto cleanup; @@ -492,10 +492,12 @@ static int process_entry_path( goto cleanup; } - if (git_oid_fromstr(&target_oid, buf.ptr) < 0) + if (git_oid_fromstr(¬e_data.annotated_object_oid, buf.ptr) < 0) return -1; - error = note_cb(¬e_oid, &target_oid, payload); + git_oid_cpy(¬e_data.blob_oid, note_oid); + + error = note_cb(¬e_data, payload); cleanup: git_buf_free(&buf); @@ -505,7 +507,7 @@ cleanup: int git_note_foreach( git_repository *repo, const char *notes_ref, - int (*note_cb)(const git_oid *note_oid, const git_oid *annotated_object_oid, void *payload), + int (*note_cb)(git_note_data *note_data, void *payload), void *payload) { int error = -1; @@ -530,7 +532,7 @@ int git_note_foreach( goto cleanup; while (item) { - if (process_entry_path(item->path, item->oid, note_cb, payload) < 0) + if (process_entry_path(item->path, &item->oid, note_cb, payload) < 0) goto cleanup; if (git_iterator_advance(iter, &item) < 0) |