@@ -141,24 +141,21 @@ - (OFString*)description { OFMutableString *ret; void *pool; - OFEnumerator *enumerator; size_t i, count = [self count]; - id object; if (count == 0) return @"{()}"; ret = [OFMutableString stringWithString: @"{(\n"]; pool = objc_autoreleasePoolPush(); - enumerator = [self objectEnumerator]; i = 0; - while ((object = [enumerator nextObject]) != nil) { + for (id object in self) { void *pool2 = objc_autoreleasePoolPush(); [ret appendString: object]; [ret appendFormat: @": %zu", [self countForObject: object]]; @@ -190,19 +187,15 @@ - (OFXMLElement*)XMLElementBySerializing { void *pool = objc_autoreleasePoolPush(); OFXMLElement *element; - OFEnumerator *enumerator; - id object; element = [OFXMLElement elementWithName: @"OFCountedSet" namespace: OF_SERIALIZATION_NS]; - enumerator = [self objectEnumerator]; - - while ((object = [enumerator nextObject]) != nil) { + for (id object in self) { void *pool2 = objc_autoreleasePoolPush(); OFXMLElement *objectElement; OFString *count; @@ -242,26 +235,20 @@ { void *pool = objc_autoreleasePoolPush(); if ([set isKindOfClass: [OFCountedSet class]]) { OFCountedSet *countedSet = (OFCountedSet*)set; - OFEnumerator *enumerator = [countedSet objectEnumerator]; - id object; - while ((object = [enumerator nextObject]) != nil) { + for (id object in countedSet) { size_t i, count = [countedSet countForObject: object]; for (i = 0; i < count; i++) [self removeObject: object]; } - } else { - OFEnumerator *enumerator = [set objectEnumerator]; - id object; - - while ((object = [enumerator nextObject]) != nil) + } else + for (id object in set) [self removeObject: object]; - } objc_autoreleasePoolPop(pool); } - (void)unionSet: (OFSet*)set @@ -268,25 +255,19 @@ { void *pool = objc_autoreleasePoolPush(); if ([set isKindOfClass: [OFCountedSet class]]) { OFCountedSet *countedSet = (OFCountedSet*)set; - OFEnumerator *enumerator = [countedSet objectEnumerator]; - id object; - while ((object = [enumerator nextObject]) != nil) { + for (id object in countedSet) { size_t i, count = [countedSet countForObject: object]; for (i = 0; i < count; i++) [self addObject: object]; } - } else { - OFEnumerator *enumerator = [set objectEnumerator]; - id object; - - while ((object = [enumerator nextObject]) != nil) + } else + for (id object in set) [self addObject: object]; - } objc_autoreleasePoolPop(pool); } @end