ObjFW  Check-in [7ef120effc]

Overview
Comment:-Wmisleading-indentation false positive workaround
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | notifications
Files: files | file ages | folders
SHA3-256: 7ef120effc9a51861128e4c639f6eb958feb6c0d92469b9440f1b5c4b08124a7
User & Date: js on 2021-10-31 20:34:31
Other Links: branch diff | manifest | tags
Context
2021-10-31
20:45
Merge support for notifications check-in: 78fbf22685 user: js tags: trunk
20:34
-Wmisleading-indentation false positive workaround Closed-Leaf check-in: 7ef120effc user: js tags: notifications
20:24
OFNotificationCenter: Add convenience methods check-in: fed7fa621e user: js tags: notifications
Changes

Modified src/OFNotificationCenter.m from [fc7a68de49] to [12230f361a].

267
268
269
270
271
272
273

274
275

276
277
278
279
280
281
282
}
#endif

- (void)removeObserver: (OFNotificationCenterHandle *)handle
{
	void *pool = objc_autoreleasePoolPush();


	if (![handle isKindOfClass: [OFNotificationCenterHandle class]])
		@throw [OFInvalidArgumentException exception];


#ifdef OF_HAVE_THREADS
	[_mutex lock];
	@try {
#endif
		OFNotificationName name = [[handle->_name copy] autorelease];
		OFMutableSet *handlesForName = [_handles objectForKey: name];







>
|

>







267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
}
#endif

- (void)removeObserver: (OFNotificationCenterHandle *)handle
{
	void *pool = objc_autoreleasePoolPush();

	/* {} required to avoid -Wmisleading-indentation false positive. */
	if (![handle isKindOfClass: [OFNotificationCenterHandle class]]) {
		@throw [OFInvalidArgumentException exception];
	}

#ifdef OF_HAVE_THREADS
	[_mutex lock];
	@try {
#endif
		OFNotificationName name = [[handle->_name copy] autorelease];
		OFMutableSet *handlesForName = [_handles objectForKey: name];

Modified src/OFRunLoop.m from [cc008951a5] to [ca9d5de1c8].

1412
1413
1414
1415
1416
1417
1418

1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
#endif
}

- (void)of_removeTimer: (OFTimer *)timer forMode: (OFRunLoopMode)mode
{
	OFRunLoopState *state = stateForMode(self, mode, false);


	if (state == nil)
		return;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wunknown-warning-option"
#pragma GCC diagnostic ignored "-Wmisleading-indentation"

#ifdef OF_HAVE_THREADS
	[state->_timersQueueMutex lock];
	@try {
#endif
		for (OFListItem iter = state->_timersQueue.firstListItem;
		    iter != NULL; iter = OFListItemNext(iter)) {
			if ([OFListItemObject(iter) isEqual: timer]) {
				[state->_timersQueue removeListItem: iter];
				break;
			}
		}
#ifdef OF_HAVE_THREADS
	} @finally {
		[state->_timersQueueMutex unlock];
	}
#endif

#pragma GCC diagnostic pop
}

#ifdef OF_AMIGAOS
- (void)addExecSignal: (ULONG)signal target: (id)target selector: (SEL)selector
{
	[self addExecSignal: signal
		    forMode: OFDefaultRunLoopMode







>
|

|
<
<
<
<

















<
<







1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422




1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439


1440
1441
1442
1443
1444
1445
1446
#endif
}

- (void)of_removeTimer: (OFTimer *)timer forMode: (OFRunLoopMode)mode
{
	OFRunLoopState *state = stateForMode(self, mode, false);

	/* {} required to avoid -Wmisleading-indentation false positive. */
	if (state == nil) {
		return;
	}





#ifdef OF_HAVE_THREADS
	[state->_timersQueueMutex lock];
	@try {
#endif
		for (OFListItem iter = state->_timersQueue.firstListItem;
		    iter != NULL; iter = OFListItemNext(iter)) {
			if ([OFListItemObject(iter) isEqual: timer]) {
				[state->_timersQueue removeListItem: iter];
				break;
			}
		}
#ifdef OF_HAVE_THREADS
	} @finally {
		[state->_timersQueueMutex unlock];
	}
#endif


}

#ifdef OF_AMIGAOS
- (void)addExecSignal: (ULONG)signal target: (id)target selector: (SEL)selector
{
	[self addExecSignal: signal
		    forMode: OFDefaultRunLoopMode