ObjFW  Check-in [9a60a5adfc]

Overview
Comment:Make the default OFFileManager a singleton
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9a60a5adfc0bde0ff83c947a66eab1caf584b4409b0f751502073ca0cdf38d5d
User & Date: js on 2017-11-11 22:28:19
Other Links: manifest | tags
Context
2017-11-11
23:27
Small optimization for -[isEqual:] check-in: 526feacebc user: js tags: trunk
22:28
Make the default OFFileManager a singleton check-in: 9a60a5adfc user: js tags: trunk
2017-11-06
23:01
OFURL: Store the URL-encoded version internally check-in: a15b403a11 user: js tags: trunk
Changes

Modified src/OFFileManager.m from [a4a8182fdb] to [8a6c87da20].

93
94
95
96
97
98
99



100
101
102
103
104
105
106
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109







+
+
+







#else
typedef struct stat of_stat_t;
#endif

#ifndef S_ISLNK
# define S_ISLNK(s) 0
#endif

@interface OFFileManager_default: OFFileManager
@end

static OFFileManager *defaultManager;

#if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) && !defined(OF_MORPHOS)
static OFMutex *passwdMutex;
#endif
#if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) && !defined(OF_WINDOWS)
233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
236
237
238
239
240
241
242

243
244
245
246
247
248
249
250







-
+







#ifdef OF_WINDOWS
	if ((module = LoadLibrary("kernel32.dll")) != NULL)
		func_CreateSymbolicLinkW =
		    (WINAPI BOOLEAN (*)(LPCWSTR, LPCWSTR, DWORD))
		    GetProcAddress(module, "CreateSymbolicLinkW");
#endif

	defaultManager = [[OFFileManager alloc] init];
	defaultManager = [[OFFileManager_default alloc] init];
}

+ (OFFileManager *)defaultManager
{
	return defaultManager;
}

1632
1633
1634
1635
1636
1637
1638





















1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}
#endif
@end

@implementation OFFileManager_default
- (instancetype)autorelease
{
	return self;
}

- (instancetype)retain
{
	return self;
}

- (void)release
{
}

- (unsigned int)retainCount
{
	return OF_RETAIN_COUNT_MAX;
}
@end