8000 Add some nullables to methods & properties that can return nil by Uncommon · Pull Request #589 · libgit2/objective-git · GitHub
[go: up one dir, main page]

Skip to content

Add some nullables to methods & properties that can return nil #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 23, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use git_oid_tostr_s for GTOID.SHA
  • Loading branch information
David Catmull committed Sep 16, 2016
commit b4ea30c3a70923b71cb492e72a31c120c5d51efc
12 changes: 5 additions & 7 deletions ObjectiveGit/GTOID.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ - (const git_oid *)git_oid {
}

- (NSString *)SHA {
char *SHA = malloc(GIT_OID_HEXSZ);
NSAssert(SHA != NULL, @"Failed to malloc SHA string");

git_oid_fmt(SHA, self.git_oid);

NSString *str = [[NSString alloc] initWithBytesNoCopy:SHA length:GIT_OID_HEXSZ encoding:NSUTF8StringEncoding freeWhenDone:YES];
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];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crazy indentation here 😉 .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Xcode was doing tabs instead of spaces, at 2 spaces per tab. Fixed.

NSAssert(str != nil, @"Failed to create SHA string");
return str;
}

Expand Down
0