Differences From Artifact [cd027f3f1d]:
- File src/OFMutableArray.m — part of check-in [ddb15601a2] at 2010-09-05 23:23:08 on branch trunk — Rename -[enumerator] to -[objectEnumerator] for consistency. (user: js, size: 5486) [annotate] [blame] [check-ins using]
To Artifact [c66c422e10]:
- File
src/OFMutableArray.m
— part of check-in
[de45535c23]
at
2010-09-19 02:34:10
on branch trunk
— Only handle the first matching object in OFMutalbeArray operations.
This only makes sense as we use "Object" in the method names, implying
it's only affecting one object. (user: js, size: 4800) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 | size_t i, count = [array count]; for (i = 0; i < count; i++) { if ([objs[i] isEqual: old]) { [new retain]; [objs[i] release]; objs[i] = new; } } } | > > | | < | > > < < < < < < | < < < < < < < < < < | < < < < | < < | > < > | 61 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 99 100 101 102 103 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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | size_t i, count = [array count]; for (i = 0; i < count; i++) { if ([objs[i] isEqual: old]) { [new retain]; [objs[i] release]; objs[i] = new; return; } } } - (void)replaceObjectAtIndex: (size_t)index withObject: (id)obj { id *objs = [array cArray]; id old; if (index >= [array count]) @throw [OFOutOfRangeException newWithClass: isa]; old = objs[index]; objs[index] = [obj retain]; [old release]; } - (void)replaceObjectIdenticalTo: (id)old withObject: (id)new { id *objs = [array cArray]; size_t i, count = [array count]; for (i = 0; i < count; i++) { if (objs[i] == old) { [new retain]; [objs[i] release]; objs[i] = new; return; } } } - (void)removeObject: (id)obj { id *objs = [array cArray]; size_t i, count = [array count]; for (i = 0; i < count; i++) { if ([objs[i] isEqual: obj]) { id obj = objs[i]; [array removeItemAtIndex: i]; mutations++; [obj release]; return; } } } - (void)removeObjectIdenticalTo: (id)obj { id *objs = [array cArray]; size_t i, count = [array count]; for (i = 0; i < count; i++) { if (objs[i] == obj) { [array removeItemAtIndex: i]; mutations++; [obj release]; return; } } } - (void)removeObjectAtIndex: (size_t)index { id old = [self objectAtIndex: index]; [array removeItemAtIndex: index]; [old release]; mutations++; } - (void)removeNObjects: (size_t)nobjects { id *objs = [array cArray], *copy; size_t i, count = [array count]; |
︙ | ︙ |