101- (id)ooDeepCopyWithSharedObjects:(NSMutableSet*)objects
105 NSArray* result =
nil;
106 BOOL tempObjects = NO;
108 count = [
self count];
110 return [[
NSArray array] retain];
112 members = calloc(
sizeof *members,
count);
113 if (members == NULL) {
114 [
NSException raise:NSMallocException format:@"Failed to allocate space for %zu objects in %s.", count, __PRETTY_FUNCTION__];
118 if (objects ==
nil) {
123 [
self getObjects:members];
126 for (i = 0; i <
count; i++) {
127 members[
i] = [
members[
i] ooDeepCopyWithSharedObjects:objects];
131 result = [[
NSArray alloc] initWithObjects:members count:count];
135 for (i = 0; i <
count; i++) {
152- (id)ooDeepCopyWithSharedObjects:(NSMutableSet*)objects
157 BOOL tempObjects = NO;
159 count = [
self count];
161 return [[
NSSet set] retain];
163 members = malloc(
sizeof *members *
count);
164 if (members == NULL) {
165 [
NSException raise:NSMallocException format:@"Failed to allocate space for %zu objects in %s.", count, __PRETTY_FUNCTION__];
169 if (objects ==
nil) {
178 foreach (member,
self) {
179 members[
i] = [
member ooDeepCopyWithSharedObjects:objects];
184 result = [[
NSSet alloc] initWithObjects:members count:count];
188 for (i = 0; i <
count; i++) {
205- (id)ooDeepCopyWithSharedObjects:(NSMutableSet*)objects
210 NSDictionary* result =
nil;
211 BOOL tempObjects = NO;
213 count = [
self count];
217 keys = malloc(
sizeof *keys *
count);
218 values = malloc(
sizeof *values *
count);
219 if (keys == NULL || values == NULL) {
222 [
NSException raise:NSMallocException format:@"Failed to allocate space for %zu objects in %s.", count, __PRETTY_FUNCTION__];
226 if (objects ==
nil) {
237 keys[
i] = [
key ooDeepCopyWithSharedObjects:objects];
238 values[
i] = [[
self objectForKey:key] ooDeepCopyWithSharedObjects:objects];
243 result = [[
NSDictionary alloc] initWithObjects:values forKeys:keys count:count];
247 for (i = 0; i <
count; i++) {