ObjFW  Diff

Differences From Artifact [2c59c12f0d]:

To Artifact [18b269539e]:


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
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







-
+




-
-
+
+






-
-
-
+
+
+







{
	return [[[self alloc]
	    initWithKeyFunctions: keyFunctions
		 objectFunctions: objectFunctions
			capacity: capacity] autorelease];
}

- init
- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}

- initWithKeyFunctions: (of_map_table_functions_t)keyFunctions
       objectFunctions: (of_map_table_functions_t)objectFunctions
- (instancetype)initWithKeyFunctions: (of_map_table_functions_t)keyFunctions
		     objectFunctions: (of_map_table_functions_t)objectFunctions
{
	return [self initWithKeyFunctions: keyFunctions
			  objectFunctions: objectFunctions
				 capacity: 0];
}

- initWithKeyFunctions: (of_map_table_functions_t)keyFunctions
       objectFunctions: (of_map_table_functions_t)objectFunctions
	      capacity: (size_t)capacity
- (instancetype)initWithKeyFunctions: (of_map_table_functions_t)keyFunctions
		     objectFunctions: (of_map_table_functions_t)objectFunctions
			    capacity: (size_t)capacity
{
	self = [super init];

	@try {
		_keyFunctions = keyFunctions;
		_objectFunctions = objectFunctions;

231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
231
232
233
234
235
236
237

238
239
240
241
242
243
244
245







-
+







			hash += _objectFunctions.hash(_buckets[i]->object);
		}
	}

	return hash;
}

- copy
- (id)copy
{
	OFMapTable *copy = [[OFMapTable alloc]
	    initWithKeyFunctions: _keyFunctions
		 objectFunctions: _objectFunctions
			capacity: _capacity];

	@try {
657
658
659
660
661
662
663
664

665
666
667
668
669
670
671
657
658
659
660
661
662
663

664
665
666
667
668
669
670
671







-
+







		}
	}
}
#endif
@end

@implementation OFMapTableEnumerator
- init
- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}

- (instancetype)of_initWithMapTable: (OFMapTable *)mapTable
			    buckets: (struct of_map_table_bucket **)buckets
			   capacity: (uint32_t)capacity
735
736
737
738
739
740
741
742
743


744
745
746
747
748
749
750
735
736
737
738
739
740
741


742
743
744
745
746
747
748
749
750







-
-
+
+







		return &_buckets[_position++]->object;
	else
		return NULL;
}
@end

@implementation OFMapTable_EnumeratorWrapper
- initWithEnumerator: (OFMapTableEnumerator *)enumerator
	      object: (id)object
- (instancetype)initWithEnumerator: (OFMapTableEnumerator *)enumerator
			    object: (id)object
{
	self = [super init];

	_enumerator = [enumerator retain];
	_object = [object retain];

	return self;