62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
-
+
-
-
-
-
-
|
}
return *(id*)(void*)((char*)self + offset);
}
void
objc_setProperty(id self, SEL _cmd, ptrdiff_t offset, id value, BOOL atomic,
BOOL copy)
signed char copy)
{
if (atomic) {
id *ptr = (id*)(void*)((char*)self + offset);
#ifdef OF_THREADS
unsigned hash = SPINLOCK_HASH(ptr);
assert(of_spinlock_lock(&spinlocks[hash]));
@try {
#endif
id old = *ptr;
switch (copy) {
case 0:
*ptr = [value retain];
break;
case 2:
/*
* Apple uses this to indicate that the copy
* should be mutable. Please hit them for
* abusing a poor BOOL!
*/
*ptr = [value mutableCopy];
break;
default:
*ptr = [value copy];
}
[old release];
|