ObjFW  Check-in [b7cf59038a]

Overview
Comment:Set of_std{in,out,err} in OFFileSingleton.

Referencing subclasses of the current class in +[load] sounds like a bad
idea.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b7cf59038a815afca34171b8f16f0e5cdb848ff1d9e57fda9f990f6384354281
User & Date: js on 2012-04-20 13:59:10
Other Links: manifest | tags
Context
2012-04-21
10:15
Add support for number literals and boxing. check-in: 048e3eec4b user: js tags: trunk
2012-04-20
13:59
Set of_std{in,out,err} in OFFileSingleton. check-in: b7cf59038a user: js tags: trunk
13:58
Remove -fno-objc-default-synthesize-properties. check-in: 85269a004d user: js tags: trunk
Changes

Modified src/OFFile.m from [83d1b0c935] to [69833cd0ab].

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
157
158
159
160
161
162
163







164
165
166
167
168
169
170







-
-
-
-
-
-
-







	[pool release];
}

@interface OFFileSingleton: OFFile
@end

@implementation OFFile
+ (void)load
{
	of_stdin = [[OFFileSingleton alloc] initWithFileDescriptor: 0];
	of_stdout = [[OFFileSingleton alloc] initWithFileDescriptor: 1];
	of_stderr = [[OFFileSingleton alloc] initWithFileDescriptor: 2];
}

#if defined(OF_THREADS) && !defined(_WIN32)
+ (void)initialize
{
	if (self != [OFFile class])
		return;

	if (!of_mutex_new(&mutex))
784
785
786
787
788
789
790







791
792
793
794
795
796
797
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797







+
+
+
+
+
+
+







		close(fileDescriptor);

	[super dealloc];
}
@end

@implementation OFFileSingleton
+ (void)load
{
	of_stdin = [[OFFileSingleton alloc] initWithFileDescriptor: 0];
	of_stdout = [[OFFileSingleton alloc] initWithFileDescriptor: 1];
	of_stderr = [[OFFileSingleton alloc] initWithFileDescriptor: 2];
}

- initWithPath: (OFString*)path
	  mode: (OFString*)mode
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
						    selector: _cmd];