diff options
author | schu <schu-github@schulog.org> | 2011-08-15 18:56:27 +0200 |
---|---|---|
committer | schu <schu-github@schulog.org> | 2011-08-15 21:14:51 +0200 |
commit | e7be57a98bea9c56c88d8c3de78400c13909eede (patch) | |
tree | b7b78f820ec423cb0623a0440032a7c0cf510297 /src/reflog.c | |
parent | bae88c0dc6b940cd661364499019ad00f7ba1fd3 (diff) | |
download | libgit2-e7be57a98bea9c56c88d8c3de78400c13909eede.tar.gz |
reflog: assimilate reflog API to return git_oid's
Rather than returning the OIDs out of the reflog as string return them
as git_oid.
Signed-off-by: schu <schu-github@schulog.org>
Diffstat (limited to 'src/reflog.c')
-rw-r--r-- | src/reflog.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/reflog.c b/src/reflog.c index 7609d9a4d..85e768123 100644 --- a/src/reflog.c +++ b/src/reflog.c @@ -113,10 +113,12 @@ static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size) if (entry == NULL) return GIT_ENOMEM; - entry->oid_old = git__strndup(buf, GIT_OID_HEXSZ); + if (git_oid_fromstrn(&entry->oid_old, buf, GIT_OID_HEXSZ) < GIT_SUCCESS) + return GIT_ERROR; seek_forward(GIT_OID_HEXSZ + 1); - entry->oid_cur = git__strndup(buf, GIT_OID_HEXSZ); + if (git_oid_fromstrn(&entry->oid_cur, buf, GIT_OID_HEXSZ) < GIT_SUCCESS) + return GIT_ERROR; seek_forward(GIT_OID_HEXSZ + 1); ptr = buf; @@ -165,9 +167,6 @@ void git_reflog_free(git_reflog *reflog) for (i=0; i < reflog->entries.length; i++) { entry = git_vector_get(&reflog->entries, i); - free(entry->oid_old); - free(entry->oid_cur); - git_signature_free(entry->committer); free(entry->msg); @@ -255,16 +254,16 @@ const git_reflog_entry * git_reflog_entry_byindex(git_reflog *reflog, unsigned i return git_vector_get(&reflog->entries, idx); } -char * git_reflog_entry_oidold(const git_reflog_entry *entry) +const git_oid * git_reflog_entry_oidold(const git_reflog_entry *entry) { assert(entry); - return entry->oid_old; + return &entry->oid_old; } -char * git_reflog_entry_oidnew(const git_reflog_entry *entry) +const git_oid * git_reflog_entry_oidnew(const git_reflog_entry *entry) { assert(entry); - return entry->oid_cur; + return &entry->oid_cur; } git_signature * git_reflog_entry_committer(const git_reflog_entry *entry) |