ObjFW  Check-in [7fa61023b9]

Overview
Comment:- copy and - mutableCopy should never autorelease.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7fa61023b929e7bd8478e7ffab0c816b0138014fe3342600519023628a325e49
User & Date: js on 2009-05-18 18:52:56
Other Links: manifest | tags
Context
2009-05-18
18:57
Create a copy of the key in OFDictionary. check-in: 3b59111e0a user: js tags: trunk
18:52
- copy and - mutableCopy should never autorelease. check-in: 7fa61023b9 user: js tags: trunk
18:45
Only let - copy create an actual copy if necessary. check-in: 6ba395bacb user: js tags: trunk
Changes

Modified src/OFArray.m from [89d75719ec] to [980f480064].

130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
- (id)copy
{
	return [self retain];
}

- (id)mutableCopy
{
	OFArray *new = [OFMutableArray array];
	OFObject **objs;
	size_t len, i;

	objs = [array data];
	len = [array count];

	[new->array addNItems: len







|







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
- (id)copy
{
	return [self retain];
}

- (id)mutableCopy
{
	OFArray *new = [[OFMutableArray alloc] init];
	OFObject **objs;
	size_t len, i;

	objs = [array data];
	len = [array count];

	[new->array addNItems: len

Modified src/OFDataArray.m from [c1f4692477] to [589715e608].

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
	count -= nitems;

	return self;
}

- (id)copy
{
	OFDataArray *new = [OFDataArray dataArrayWithItemSize: itemsize];
	[new addNItems: count
	    fromCArray: data];

	return new;
}

- (BOOL)isEqual: (id)obj







|







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
	count -= nitems;

	return self;
}

- (id)copy
{
	OFDataArray *new = [[OFDataArray alloc] initWithItemSize: itemsize];
	[new addNItems: count
	    fromCArray: data];

	return new;
}

- (BOOL)isEqual: (id)obj
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
	size = nsize;

	return self;
}

- (id)copy
{
	OFDataArray *new = [OFBigDataArray dataArrayWithItemSize: itemsize];

	[new addNItems: count
	    fromCArray: data];

	return new;
}
@end







|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
	size = nsize;

	return self;
}

- (id)copy
{
	OFDataArray *new = [[OFBigDataArray alloc] initWithItemSize: itemsize];

	[new addNItems: count
	    fromCArray: data];

	return new;
}
@end

Modified src/OFMutableArray.m from [5eccddb360] to [2c171c36e2].

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#import "OFMutableArray.h"
#import "OFExceptions.h"

@implementation OFMutableArray
- (id)copy
{
	OFArray *new = [OFArray array];
	OFObject **objs;
	size_t len, i;

	objs = [array data];
	len = [array count];

	[new->array addNItems: len







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#import "OFMutableArray.h"
#import "OFExceptions.h"

@implementation OFMutableArray
- (id)copy
{
	OFArray *new = [[OFArray alloc] init];
	OFObject **objs;
	size_t len, i;

	objs = [array data];
	len = [array count];

	[new->array addNItems: len

Modified src/OFMutableString.m from [91e1854508] to [fa80b4b8f3].

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef HAVE_ASPRINTF
#import "asprintf.h"
#endif

@implementation OFMutableString
- (id)copy
{
	return [OFString stringWithCString: string];
}

- setToCString: (const char*)str
{
	size_t len;

	if (string != NULL)







|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef HAVE_ASPRINTF
#import "asprintf.h"
#endif

@implementation OFMutableString
- (id)copy
{
	return [[OFString alloc] initWithCString: string];
}

- setToCString: (const char*)str
{
	size_t len;

	if (string != NULL)

Modified src/OFString.m from [84fc7cbec8] to [cff3100081].

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
- (id)copy
{
	return [self retain];
}

- (id)mutableCopy
{
	return [OFMutableString stringWithCString: string];
}

- (BOOL)isEqual: (id)obj
{
	if (![obj isKindOf: [OFString class]])
		return NO;
	if (strcmp(string, [obj cString]))







|







244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
- (id)copy
{
	return [self retain];
}

- (id)mutableCopy
{
	return [[OFMutableString alloc] initWithCString: string];
}

- (BOOL)isEqual: (id)obj
{
	if (![obj isKindOf: [OFString class]])
		return NO;
	if (strcmp(string, [obj cString]))