ObjFW  Check-in [89869c188f]

Overview
Comment:Merge trunk into branch "objfwtest"
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | objfwtest
Files: files | file ages | folders
SHA3-256: 89869c188f0723cd6eaf65ac461dfef52589453dc7a4bf3f2f034ef32ac75e1a
User & Date: js on 2024-02-18 13:53:41
Other Links: branch diff | manifest | tags
Context
2024-02-18
17:44
Migrate OFDataTests to ObjFWTest (check-in: f3bfdcf17a user: js tags: objfwtest)
13:53
Merge trunk into branch "objfwtest" (check-in: 89869c188f user: js tags: objfwtest)
13:53
OFMapTable: Improve enumeration mutation detection (check-in: ab14af79d2 user: js tags: trunk)
12:51
Make GCC happy again (check-in: 69a0cfcb13 user: js tags: objfwtest)
Changes

Modified src/OFMapTable.m from [3e827255d3] to [77fd4c4f10].

468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483

484
485
486
487
488
489
490
468
469
470
471
472
473
474


475
476
477
478
479
480
481
482
483
484
485
486
487
488
489







-
-







+








	for (i = rotatedHash & (_capacity - 1);
	    i < last && _buckets[i] != NULL; i++) {
		if (_buckets[i] == &deletedBucket)
			continue;

		if (_keyFunctions.equal(_buckets[i]->key, key)) {
			_mutations++;

			_keyFunctions.release(_buckets[i]->key);
			_objectFunctions.release(_buckets[i]->object);

			OFFreeMemory(_buckets[i]);
			_buckets[i] = &deletedBucket;

			_count--;
			_mutations++;
			resizeForCount(self, _count);

			return;
		}
	}

	if (i < last)
614
615
616
617
618
619
620



621
622
623
624
625
626
627
628
629
630
631
632
633
613
614
615
616
617
618
619
620
621
622
623
624
625



626
627
628
629
630
631
632







+
+
+



-
-
-







#ifdef OF_HAVE_BLOCKS
- (void)enumerateKeysAndObjectsUsingBlock: (OFMapTableEnumerationBlock)block
{
	bool stop = false;
	unsigned long mutations = _mutations;

	for (size_t i = 0; i < _capacity && !stop; i++) {
		if (_buckets[i] != NULL && _buckets[i] != &deletedBucket)
			block(_buckets[i]->key, _buckets[i]->object, &stop);

		if (_mutations != mutations)
			@throw [OFEnumerationMutationException
			    exceptionWithObject: self];

		if (_buckets[i] != NULL && _buckets[i] != &deletedBucket)
			block(_buckets[i]->key, _buckets[i]->object, &stop);
	}
}

- (void)replaceObjectsUsingBlock: (OFMapTableReplaceBlock)block
{
	unsigned long mutations = _mutations;