Overview
Comment: | Reduce retain + autorelease |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
504e13cf0095fbdbf7944c96b2369d61 |
User & Date: | js on 2017-05-13 22:38:02 |
Other Links: | manifest | tags |
Context
2017-05-13
| ||
23:27 | Add depth limit for MessagePack check-in: c0d8a3426c user: js tags: trunk | |
22:38 | Reduce retain + autorelease check-in: 504e13cf00 user: js tags: trunk | |
20:11 | OFObject: Make Foundation check work on macOS 10.5 check-in: 9f9898eb8b user: js tags: trunk | |
Changes
Modified src/OFDate.m from [7b7d9e6713] to [ada236f2a0].
︙ | ︙ | |||
650 651 652 653 654 655 656 | return ret; } - (OFDate *)earlierDate: (OFDate *)otherDate { if (otherDate == nil) | | | | | | | | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 | return ret; } - (OFDate *)earlierDate: (OFDate *)otherDate { if (otherDate == nil) return self; if ([self compare: otherDate] == OF_ORDERED_DESCENDING) return otherDate; return self; } - (OFDate *)laterDate: (OFDate *)otherDate { if (otherDate == nil) return self; if ([self compare: otherDate] == OF_ORDERED_ASCENDING) return otherDate; return self; } - (of_time_interval_t)timeIntervalSince1970 { return _seconds; } |
︙ | ︙ |
Modified src/OFINIFile.m from [3398a352d7] to [8890f1cc69].
︙ | ︙ | |||
104 105 106 107 108 109 110 | } - (OFINICategory *)categoryForName: (OFString *)name { void *pool = objc_autoreleasePoolPush(); OFINICategory *category; | | | < < < < | < < < < | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | } - (OFINICategory *)categoryForName: (OFString *)name { 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; |
︙ | ︙ |
Modified src/OFRunLoop.m from [f31ca790af] to [750b7da4cf].
︙ | ︙ | |||
333 334 335 336 337 338 339 | # endif @end #endif @implementation OFRunLoop + (OFRunLoop *)mainRunLoop { | | | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | # endif @end #endif @implementation OFRunLoop + (OFRunLoop *)mainRunLoop { return mainRunLoop; } + (OFRunLoop *)currentRunLoop { #ifdef OF_HAVE_THREADS return [[OFThread currentThread] runLoop]; #else |
︙ | ︙ |
Modified src/OFSystemInfo.m from [2dfc0a82b8] to [83b5606b17].
︙ | ︙ | |||
142 143 144 145 146 147 148 | { return numberOfCPUs; } + (OFString *)userDataPath { #if defined(OF_MACOS) || defined(OF_IOS) | < < | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | { return numberOfCPUs; } + (OFString *)userDataPath { #if defined(OF_MACOS) || defined(OF_IOS) char pathC[PATH_MAX]; OFMutableString *path; # ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION sysdir_search_path_enumeration_state state; state = sysdir_start_search_path_enumeration( SYSDIR_DIRECTORY_APPLICATION_SUPPORT, SYSDIR_DOMAIN_MASK_USER); if (sysdir_get_next_search_path_enumeration(state, pathC) == 0) |
︙ | ︙ | |||
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; # endif path = [OFMutableString stringWithUTF8String: pathC]; if ([path hasPrefix: @"~"]) { OFDictionary *env = [OFApplication environment]; if ((home = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; [path deleteCharactersInRange: of_range(0, 1)]; [path prependString: home]; } [path makeImmutable]; | > < < | < | < < < > | < < | < > > | | < > < < | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; # endif path = [OFMutableString stringWithUTF8String: pathC]; if ([path hasPrefix: @"~"]) { OFDictionary *env = [OFApplication environment]; OFString *home; if ((home = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; [path deleteCharactersInRange: of_range(0, 1)]; [path prependString: home]; } [path makeImmutable]; return path; #elif defined(OF_WINDOWS) OFDictionary *env = [OFApplication environment]; OFString *appData; if ((appData = [env objectForKey: @"APPDATA"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; return appData; #elif defined(OF_HAIKU) char pathC[PATH_MAX]; if (find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, pathC, PATH_MAX) != B_OK) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; return [OFString stringWithUTF8String: pathC]; #else OFDictionary *env = [OFApplication environment]; OFString *var; void *pool; if ((var = [env objectForKey: @"XDG_DATA_HOME"]) != nil && [var length] > 0) return var; if ((var = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; pool = objc_autoreleasePoolPush(); var = [[OFString pathWithComponents: [OFArray arrayWithObjects: var, @".local", @"share", nil]] retain]; objc_autoreleasePoolPop(pool); return [var autorelease]; #endif } + (OFString *)userConfigPath { #if defined(OF_MACOS) || defined(OF_IOS) char pathC[PATH_MAX]; OFMutableString *path; # ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION sysdir_search_path_enumeration_state state; state = sysdir_start_search_path_enumeration( SYSDIR_DIRECTORY_LIBRARY, SYSDIR_DOMAIN_MASK_USER); if (sysdir_get_next_search_path_enumeration(state, pathC) == 0) |
︙ | ︙ | |||
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; # endif path = [OFMutableString stringWithUTF8String: pathC]; if ([path hasPrefix: @"~"]) { OFDictionary *env = [OFApplication environment]; if ((home = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; [path deleteCharactersInRange: of_range(0, 1)]; [path prependString: home]; } [path appendString: @"/Preferences"]; [path makeImmutable]; | > < < | < | < < < | < < | < | < < < < | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; # endif path = [OFMutableString stringWithUTF8String: pathC]; if ([path hasPrefix: @"~"]) { OFDictionary *env = [OFApplication environment]; OFString *home; if ((home = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; [path deleteCharactersInRange: of_range(0, 1)]; [path prependString: home]; } [path appendString: @"/Preferences"]; [path makeImmutable]; return path; #elif defined(OF_WINDOWS) OFDictionary *env = [OFApplication environment]; OFString *appData; if ((appData = [env objectForKey: @"APPDATA"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; return appData; #elif defined(OF_HAIKU) char pathC[PATH_MAX]; if (find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, pathC, PATH_MAX) != B_OK) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; return [OFString stringWithUTF8String: pathC]; #else OFDictionary *env = [OFApplication environment]; OFString *var; if ((var = [env objectForKey: @"XDG_CONFIG_HOME"]) != nil && [var length] > 0) return var; if ((var = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; return [var stringByAppendingPathComponent: @".config"]; #endif } + (OFString *)CPUVendor { #if defined(OF_X86_64_ASM) || defined(OF_X86_ASM) struct x86_regs regs = x86_cpuid(0, 0); |
︙ | ︙ | |||
399 400 401 402 403 404 405 | int name[2] = { CTL_HW, HW_VECTORUNIT }, value = 0; size_t length = sizeof(value); if (sysctl(name, 2, &value, &length, NULL, 0) == 0) return value; # endif | | | 378 379 380 381 382 383 384 385 386 387 388 | int name[2] = { CTL_HW, HW_VECTORUNIT }, value = 0; size_t length = sizeof(value); if (sysctl(name, 2, &value, &length, NULL, 0) == 0) return value; # endif return false; } #endif @end |
Modified src/OFTCPSocket.m from [c7187f1cc0] to [379b9f377d].
︙ | ︙ | |||
205 206 207 208 209 210 211 | id old = defaultSOCKS5Host; defaultSOCKS5Host = [host copy]; [old release]; } + (OFString *)SOCKS5Host { | | | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | id old = defaultSOCKS5Host; defaultSOCKS5Host = [host copy]; [old release]; } + (OFString *)SOCKS5Host { return defaultSOCKS5Host; } + (void)setSOCKS5Port: (uint16_t)port { defaultSOCKS5Port = port; } |
︙ | ︙ |
Modified src/OFTarArchive.m from [de5a95ce6d] to [a36962d678].
︙ | ︙ | |||
105 106 107 108 109 110 111 | return nil; } _lastReturnedEntry = [[OFTarArchiveEntry alloc] OF_initWithHeader: buffer.c stream: _stream]; | | | 105 106 107 108 109 110 111 112 113 114 | return nil; } _lastReturnedEntry = [[OFTarArchiveEntry alloc] OF_initWithHeader: buffer.c stream: _stream]; return _lastReturnedEntry; } @end |
Modified src/OFThread.h from [04bcc49824] to [e4d351df51].
︙ | ︙ | |||
254 255 256 257 258 259 260 261 262 263 264 | * @brief Sets the stack size of the thread. * * @note This has to be set before the thread is started! * * @param stackSize The stack size for the thread */ - (void)setStackSize: (size_t)stackSize; #endif @end OF_ASSUME_NONNULL_END | > > | 254 255 256 257 258 259 260 261 262 263 264 265 266 | * @brief Sets the stack size of the thread. * * @note This has to be set before the thread is started! * * @param stackSize The stack size for the thread */ - (void)setStackSize: (size_t)stackSize; #else - init OF_UNAVAILABLE; #endif @end OF_ASSUME_NONNULL_END |
Modified src/OFThread.m from [a839633991] to [666629e8be].
︙ | ︙ | |||
381 382 383 384 385 386 387 | # else @synchronized (self) { if (_runLoop == nil) _runLoop = [[OFRunLoop alloc] init]; } # endif | | | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | # else @synchronized (self) { if (_runLoop == nil) _runLoop = [[OFRunLoop alloc] init]; } # endif return _runLoop; } - (OFString *)name { return [[_name copy] autorelease]; } |
︙ | ︙ |
Modified src/OFTimer.m from [abb68d10aa] to [38ec5c3401].
︙ | ︙ | |||
408 409 410 411 412 413 414 | #endif objc_autoreleasePoolPop(pool); } - (OFDate *)fireDate { | | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | #endif objc_autoreleasePoolPop(pool); } - (OFDate *)fireDate { return _fireDate; } - (void)setFireDate: (OFDate *)fireDate { [self retain]; @try { @synchronized (self) { |
︙ | ︙ |
Modified src/OFXMLElement.m from [54f5f7c2a3] to [d59ef84b41].
︙ | ︙ | |||
789 790 791 792 793 794 795 | } - (OFXMLAttribute *)attributeForName: (OFString *)attributeName { for (OFXMLAttribute *attribute in _attributes) if (attribute->_namespace == nil && [attribute->_name isEqual: attributeName]) | | | | 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 | } - (OFXMLAttribute *)attributeForName: (OFString *)attributeName { for (OFXMLAttribute *attribute in _attributes) if (attribute->_namespace == nil && [attribute->_name isEqual: attributeName]) return attribute; return nil; } - (OFXMLAttribute *)attributeForName: (OFString *)attributeName namespace: (OFString *)attributeNS { if (attributeNS == nil) return [self attributeForName: attributeName]; for (OFXMLAttribute *attribute in _attributes) if ([attribute->_namespace isEqual: attributeNS] && [attribute->_name isEqual: attributeName]) return attribute; return nil; } - (void)removeAttributeForName: (OFString *)attributeName { OFXMLAttribute *const *objects = [_attributes objects]; |
︙ | ︙ |
Modified src/OFZIPArchive.m from [426a03f6cb] to [3ab00e0dd7].
︙ | ︙ | |||
360 361 362 363 364 365 366 | _lastReturnedStream = [[OFZIPArchive_FileStream alloc] initWithStream: _stream localFileHeader: localFileHeader]; objc_autoreleasePoolPop(pool); | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | _lastReturnedStream = [[OFZIPArchive_FileStream alloc] initWithStream: _stream localFileHeader: localFileHeader]; objc_autoreleasePoolPop(pool); return _lastReturnedStream; } @end @implementation OFZIPArchive_LocalFileHeader - initWithStream: (OFStream *)stream { self = [super init]; |
︙ | ︙ |
Modified src/runtime/runtime.h from [bd21f431a6] to [5f553e5436].
︙ | ︙ | |||
225 226 227 228 229 230 231 | extern const char *protocol_getName(Protocol *); extern bool protocol_isEqual(Protocol *, Protocol *); extern bool protocol_conformsToProtocol(Protocol *, Protocol *); extern void objc_exit(void); extern objc_uncaught_exception_handler objc_setUncaughtExceptionHandler( objc_uncaught_exception_handler); extern void objc_setForwardHandler(IMP, IMP); | < < < < | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | extern const char *protocol_getName(Protocol *); extern bool protocol_isEqual(Protocol *, Protocol *); extern bool protocol_conformsToProtocol(Protocol *, Protocol *); extern void objc_exit(void); extern objc_uncaught_exception_handler objc_setUncaughtExceptionHandler( objc_uncaught_exception_handler); extern void objc_setForwardHandler(IMP, IMP); extern void objc_zero_weak_references(id); /* * Used by the compiler, but can also be called manually. * * These declarations are also required to prevent Clang's implicit * declarations which include __declspec(dllimport) on Windows. |
︙ | ︙ |