ObjFW  Check-in [1b7a52cdf5]

Overview
Comment:Get rid of two unnecessary variables.

This works as resizeMem:toSize: throws an exception if there's not
enough memory and thus string isn't even set, so the string isn't even
touched and still correct.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1b7a52cdf594d483229c5bd6a737b4a1437abc127ca48ad0a5a8388a026c7f8c
User & Date: js on 2009-05-03 14:59:32
Other Links: manifest | tags
Context
2009-05-03
15:10
Get rid of another useless variable. check-in: 2cec8a76d7 user: js tags: trunk
14:59
Get rid of two unnecessary variables. check-in: 1b7a52cdf5 user: js tags: trunk
14:48
Don't throw an OFNoMemException in - freeMem:. It won't help anyway. check-in: 042a74a6e6 user: js tags: trunk
Changes

Modified src/OFString.m from [b1e5dbc875] to [0c1768f337].

316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
- append: (OFString*)str
{
	return [self appendCString: [str cString]];
}

- appendCString: (const char*)str
{
	char   *newstr;
	size_t newlen, strlength;

	strlength = strlen(str);

	switch (check_utf8(str, strlength)) {
	case 1:
		is_utf8 = YES;
		break;
	case -1:
		@throw [OFInvalidEncodingException newWithClass: isa];
	}

	newlen = length + strlength;
	newstr = [self resizeMem: string
			  toSize: newlen + 1];

	memcpy(newstr + length, str, strlength + 1);

	length = newlen;
	string = newstr;

	return self;
}

- appendWithFormatCString: (const char*)fmt, ...
{
	id ret;







<
|











<
|
<
|
|
<
|
<







316
317
318
319
320
321
322

323
324
325
326
327
328
329
330
331
332
333
334

335

336
337

338

339
340
341
342
343
344
345
- append: (OFString*)str
{
	return [self appendCString: [str cString]];
}

- appendCString: (const char*)str
{

	size_t strlength;

	strlength = strlen(str);

	switch (check_utf8(str, strlength)) {
	case 1:
		is_utf8 = YES;
		break;
	case -1:
		@throw [OFInvalidEncodingException newWithClass: isa];
	}


	string = [self resizeMem: string

			  toSize: length + strlength + 1];
	memcpy(string + length, str, strlength + 1);

	length += strlength;


	return self;
}

- appendWithFormatCString: (const char*)fmt, ...
{
	id ret;