Differences From Artifact [854568a763]:
- File
tests/OFBlockTests.m
— part of check-in
[dbb706d21e]
at
2016-10-15 13:49:18
on branch trunk
— OFBlock: Set (*dst)->forwarding after memcpy()
Setting it before the memcpy() meant it was effectively a nop.
This also improves on the tests to catch this in the future. (user: js, size: 2349) [annotate] [blame] [check-ins using]
To Artifact [d7ee6652ec]:
- File
tests/OFBlockTests.m
— part of check-in
[9dc0755178]
at
2016-10-16 20:01:21
on branch trunk
— OFBlocks: Forward stack block to copy when copied
While at it, also make things thread-safe. (user: js, size: 2589) [annotate] [blame] [check-ins using]
︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | - + + + + + + + + + + + + + + + | extern void *_NSConcreteMallocBlock; static void (^g)() = ^ {}; static int (^returnStackBlock(void))(void) { |
︙ | |||
65 66 67 68 69 70 71 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | + + + - - + + | (Class)&_NSConcreteMallocBlock == objc_getClass("OFMallocBlock")) TEST(@"Copying a stack block", (m = [[s copy] autorelease]) && [m class] == objc_getClass("OFMallocBlock") && [m isKindOfClass: [OFBlock class]]) TEST(@"Copying a stack block and referencing its variable", forwardTest() == 5) |
︙ |