summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/reflog.c17
-rw-r--r--src/reflog.h4
2 files changed, 10 insertions, 11 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)
diff --git a/src/reflog.h b/src/reflog.h
index da352ca8f..b6daf2a76 100644
--- a/src/reflog.h
+++ b/src/reflog.h
@@ -10,8 +10,8 @@
#define GIT_REFLOG_SIZE_MIN (2*GIT_OID_HEXSZ+2+17)
struct git_reflog_entry {
- char *oid_old;
- char *oid_cur;
+ git_oid oid_old;
+ git_oid oid_cur;
git_signature *committer;