We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bbea49d commit b4ea30cCopy full SHA for b4ea30c
ObjectiveGit/GTOID.m
@@ -27,13 +27,11 @@ - (const git_oid *)git_oid {
27
}
28
29
- (NSString *)SHA {
30
- char *SHA = malloc(GIT_OID_HEXSZ);
31
- NSAssert(SHA != NULL, @"Failed to malloc SHA string");
32
-
33
- git_oid_fmt(SHA, self.git_oid);
34
35
- NSString *str = [[NSString alloc] initWithBytesNoCopy:SHA length:GIT_OID_HEXSZ encoding:NSUTF8StringEncoding freeWhenDone:YES];
36
- NSAssert(str != nil, @"Failed to allocate SHA string");
+ char *SHA = git_oid_tostr_s(self.git_oid);
+ NSString *str = [[NSString alloc] initWithBytes:SHA
+ length:GIT_OID_HEXSZ
+ encoding:NSUTF8StringEncoding];
+ NSAssert(str != nil, @"Failed to create SHA string");
37
return str;
38
39
0 commit comments