summaryrefslogtreecommitdiff
path: root/src/reflog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reflog.c')
-rw-r--r--src/reflog.c17
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)