Skip to content

Commit 278a0fe

Browse files
committed
Use the NSData category.
1 parent e1fdaae commit 278a0fe

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

ObjectiveGit/GTConfiguration.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
#import "GTConfiguration+Private.h"
1111
#import "GTRepository.h"
1212
#import "GTRemote.h"
13-
#import "NSError+Git.h"
1413
#import "GTSignature.h"
14+
#import "NSData+Git.h"
15+
#import "NSError+Git.h"
1516

1617
#import "git2/config.h"
1718
#import "git2/errors.h"
@@ -62,10 +63,7 @@ - (NSString *)stringForKey:(NSString *)key {
6263
git_buf buffer = {};
6364
if (git_config_get_string_buf(&buffer, self.git_config, key.UTF8String) != 0) return nil;
6465

65-
NSString *string = [[NSString alloc] initWithBytes:buffer.ptr length:buffer.size encoding:NSUTF8StringEncoding];
66-
git_buf_free(&buffer);
67-
68-
return string;
66+
return [[NSString alloc] initWithData:[NSData git_dataWithBuffer:&buffer] encoding:NSUTF8StringEncoding];
6967
}
7068

7169
- (void)setBool:(BOOL)b forKey:(NSString *)key {

0 commit comments

Comments
 (0)