Overview
Comment: | OFDate: Use more autorelease pools |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
83f4c928a62d187b9d4edc7065f740c5 |
User & Date: | js on 2020-09-29 22:28:56 |
Other Links: | manifest | tags |
Context
2020-09-30
| ||
21:32 | Add an issue template for GitHub check-in: c71ce345d4 user: js tags: trunk | |
2020-09-29
| ||
22:28 | OFDate: Use more autorelease pools check-in: 83f4c928a6 user: js tags: trunk | |
22:21 | runtime: Make object_isTaggedPointer() a function check-in: 2fee820b5d user: js tags: trunk | |
Changes
Modified src/OFDate.m from [19fead2d5c] to [996b4908b2].
︙ | ︙ | |||
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | { return [self initWithTimeIntervalSince1970: now() + seconds]; } - (instancetype)initWithDateString: (OFString *)string format: (OFString *)format { const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; int16_t tz = 0; if (of_strptime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; return [self initWithTimeIntervalSince1970: tmAndTzToTime(&tm, &tz)]; } - (instancetype)initWithLocalDateString: (OFString *)string format: (OFString *)format { const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; /* * of_strptime() can never set this to INT16_MAX, no matter what is * passed to it, so this is a safe way to figure out if the date * contains a time zone. */ | > > > > | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | { return [self initWithTimeIntervalSince1970: now() + seconds]; } - (instancetype)initWithDateString: (OFString *)string format: (OFString *)format { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; int16_t tz = 0; if (of_strptime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; objc_autoreleasePoolPop(pool); return [self initWithTimeIntervalSince1970: tmAndTzToTime(&tm, &tz)]; } - (instancetype)initWithLocalDateString: (OFString *)string format: (OFString *)format { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; /* * of_strptime() can never set this to INT16_MAX, no matter what is * passed to it, so this is a safe way to figure out if the date * contains a time zone. */ |
︙ | ︙ | |||
477 478 479 480 481 482 483 484 485 486 487 488 489 490 | if ((seconds = mktime(&tm)) == -1) @throw [OFInvalidFormatException exception]; #ifdef OF_WINDOWS } #endif } else seconds = tmAndTzToTime(&tm, &tz); return [self initWithTimeIntervalSince1970: seconds]; } - (instancetype)initWithSerialization: (OFXMLElement *)element { of_time_interval_t seconds; | > > | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | if ((seconds = mktime(&tm)) == -1) @throw [OFInvalidFormatException exception]; #ifdef OF_WINDOWS } #endif } else seconds = tmAndTzToTime(&tm, &tz); objc_autoreleasePoolPop(pool); return [self initWithTimeIntervalSince1970: seconds]; } - (instancetype)initWithSerialization: (OFXMLElement *)element { of_time_interval_t seconds; |
︙ | ︙ |