Differences From Artifact [8890f1cc69]:
- File src/OFINIFile.m — part of check-in [504e13cf00] at 2017-05-13 22:38:02 on branch trunk — Reduce retain + autorelease (user: js, size: 4037) [annotate] [blame] [check-ins using]
To Artifact [6eaed9a153]:
- File
src/OFINIFile.m
— part of check-in
[6b77a5dd8b]
at
2017-05-21 21:28:57
on branch trunk
— Prefix private methods with of_ instead of OF_
This matches Apple's style. (user: js, size: 4037) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
25 26 27 28 29 30 31 | #import "OFINICategory.h" #import "OFINICategory+Private.h" #import "OFInvalidFormatException.h" #import "OFOpenItemFailedException.h" @interface OFINIFile () | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #import "OFINICategory.h" #import "OFINICategory+Private.h" #import "OFInvalidFormatException.h" #import "OFOpenItemFailedException.h" @interface OFINIFile () - (void)of_parseFile: (OFString *)path encoding: (of_string_encoding_t)encoding; @end static bool isWhitespaceLine(OFString *line) { const char *cString = [line UTF8String]; |
︙ | ︙ | |||
82 83 84 85 86 87 88 | encoding: (of_string_encoding_t)encoding { self = [super init]; @try { _categories = [[OFMutableArray alloc] init]; | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | encoding: (of_string_encoding_t)encoding { self = [super init]; @try { _categories = [[OFMutableArray alloc] init]; [self of_parseFile: path encoding: encoding]; } @catch (id e) { [self release]; @throw e; } return self; |
︙ | ︙ | |||
108 109 110 111 112 113 114 | void *pool = objc_autoreleasePoolPush(); OFINICategory *category; for (category in _categories) if ([[category name] isEqual: name]) return category; | | | | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | void *pool = objc_autoreleasePoolPush(); OFINICategory *category; for (category in _categories) if ([[category name] isEqual: name]) return category; category = [[[OFINICategory alloc] of_init] autorelease]; [category setName: name]; [_categories addObject: category]; objc_autoreleasePoolPop(pool); return category; } - (void)of_parseFile: (OFString *)path encoding: (of_string_encoding_t)encoding { void *pool = objc_autoreleasePoolPush(); OFFile *file; OFINICategory *category = nil; OFString *line; |
︙ | ︙ | |||
150 151 152 153 154 155 156 | if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; categoryName = [line substringWithRange: of_range(1, [line length] - 2)]; category = [[[OFINICategory alloc] | | | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; categoryName = [line substringWithRange: of_range(1, [line length] - 2)]; category = [[[OFINICategory alloc] of_init] autorelease]; [category setName: categoryName]; [_categories addObject: category]; } else { if (category == nil) @throw [OFInvalidFormatException exception]; [category of_parseLine: line]; } } objc_autoreleasePoolPop(pool); } - (void)writeToFile: (OFString *)path |
︙ | ︙ | |||
179 180 181 182 183 184 185 | { void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path mode: @"w"]; bool first = true; for (OFINICategory *category in _categories) | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | { void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path mode: @"w"]; bool first = true; for (OFINICategory *category in _categories) if ([category of_writeToStream: file encoding: encoding first: first]) first = false; objc_autoreleasePoolPop(pool); } @end |