ObjFW  Diff

Differences From Artifact [56c9de1a04]:

To Artifact [323e66f686]:


1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2008 - 2009
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.

|







1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2008 - 2010
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
223
224
225
226
227
228
229


230
231
232
233
234
235
236
	OFString *str;
	OFString **objs = [array cArray];
	size_t i, count = [array count];
	IMP append;

	if (count == 0)
		return @"";



	str = [OFMutableString string];
	append = [str methodForSelector: @selector(appendString:)];

	for (i = 0; i < count - 1; i++) {
		append(str, @selector(appendString:), objs[i]);
		append(str, @selector(appendString:), separator);







>
>







223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
	OFString *str;
	OFString **objs = [array cArray];
	size_t i, count = [array count];
	IMP append;

	if (count == 0)
		return @"";
	if (count == 1)
		return [objs[0] retain];

	str = [OFMutableString string];
	append = [str methodForSelector: @selector(appendString:)];

	for (i = 0; i < count - 1; i++) {
		append(str, @selector(appendString:), objs[i]);
		append(str, @selector(appendString:), separator);
319
320
321
322
323
324
325

326
327
328
329
330
331
332

	[array release];

	[super dealloc];
}
@end


@implementation OFArrayEnumerator
- initWithDataArray: (OFDataArray*)array_
   mutationsPointer: (unsigned long*)mutations_ptr_;
{
	self = [super init];

	array = array_;







>







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

	[array release];

	[super dealloc];
}
@end

/// \cond internal
@implementation OFArrayEnumerator
- initWithDataArray: (OFDataArray*)array_
   mutationsPointer: (unsigned long*)mutations_ptr_;
{
	self = [super init];

	array = array_;
354
355
356
357
358
359
360

		@throw [OFEnumerationMutationException newWithClass: isa];

	pos = 0;

	return self;
}
@end








>
357
358
359
360
361
362
363
364
		@throw [OFEnumerationMutationException newWithClass: isa];

	pos = 0;

	return self;
}
@end
/// \endcond