ObjFW  Diff

Differences From Artifact [77ec98f4c0]:

To Artifact [95cd2a6086]:


117
118
119
120
121
122
123
124

125
126
127
128

129
130
131
132
133
134
135
117
118
119
120
121
122
123

124
125
126
127
128
129
130
131
132
133
134
135
136







-
+




+







	[super dealloc];
}
@end

@implementation OFINICategory
@synthesize name = _name;

- (instancetype)of_init
- (instancetype)of_initWithName: (OFString *)name
{
	self = [super init];

	@try {
		_name = [name copy];
		_lines = [[OFMutableArray alloc] init];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
505
506
507
508
509
510
511
512

513
514
515

516
517
518
519
520
521
522
523
506
507
508
509
510
511
512

513
514
515

516
517
518
519
520
521
522
523
524







-
+


-
+








		if ([line isKindOfClass: [OFINICategory_Comment class]]) {
			OFINICategory_Comment *comment = line;
			[stream writeFormat: @"%@\r\n", comment->_comment];
		} else if ([line isKindOfClass: [OFINICategory_Pair class]]) {
			OFINICategory_Pair *pair = line;
			OFString *key = escapeString(pair->_key);
			OFString *value = escapeString(pair->_value);
			OFString *line = [OFString
			OFString *tmp = [OFString
			    stringWithFormat: @"%@=%@\r\n", key, value];

			[stream writeString: line
			[stream writeString: tmp
				   encoding: encoding];
		} else
			@throw [OFInvalidArgumentException exception];
	}

	return true;
}
@end