Skip to content

Commit c615608

Browse files
committed
Use built-in OS_OBJECT_USE_OBJC definition instead of custom one.
1 parent e15589e commit c615608

File tree

4 files changed

+12
-113
lines changed

4 files changed

+12
-113
lines changed

Core/HTTPConnection.m

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,23 @@
1616
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
1717
#endif
1818

19-
// Does ARC support support GCD objects?
20-
// It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
21-
22-
#if TARGET_OS_IPHONE
23-
24-
// Compiling for iOS
25-
26-
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
27-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
28-
#else // iOS 5.X or earlier
29-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
30-
#endif
31-
32-
#else
33-
34-
// Compiling for Mac OS X
35-
36-
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
37-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
38-
#else
39-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
40-
#endif
41-
42-
#endif
43-
4419
// Log levels: off, error, warn, info, verbose
4520
// Other flags: trace
4621
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE;
4722

4823
// Define chunk size used to read in data for responses
4924
// This is how much data will be read from disk into RAM at a time
5025
#if TARGET_OS_IPHONE
51-
#define READ_CHUNKSIZE (1024 * /*128*/256)
26+
#define READ_CHUNKSIZE (1024 * 256)
5227
#else
5328
#define READ_CHUNKSIZE (1024 * 512)
5429
#endif
5530

5631
// Define chunk size used to read in POST upload data
5732
#if TARGET_OS_IPHONE
58-
#define POST_CHUNKSIZE (1024 * /*32*/256)
33+
#define POST_CHUNKSIZE (1024 * 256)
5934
#else
60-
#define POST_CHUNKSIZE (1024 * /*128*/512)
35+
#define POST_CHUNKSIZE (1024 * 512)
6136
#endif
6237

6338
// Define the various timeouts (in seconds) for various parts of the HTTP process
@@ -207,7 +182,7 @@ - (id)initWithAsyncSocket:(GCDAsyncSocket *)newSocket configuration:(HTTPConfig
207182
if (aConfig.queue)
208183
{
209184
connectionQueue = aConfig.queue;
210-
#if NEEDS_DISPATCH_RETAIN_RELEASE
185+
#if !OS_OBJECT_USE_OBJC
211186
dispatch_retain(connectionQueue);
212187
#endif
213188
}
@@ -245,7 +220,7 @@ - (void)dealloc
245220
{
246221
HTTPLogTrace();
247222

248-
#if NEEDS_DISPATCH_RETAIN_RELEASE
223+
#if !OS_OBJECT_USE_OBJC
249224
dispatch_release(connectionQueue);
250225
#endif
251226

@@ -2715,7 +2690,7 @@ - (id)initWithServer:(HTTPServer *)aServer documentRoot:(NSString *)aDocumentRoo
27152690
if (q)
27162691
{
27172692
queue = q;
2718-
#if NEEDS_DISPATCH_RETAIN_RELEASE
2693+
#if !OS_OBJECT_USE_OBJC
27192694
dispatch_retain(queue);
27202695
#endif
27212696
}
@@ -2725,7 +2700,7 @@ - (id)initWithServer:(HTTPServer *)aServer documentRoot:(NSString *)aDocumentRoo
27252700

27262701
- (void)dealloc
27272702
{
2728-
#if NEEDS_DISPATCH_RETAIN_RELEASE
2703+
#if !OS_OBJECT_USE_OBJC
27292704
if (queue) dispatch_release(queue);
27302705
#endif
27312706
}

Core/HTTPServer.m

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,6 @@
88
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
99
#endif
1010

11-
// Does ARC support support GCD objects?
12-
// It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
13-
14-
#if TARGET_OS_IPHONE
15-
16-
// Compiling for iOS
17-
18-
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
19-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
20-
#else // iOS 5.X or earlier
21-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
22-
#endif
23-
24-
#else
25-
26-
// Compiling for Mac OS X
27-
28-
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
29-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
30-
#else
31-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
32-
#endif
33-
34-
#endif
35-
3611
// Log levels: off, error, warn, info, verbose
3712
// Other flags: trace
3813
static const int httpLogLevel = HTTP_LOG_LEVEL_INFO; // | HTTP_LOG_FLAG_TRACE;
@@ -139,7 +114,7 @@ - (void)dealloc
139114

140115
// Release all instance variables
141116

142-
#if NEEDS_DISPATCH_RETAIN_RELEASE
117+
#if !OS_OBJECT_USE_OBJC
143118
dispatch_release(serverQueue);
144119
dispatch_release(connectionQueue);
145120
#endif

Core/Responses/HTTPAsyncFileResponse.m

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,6 @@
99
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
1010
#endif
1111

12-
/**
13-
* Does ARC support support GCD objects?
14-
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
15-
**/
16-
#if TARGET_OS_IPHONE
17-
18-
// Compiling for iOS
19-
20-
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
21-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
22-
#else // iOS 5.X or earlier
23-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
24-
#endif
25-
26-
#else
27-
28-
// Compiling for Mac OS X
29-
30-
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
31-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
32-
#else
33-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
34-
#endif
35-
36-
#endif
37-
3812
// Log levels : off, error, warn, info, verbose
3913
// Other flags: trace
4014
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE;
@@ -258,7 +232,7 @@ - (BOOL)openFileAndSetupReadSource
258232
});
259233

260234
int theFileFD = fileFD;
261-
#if NEEDS_DISPATCH_RETAIN_RELEASE
235+
#if !OS_OBJECT_USE_OBJC
262236
dispatch_source_t theReadSource = readSource;
263237
#endif
264238

@@ -270,7 +244,7 @@ - (BOOL)openFileAndSetupReadSource
270244

271245
HTTPLogTrace2(@"%@: cancelBlock - Close fd[%i]", THIS_FILE, theFileFD);
272246

273-
#if NEEDS_DISPATCH_RETAIN_RELEASE
247+
#if !OS_OBJECT_USE_OBJC
274248
dispatch_release(theReadSource);
275249
#endif
276250
close(theFileFD);
@@ -420,7 +394,7 @@ - (void)dealloc
420394
{
421395
HTTPLogTrace();
422396

423-
#if NEEDS_DISPATCH_RETAIN_RELEASE
397+
#if !OS_OBJECT_USE_OBJC
424398
if (readQueue) dispatch_release(readQueue);
425399
#endif
426400

Core/WebSocket.m

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,6 @@
99
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
1010
#endif
1111

12-
// Does ARC support support GCD objects?
13-
// It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
14-
15-
#if TARGET_OS_IPHONE
16-
17-
// Compiling for iOS
18-
19-
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
20-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
21-
#else // iOS 5.X or earlier
22-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
23-
#endif
24-
25-
#else
26-
27-
// Compiling for Mac OS X
28-
29-
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
30-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
31-
#else
32-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
33-
#endif
34-
35-
#endif
36-
3712
// Log levels: off, error, warn, info, verbose
3813
// Other flags : trace
3914
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE;
@@ -218,7 +193,7 @@ - (void)dealloc
218193
{
219194
HTTPLogTrace();
220195

221-
#if NEEDS_DISPATCH_RETAIN_RELEASE
196+
#if !OS_OBJECT_USE_OBJC
222197
dispatch_release(websocketQueue);
223198
#endif
224199

0 commit comments

Comments
 (0)