572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
|
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
|
-
+
|
return [[[OFMapTableObjectEnumerator alloc]
of_initWithMapTable: self
buckets: _buckets
capacity: _capacity
mutationsPointer: &_mutations] autorelease];
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
unsigned long j = state->state;
int i;
for (i = 0; i < count; i++) {
|
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
|
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
|
-
+
-
-
+
|
state->itemsPtr = objects;
state->mutationsPtr = &_mutations;
return i;
}
#ifdef OF_HAVE_BLOCKS
- (void)enumerateKeysAndObjectsUsingBlock:
- (void)enumerateKeysAndObjectsUsingBlock: (OFMapTableEnumerationBlock)block
(of_map_table_enumeration_block_t)block
{
bool stop = false;
unsigned long mutations = _mutations;
for (size_t i = 0; i < _capacity && !stop; i++) {
if (_mutations != mutations)
@throw [OFEnumerationMutationException
exceptionWithObject: self];
if (_buckets[i] != NULL && _buckets[i] != &deleted)
block(_buckets[i]->key, _buckets[i]->object, &stop);
}
}
- (void)replaceObjectsUsingBlock: (of_map_table_replace_block_t)block
- (void)replaceObjectsUsingBlock: (OFMapTableReplaceBlock)block
{
unsigned long mutations = _mutations;
for (size_t i = 0; i < _capacity; i++) {
if (_mutations != mutations)
@throw [OFEnumerationMutationException
exceptionWithObject: self];
|