File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1515
1616#import " git2/config.h"
1717#import " git2/errors.h"
18+ #import " git2/buffer.h"
1819
1920@interface GTConfiguration ()
2021@property (nonatomic , readonly , assign ) git_config *git_config;
@@ -58,11 +59,13 @@ - (void)setString:(NSString *)s forKey:(NSString *)key {
5859}
5960
6061- (NSString *)stringForKey : (NSString *)key {
61- const char *string = NULL ;
62- git_config_get_string (&string, self.git_config , key.UTF8String );
63- if (string == NULL ) return nil ;
62+ git_buf buffer = {};
63+ if (git_config_get_string_buf (&buffer, self.git_config , key.UTF8String ) != 0 ) return nil ;
6464
65- return [NSString stringWithUTF8String: string];
65+ NSString *string = [[NSString alloc ] initWithBytes: buffer.ptr length: buffer.size encoding: NSUTF8StringEncoding];
66+ git_buf_free (&buffer);
67+
68+ return string;
6669}
6770
6871- (void )setBool : (BOOL )b forKey : (NSString *)key {
You can’t perform that action at this time.
0 commit comments