From 278a0fe099b63ef1448fe2f0c3896cc43680b42b Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 6 Mar 2015 14:56:27 -0500 Subject: [PATCH] Use the NSData category. --- ObjectiveGit/GTConfiguration.m | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ObjectiveGit/GTConfiguration.m b/ObjectiveGit/GTConfiguration.m index a0e2349c4..ff31fb82a 100644 --- a/ObjectiveGit/GTConfiguration.m +++ b/ObjectiveGit/GTConfiguration.m @@ -10,8 +10,9 @@ #import "GTConfiguration+Private.h" #import "GTRepository.h" #import "GTRemote.h" -#import "NSError+Git.h" #import "GTSignature.h" +#import "NSData+Git.h" +#import "NSError+Git.h" #import "git2/config.h" #import "git2/errors.h" @@ -62,10 +63,7 @@ - (NSString *)stringForKey:(NSString *)key { git_buf buffer = {}; if (git_config_get_string_buf(&buffer, self.git_config, key.UTF8String) != 0) return nil; - NSString *string = [[NSString alloc] initWithBytes:buffer.ptr length:buffer.size encoding:NSUTF8StringEncoding]; - git_buf_free(&buffer); - - return string; + return [[NSString alloc] initWithData:[NSData git_dataWithBuffer:&buffer] encoding:NSUTF8StringEncoding]; } - (void)setBool:(BOOL)b forKey:(NSString *)key {