@@ -135,12 +135,11 @@ #undef SET_DEFAULT if (capacity > UINT32_MAX || capacity > UINT32_MAX / sizeof(*_buckets) || capacity > UINT32_MAX / 8) - @throw [OFOutOfRangeException - exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; for (_capacity = 1; _capacity < capacity; _capacity *= 2); if (capacity * 8 / _capacity >= 6) _capacity *= 2; @@ -255,13 +254,11 @@ - (void*)valueForKey: (void*)key { uint32_t i, hash, last; if (key == NULL) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; + @throw [OFInvalidArgumentException exception]; hash = OF_ROL(_keyFunctions.hash(key), _rotate); last = _capacity; for (i = hash & (_capacity - 1); i < last && _buckets[i] != NULL; i++) { @@ -294,11 +291,11 @@ uint32_t i, fullness, capacity; struct of_map_table_bucket **buckets; if (count > UINT32_MAX || count > UINT32_MAX / sizeof(*_buckets) || count > UINT32_MAX / 8) - @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; fullness = count * 8 / _capacity; if (fullness >= 6) capacity = _capacity * 2; @@ -353,13 +350,11 @@ { uint32_t i, last; void *old; if (key == NULL || value == NULL) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; + @throw [OFInvalidArgumentException exception]; hash = OF_ROL(hash, _rotate); last = _capacity; for (i = hash & (_capacity - 1); i < last && _buckets[i] != NULL; i++) { @@ -403,12 +398,11 @@ for (i = 0; i < last && _buckets[i] != NULL && _buckets[i] != &deleted; i++); } if (i >= last) - @throw [OFOutOfRangeException - exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; bucket = [self allocMemoryWithSize: sizeof(*bucket)]; @try { bucket->key = _keyFunctions.retain(key); @@ -449,13 +443,11 @@ - (void)removeValueForKey: (void*)key { uint32_t i, hash, last; if (key == NULL) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; + @throw [OFInvalidArgumentException exception]; hash = OF_ROL(_keyFunctions.hash(key), _rotate); last = _capacity; for (i = hash & (_capacity - 1); i < last && _buckets[i] != NULL; i++) { @@ -585,12 +577,11 @@ unsigned long mutations = _mutations; for (i = 0; i < _capacity && !stop; i++) { if (_mutations != mutations) @throw [OFEnumerationMutationException - exceptionWithClass: [self class] - object: self]; + exceptionWithObject: self]; if (_buckets[i] != NULL && _buckets[i] != &deleted) block(_buckets[i]->key, _buckets[i]->value, &stop); } } @@ -601,21 +592,18 @@ unsigned long mutations = _mutations; for (i = 0; i < _capacity; i++) { if (_mutations != mutations) @throw [OFEnumerationMutationException - exceptionWithClass: [self class] - object: self]; + exceptionWithObject: self]; if (_buckets[i] != NULL && _buckets[i] != &deleted) { void *new; new = block(_buckets[i]->key, _buckets[i]->value); if (new == NULL) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; + @throw [OFInvalidArgumentException exception]; if (new != _buckets[i]->value) { _valueFunctions.release(_buckets[i]->value); _buckets[i]->value = _valueFunctions.retain(new); @@ -680,12 +668,11 @@ - (void)reset { if (*_mutationsPtr != _mutations) @throw [OFEnumerationMutationException - exceptionWithClass: [_mapTable class] - object: _mapTable]; + exceptionWithObject: _mapTable]; _position = 0; } @end @@ -692,12 +679,11 @@ @implementation OFMapTableKeyEnumerator - (void*)nextValue { if (*_mutationsPtr != _mutations) @throw [OFEnumerationMutationException - exceptionWithClass: [_mapTable class] - object: _mapTable]; + exceptionWithObject: _mapTable]; for (; _position < _capacity && (_buckets[_position] == NULL || _buckets[_position] == &deleted); _position++); if (_position < _capacity) @@ -710,12 +696,11 @@ @implementation OFMapTableValueEnumerator - (void*)nextValue { if (*_mutationsPtr != _mutations) @throw [OFEnumerationMutationException - exceptionWithClass: [_mapTable class] - object: _mapTable]; + exceptionWithObject: _mapTable]; for (; _position < _capacity && (_buckets[_position] == NULL || _buckets[_position] == &deleted); _position++); if (_position < _capacity) @@ -751,12 +736,11 @@ @try { ret = [_enumerator nextValue]; } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException - exceptionWithClass: [_object class] - object: _object]; + exceptionWithObject: _object]; } return ret; } @@ -764,10 +748,9 @@ { @try { [_enumerator reset]; } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException - exceptionWithClass: [_object class] - object: _object]; + exceptionWithObject: _object]; } } @end