ObjFW  Check-in [f7c9951937]

Overview
Comment:Make sure that calling -[OFString init] creates a valid empty string.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f7c9951937e87454afd4652baa4a4e119039778f28b6c41f3e63f3cd5a741ae1
User & Date: js on 2011-02-05 14:44:35
Other Links: manifest | tags
Context
2011-02-05
14:47
Make sure we always have a return buffer in of_asprintf. check-in: a0ff17e12b user: js tags: trunk
14:44
Make sure that calling -[OFString init] creates a valid empty string. check-in: f7c9951937 user: js tags: trunk
14:38
Make sure even an empty string has a valid C string. check-in: d9739e7692 user: js tags: trunk
Changes

Modified src/OFString.m from [802907aead] to [5a7d886f0b].

307
308
309
310
311
312
313

314





315
316
317
318
319
320
321
					    encoding: encoding] autorelease];
}

- init
{
	self = [super init];


	string = "";






	return self;
}

- initWithCString: (const char*)str
{
	return [self initWithCString: str







>
|
>
>
>
>
>







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
					    encoding: encoding] autorelease];
}

- init
{
	self = [super init];

	@try {
		string = [self allocMemoryWithSize: 1];
		string[0] = '\0';
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- initWithCString: (const char*)str
{
	return [self initWithCString: str