From 611687e7c527eb083614564bcae2f32862ecdeb6 Mon Sep 17 00:00:00 2001 From: Morgan Schweers Date: Fri, 23 Oct 2009 23:57:02 -0700 Subject: [PATCH] Use the newer libgit2 method for extracting a hex digest from an object id. --- PBGitCommit.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/PBGitCommit.m b/PBGitCommit.m index 3944e4f..0abc3f0 100644 --- a/PBGitCommit.m +++ b/PBGitCommit.m @@ -22,9 +22,11 @@ NSMutableArray *p = [NSMutableArray arrayWithCapacity:nParents]; for (i = 0; i < nParents; ++i) { - char *s = git_oid_mkhex(parentShas + i); + char s[41]; + git_oid_fmt(s, parentShas + i); + s[40] = 0; [p addObject:[NSString stringWithUTF8String:s]]; - free(s); +// free(s); } return p; } @@ -121,9 +123,12 @@ - (NSString *)realSha { - char *hex = git_oid_mkhex(&sha); + char hex[41]; + git_oid_fmt(hex, &sha); + hex[40] = 0; +// char *hex = git_oid_mkhex(&sha); NSString *str = [NSString stringWithUTF8String:hex]; - free(hex); +// free(hex); return str; }