ObjFW  Check-in [8523d20555]

Overview
Comment:Small optimization in OFXMLParser.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8523d205552260b1996c5919d7dc26df30f940ac2cea56327975cae930f7d616
User & Date: js on 2011-10-11 22:13:23
Other Links: manifest | tags
Context
2011-10-11
22:21
More OFXMLParser optimizations. check-in: 8953d826b4 user: js tags: trunk
22:13
Small optimization in OFXMLParser. check-in: 8523d20555 user: js tags: trunk
21:55
Don't use madvise(). check-in: 6cbbd7c39c user: js tags: trunk
Changes

Modified src/OFXMLParser.m from [8741247447] to [7b02ea3041].

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

static OFString*
transform_string(OFDataArray *cache, size_t cut, BOOL unescape,
    OFObject <OFStringXMLUnescapingDelegate> *delegate)
{
	OFMutableString *ret = [OFMutableString
	    stringWithUTF8String: [cache cArray]
			  length: [cache count]];

	[ret replaceOccurrencesOfString: @"\r\n"
			     withString: @"\n"];
	[ret replaceOccurrencesOfString: @"\r"
			     withString: @"\n"];

	if (cut > 0) {
		size_t length = [ret length];

		[ret deleteCharactersInRange: of_range(length - cut, cut)];
	}

	if (unescape)
		return [ret stringByXMLUnescapingWithDelegate: delegate];

	[ret makeImmutable];

	return ret;
}







|






<
<
<
<
<
<







62
63
64
65
66
67
68
69
70
71
72
73
74
75






76
77
78
79
80
81
82

static OFString*
transform_string(OFDataArray *cache, size_t cut, BOOL unescape,
    OFObject <OFStringXMLUnescapingDelegate> *delegate)
{
	OFMutableString *ret = [OFMutableString
	    stringWithUTF8String: [cache cArray]
			  length: [cache count] - cut];

	[ret replaceOccurrencesOfString: @"\r\n"
			     withString: @"\n"];
	[ret replaceOccurrencesOfString: @"\r"
			     withString: @"\n"];







	if (unescape)
		return [ret stringByXMLUnescapingWithDelegate: delegate];

	[ret makeImmutable];

	return ret;
}