Skip to content

Commit

Permalink
Use the NSData category.
Browse files Browse the repository at this point in the history
  • Loading branch information
robrix committed Mar 6, 2015
1 parent e1fdaae commit 278a0fe
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ObjectiveGit/GTConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 278a0fe

Please sign in to comment.