ObjFW  Check-in [c53575653d]

Overview
Comment:Prefer -[release] over -[dealloc].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c53575653da300ba4626e9a62244e005a23a749cd1b04855be67a3bbfb4b163f
User & Date: js on 2011-01-08 15:59:49
Other Links: manifest | tags
Context
2011-01-08
16:05
Fix two FIXMEs. check-in: 202daae1d1 user: js tags: trunk
15:59
Prefer -[release] over -[dealloc]. check-in: c53575653d user: js tags: trunk
15:57
Ignore SIGPIPE when using OFStream. check-in: 1404d33024 user: js tags: trunk
Changes

Modified src/OFDataArray.m from [142cc7b552] to [b8580a2b5b].

205
206
207
208
209
210
211
212

213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

233
234
235
236
237
238
239
205
206
207
208
209
210
211

212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231

232
233
234
235
236
237
238
239







-
+



















-
+







	count -= nitems;
	@try {
		data = [self resizeMemory: data
				 toNItems: count
				 withSize: itemSize];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- (void)removeNItems: (size_t)nitems
	     atIndex: (size_t)index
{
	if (nitems > count)
		@throw [OFOutOfRangeException newWithClass: isa];

	memmove(data + index * itemSize, data + (index + nitems) * itemSize,
	    (count - index - nitems) * itemSize);

	count -= nitems;
	@try {
		data = [self resizeMemory: data
				 toNItems: count
				 withSize: itemSize];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- copy
{
	OFDataArray *new = [[OFDataArray alloc] initWithItemSize: itemSize];
	[new addNItems: count

Modified src/OFMutableString.m from [353370f742] to [8301473e4d].

401
402
403
404
405
406
407
408

409
410
411
412
413
414
415
401
402
403
404
405
406
407

408
409
410
411
412
413
414
415







-
+







	string[length] = 0;

	@try {
		string = [self resizeMemory: string
				     toSize: length + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- (void)removeCharactersInRange: (of_range_t)range
{
	[self removeCharactersFromIndex: range.start
				toIndex: range.start + range.length];
518
519
520
521
522
523
524
525

526
527
528
529
530
531
532
518
519
520
521
522
523
524

525
526
527
528
529
530
531
532







-
+







	string[length] = '\0';

	@try {
		string = [self resizeMemory: string
				     toSize: length + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- (void)removeTrailingWhitespaces
{
	size_t d;
	char *p;
543
544
545
546
547
548
549
550

551
552
553
554
555
556
557
543
544
545
546
547
548
549

550
551
552
553
554
555
556
557







-
+







	length -= d;

	@try {
		string = [self resizeMemory: string
				     toSize: length + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- (void)removeLeadingAndTrailingWhitespaces
{
	size_t d, i;
	char *p;
577
578
579
580
581
582
583
584

585
586
587
588
589
590
591
592
577
578
579
580
581
582
583

584
585
586
587
588
589
590
591
592







-
+








	string[length] = '\0';

	@try {
		string = [self resizeMemory: string
				     toSize: length + 1];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
		[e release];
	}
}

- copy
{
	return [[OFString alloc] initWithString: self];
}
@end

Modified src/OFStream.m from [f885e71d37] to [c884b52f6e].

37
38
39
40
41
42
43
44

45
46
47

48
49
50
51
52
53
54
37
38
39
40
41
42
43

44



45
46
47
48
49
50
51
52







-
+
-
-
-
+








#import "asprintf.h"

@implementation OFStream
#ifndef _WIN32
+ (void)initialize
{
	if (self != [OFStream class])
	if (self == [OFStream class])
		return;

	signal(SIGPIPE, SIG_IGN);
		signal(SIGPIPE, SIG_IGN);
}
#endif

- init
{
	if (isa == [OFStream class]) {
		Class c = isa;