Overview
Comment: | Fix generic -[deleteTrailingWhitespaces]
This only fixes the generic one in OFMutableString, the specific one in |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c7f593793e16d1b737fc459c36751a96 |
User & Date: | js on 2017-05-01 12:53:44 |
Other Links: | manifest | tags |
Context
2017-05-01
| ||
13:07 | Add tests for generic OFString / OFMutableString check-in: 7926b47265 user: js tags: trunk | |
12:53 | Fix generic -[deleteTrailingWhitespaces] check-in: c7f593793e user: js tags: trunk | |
11:52 | OFMutableString_UTF8: Fix several bugs check-in: 80fbe5a1e2 user: js tags: trunk | |
Changes
Modified src/OFMutableString.m from [a925bde0fe] to [4ce1d99820].
︙ | ︙ | |||
560 561 562 563 564 565 566 567 568 569 | } objc_autoreleasePoolPop(pool); } - (void)deleteLeadingWhitespaces { size_t i, length = [self length]; for (i = 0; i < length; i++) { | > > | | > > > > | | > | < > < > | > > | | | > | > > > | | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | } objc_autoreleasePoolPop(pool); } - (void)deleteLeadingWhitespaces { void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = [self characters]; size_t i, length = [self length]; for (i = 0; i < length; i++) { of_unichar_t c = characters[i]; if (c != ' ' && c != '\t' && c != '\n' && c != '\r' && c != '\f') break; } objc_autoreleasePoolPop(pool); [self deleteCharactersInRange: of_range(0, i)]; } - (void)deleteTrailingWhitespaces { void *pool; const of_unichar_t *characters, *p; size_t length, d; length = [self length]; if (length == 0) return; pool = objc_autoreleasePoolPush(); characters = [self characters]; d = 0; for (p = characters + length - 1; p >= characters; p--) { if (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\r' && *p != '\f') break; d++; } objc_autoreleasePoolPop(pool); [self deleteCharactersInRange: of_range(length - d, d)]; } - (void)deleteEnclosingWhitespaces { [self deleteLeadingWhitespaces]; [self deleteTrailingWhitespaces]; } |
︙ | ︙ |