ObjFW  Check-in [4c6d6c56ac]

Overview
Comment:As we memset our ivars to 0, get rid of some useless ivar inits.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4c6d6c56acbf717588b136a395b59e748365149ca683a14ec149ca27a7926852
User & Date: js on 2009-05-15 22:59:30
Other Links: manifest | tags
Context
2009-05-16
11:47
Use @defs in preallocated OFAllocFailedException struct. check-in: fa64faf81e user: js tags: trunk
2009-05-15
22:59
As we memset our ivars to 0, get rid of some useless ivar inits. check-in: 4c6d6c56ac user: js tags: trunk
20:01
Use OFString as much as possible. check-in: 67066be692 user: js tags: trunk
Changes

Modified src/OFAutoreleasePool.m from [3f9b8ad9ca] to [c665c234c4].

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

- init
{
	OFList *pool_list;

	self = [super init];

	objects = nil;

	if ((pool_list = [OFThread objectForTLSKey: pool_list_key]) == nil) {
		pool_list = [[OFList alloc] initWithoutRetainAndRelease];
		[OFThread setObject: pool_list
			  forTLSKey: pool_list_key];
		[pool_list release];
	}








<
<







58
59
60
61
62
63
64


65
66
67
68
69
70
71

- init
{
	OFList *pool_list;

	self = [super init];



	if ((pool_list = [OFThread objectForTLSKey: pool_list_key]) == nil) {
		pool_list = [[OFList alloc] initWithoutRetainAndRelease];
		[OFThread setObject: pool_list
			  forTLSKey: pool_list_key];
		[pool_list release];
	}

Modified src/OFDataArray.m from [cbd581ad22] to [a8904a350c].

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
		[super dealloc];
		@throw [OFInvalidArgumentException newWithClass: c
						    andSelector: _cmd];
	}

	data = NULL;
	itemsize = is;
	count = 0;

	return self;
}

- (size_t)count
{
	return count;







<







45
46
47
48
49
50
51

52
53
54
55
56
57
58
		[super dealloc];
		@throw [OFInvalidArgumentException newWithClass: c
						    andSelector: _cmd];
	}

	data = NULL;
	itemsize = is;


	return self;
}

- (size_t)count
{
	return count;
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
@implementation OFBigDataArray
- initWithItemSize: (size_t)is
{
	self = [super initWithItemSize: is];

	if (lastpagebyte == 0)
		lastpagebyte = getpagesize() - 1;
	size = 0;

	return self;
}

- add: (void*)item
{
	size_t nsize;







<







190
191
192
193
194
195
196

197
198
199
200
201
202
203
@implementation OFBigDataArray
- initWithItemSize: (size_t)is
{
	self = [super initWithItemSize: is];

	if (lastpagebyte == 0)
		lastpagebyte = getpagesize() - 1;


	return self;
}

- add: (void*)item
{
	size_t nsize;

Modified src/OFExceptions.m from [55ea187f4c] to [20bafd7554].

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
}

- initWithClass: (Class)class_
{
	self = [super init];

	class = class_;
	string = nil;

	return self;
}

- (void)dealloc
{
	[string release];







<







64
65
66
67
68
69
70

71
72
73
74
75
76
77
}

- initWithClass: (Class)class_
{
	self = [super init];

	class = class_;


	return self;
}

- (void)dealloc
{
	[string release];

Modified src/OFHashes.m from [bfc8c7ca98] to [2b757a1f65].

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
	self = [super init];

	buf[0] = 0x67452301;
	buf[1] = 0xEFCDAB89;
	buf[2] = 0x98BADCFE;
	buf[3] = 0x10325476;

	bits[0] = 0;
	bits[1] = 0;

	calculated = NO;

	return self;
}

- updateWithBuffer: (const char*)buffer
	    ofSize: (size_t)size
{
	uint32_t t;







<
<
<
<
<







125
126
127
128
129
130
131





132
133
134
135
136
137
138
	self = [super init];

	buf[0] = 0x67452301;
	buf[1] = 0xEFCDAB89;
	buf[2] = 0x98BADCFE;
	buf[3] = 0x10325476;






	return self;
}

- updateWithBuffer: (const char*)buffer
	    ofSize: (size_t)size
{
	uint32_t t;
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
	return [[[OFSHA1Hash alloc] init] autorelease];
}

- init
{
	self = [super init];

	count = 0;
	state[0] = 0x67452301;
	state[1] = 0xEFCDAB89;
	state[2] = 0x98BADCFE;
	state[3] = 0x10325476;
	state[4] = 0xC3D2E1F0;

	return self;







<







358
359
360
361
362
363
364

365
366
367
368
369
370
371
	return [[[OFSHA1Hash alloc] init] autorelease];
}

- init
{
	self = [super init];


	state[0] = 0x67452301;
	state[1] = 0xEFCDAB89;
	state[2] = 0x98BADCFE;
	state[3] = 0x10325476;
	state[4] = 0xC3D2E1F0;

	return self;

Modified src/OFIterator.m from [7c4dd9ded2] to [6f7dad4788].

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
       andSize: (size_t)size_
{
	self = [super init];

	data = data_;
	size = size_;

	pos = 0;
	last = NULL;

	return self;
}

- (id)nextObject
{







<







20
21
22
23
24
25
26

27
28
29
30
31
32
33
       andSize: (size_t)size_
{
	self = [super init];

	data = data_;
	size = size_;


	last = NULL;

	return self;
}

- (id)nextObject
{

Modified src/OFList.m from [e1882a13b8] to [c5e0bd60b4].

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

- initWithoutRetainAndRelease
{
	self = [super init];

	first = NULL;
	last = NULL;
	retain_and_release = NO;

	return self;
}

- (void)dealloc
{
	of_list_object_t *iter;







<







32
33
34
35
36
37
38

39
40
41
42
43
44
45

- initWithoutRetainAndRelease
{
	self = [super init];

	first = NULL;
	last = NULL;


	return self;
}

- (void)dealloc
{
	of_list_object_t *iter;

Modified src/OFMutableString.m from [a4955aa6db] to [9dc4884694].

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

	madvise((void*)str, len, MADV_NORMAL);

	return (utf8 ? 1 : 0);
}

@implementation OFMutableString
- init
{
	[super init];

	is_utf8 = NO;

	return self;
}

- initWithCString: (const char*)str
{
	Class c;

	self = [super init];

	if (str != NULL) {







<
<
<
<
<
<
<
<
<







99
100
101
102
103
104
105









106
107
108
109
110
111
112

	madvise((void*)str, len, MADV_NORMAL);

	return (utf8 ? 1 : 0);
}

@implementation OFMutableString









- initWithCString: (const char*)str
{
	Class c;

	self = [super init];

	if (str != NULL) {

Modified src/OFSocket.m from [3e54369073] to [f1c982e206].

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

- init
{
	self = [super init];

	sock = INVALID_SOCKET;
	saddr = NULL;
	saddr_len = 0;

	return self;
}

- (size_t)readNBytes: (size_t)size
	  intoBuffer: (char*)buf
{







<







34
35
36
37
38
39
40

41
42
43
44
45
46
47

- init
{
	self = [super init];

	sock = INVALID_SOCKET;
	saddr = NULL;


	return self;
}

- (size_t)readNBytes: (size_t)size
	  intoBuffer: (char*)buf
{

Modified src/OFStream.m from [755dcbeaa4] to [6d62a21fd5].

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

@implementation OFStream
- init
{
	self = [super init];

	cache = NULL;
	cache_len = 0;

	return self;
}

- (size_t)readNBytes: (size_t)size
	  intoBuffer: (char*)buf
{







<







22
23
24
25
26
27
28

29
30
31
32
33
34
35

@implementation OFStream
- init
{
	self = [super init];

	cache = NULL;


	return self;
}

- (size_t)readNBytes: (size_t)size
	  intoBuffer: (char*)buf
{

Modified src/OFString.m from [dbcbcc49c8] to [5c5b9e51f6].

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
					   andArguments: args] autorelease];
}

- init
{
	[super init];

	length = 0;
	string = NULL;

	return self;
}

- (const char*)cString
{







<







51
52
53
54
55
56
57

58
59
60
61
62
63
64
					   andArguments: args] autorelease];
}

- init
{
	[super init];


	string = NULL;

	return self;
}

- (const char*)cString
{

Modified src/OFTCPSocket.m from [9556eafe3a] to [da3f38fa70].

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

- init
{
	self = [super init];

	sock = INVALID_SOCKET;
	saddr = NULL;
	saddr_len = 0;

	return self;
}

- (void)dealloc
{
	if (sock != INVALID_SOCKET)







<







30
31
32
33
34
35
36

37
38
39
40
41
42
43

- init
{
	self = [super init];

	sock = INVALID_SOCKET;
	saddr = NULL;


	return self;
}

- (void)dealloc
{
	if (sock != INVALID_SOCKET)

Modified src/OFThread.m from [f142cdc00e] to [28fabc1d44].

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#else
	if (!TlsSetValue(key->key, obj))
#endif
		/* FIXME: Maybe another exception would be better */
		@throw [OFInvalidArgumentException newWithClass: self
						    andSelector: _cmd];

	if (obj != nil)
		[obj retain];
	if (old != nil)
		[old release];

	return self;
}

+ (id)objectForTLSKey: (OFTLSKey*)key
{
	void *ret;







<
|
<
|







55
56
57
58
59
60
61

62

63
64
65
66
67
68
69
70
#else
	if (!TlsSetValue(key->key, obj))
#endif
		/* FIXME: Maybe another exception would be better */
		@throw [OFInvalidArgumentException newWithClass: self
						    andSelector: _cmd];


	[obj retain];

	[old release];

	return self;
}

+ (id)objectForTLSKey: (OFTLSKey*)key
{
	void *ret;