Overview
Context
Changes
Modified src/Makefile
from [82ad65dd42]
to [74096cf5ac].
︙ | | |
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
+
|
OFDataArray.m \
OFDictionary.m \
OFExceptions.m \
OFFile.m \
OFHashes.m \
OFIterator.m \
OFList.m \
OFMutableArray.m \
OFMutableString.m \
OFNumber.m \
OFObject.m \
${OFPLUGIN_M} \
OFSocket.m \
OFStream.m \
OFString.m \
|
︙ | | |
Modified src/OFArray.h
from [ec8ee2c449]
to [46dcbcf5e6].
︙ | | |
58
59
60
61
62
63
64
|
58
59
60
61
62
63
64
65
66
|
+
+
|
/**
* Removes the specified amount of object from the end of the OFDataArray.
*
* \param nobjects The number of objects to remove
*/
- removeNObjects: (size_t)nobjects;
@end
#import "OFMutableArray.h"
|
Modified src/OFArray.m
from [14d672c6d1]
to [f1d02c7bd0].
︙ | | |
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
-
+
|
#import "OFArray.h"
#import "OFExceptions.h"
@implementation OFArray
+ array
{
return [[[OFArray alloc] init] autorelease];
return [[[self alloc] init] autorelease];
}
- init
{
self = [super init];
@try {
|
︙ | | |
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
|
- (id)last
{
return *((OFObject**)[array last]);
}
- add: (OFObject*)obj
{
[array add: &obj];
[obj retain];
return self;
@throw [OFNotImplementedException newWithClass: isa
andSelector: _cmd];
}
- removeNObjects: (size_t)nobjects
{
OFObject **objs;
size_t len, i;
objs = [array data];
len = [array count];
if (nobjects > len)
@throw [OFOutOfRangeException newWithClass: isa];
@throw [OFNotImplementedException newWithClass: isa
andSelector: _cmd];
for (i = len - nobjects; i < len; i++)
[objs[i] release];
[array removeNItems: nobjects];
return self;
}
- (void)dealloc
{
OFObject **objs;
size_t len, i;
|
︙ | | |
Modified src/OFAutoreleasePool.m
from [c665c234c4]
to [81f708f0c4].
︙ | | |
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
-
+
|
[super dealloc];
}
- addToPool: (OFObject*)obj
{
if (objects == nil)
objects = [[OFArray alloc] init];
objects = [[OFMutableArray alloc] init];
[objects add: obj];
[obj release];
return self;
}
|
︙ | | |
Modified src/OFDataArray.h
from [de40862157]
to [1afd404279].
︙ | | |
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
-
-
-
-
-
-
-
-
-
|
* Creates a new OFDataArray whose items all have the same size.
*
* \param is The size of each element in the OFDataArray
* \return A new autoreleased OFDataArray
*/
+ dataArrayWithItemSize: (size_t)is;
/*
* Creates a new OFDataArray optimized for big arrays whose items all have the
* same size, which means memory is allocated in pages rather than in bytes.
*
* \param is The size of each element in the OFBigDataArray
* \return A new autoreleased OFBigDataArray
*/
+ bigDataArrayWithItemSize: (size_t)is;
/**
* Initializes an already allocated OFDataArray whose items all have the same
* size.
*
* \param is The size of each element in the OFDataArray
* \return An initialized OFDataArray
*/
|
︙ | | |
Modified src/OFDataArray.m
from [a8904a350c]
to [c1f4692477].
︙ | | |
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
-
+
-
-
-
-
-
|
static size_t lastpagebyte = 0;
extern int getpagesize(void);
@implementation OFDataArray
+ dataArrayWithItemSize: (size_t)is
{
return [[[OFDataArray alloc] initWithItemSize: is] autorelease];
return [[[self alloc] initWithItemSize: is] autorelease];
}
+ bigDataArrayWithItemSize: (size_t)is
{
return [[[OFBigDataArray alloc] initWithItemSize: is] autorelease];
}
- initWithItemSize: (size_t)is
{
Class c;
self = [super init];
|
︙ | | |
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
-
+
|
size = nsize;
return self;
}
- (id)copy
{
OFDataArray *new = [OFDataArray bigDataArrayWithItemSize: itemsize];
OFDataArray *new = [OFBigDataArray dataArrayWithItemSize: itemsize];
[new addNItems: count
fromCArray: data];
return new;
}
@end
|
Added src/OFMutableArray.h version [521f11b9ef].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008 - 2009
* Jonathan Schleifer <js@webkeks.org>
*
* All rights reserved.
*
* This file is part of libobjfw. 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.
*/
#import "OFArray.h"
/**
* The OFMutableArray class provides a class for storing, adding and removing
* objects in an array.
*/
@interface OFMutableArray: OFArray
@end
|
| | | | | | | | | | | | | | | | | |
Added src/OFMutableArray.m version [b08a16685b].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008 - 2009
* Jonathan Schleifer <js@webkeks.org>
*
* All rights reserved.
*
* This file is part of libobjfw. 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.
*/
#import "config.h"
#import "OFMutableArray.h"
#import "OFExceptions.h"
@implementation OFMutableArray
- add: (OFObject*)obj
{
[array add: &obj];
[obj retain];
return self;
}
- removeNObjects: (size_t)nobjects
{
OFObject **objs;
size_t len, i;
objs = [array data];
len = [array count];
if (nobjects > len)
@throw [OFOutOfRangeException newWithClass: isa];
for (i = len - nobjects; i < len; i++)
[objs[i] release];
[array removeNItems: nobjects];
return self;
}
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Modified src/OFString.m
from [0327728187]
to [1c15b5afa3].
︙ | | |
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
-
+
|
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFArray *array = nil;
const char *delim = [delimiter cString];
size_t delim_len = [delimiter length];
size_t i, last;
array = [OFArray array];
array = [OFMutableArray array];
for (i = 0, last = 0; i <= length; i++) {
if (OF_UNLIKELY(i == length ||
!memcmp(string + i, delim, delim_len))) {
OFString *str;
char *tmp;
|
︙ | | |
Modified tests/OFDataArray/OFDataArray.m
from [ebf9c80b5a]
to [156e55b3b9].
︙ | | |
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
-
+
-
+
|
TEST(OFDataArray)
puts("== TESTING OFBigArray ==");
TEST(OFBigDataArray)
pool = [[OFAutoreleasePool alloc] init];
x = [OFDataArray dataArrayWithItemSize: 1];
y = [OFDataArray bigDataArrayWithItemSize: 1];
y = [OFBigDataArray dataArrayWithItemSize: 1];
if (![x isEqual: y]) {
puts("FAIL 1!");
return 1;
}
if ([x hash] != [y hash]) {
puts("FAIL 2!");
return 1;
}
[x add: "x"];
if ([x isEqual: y]) {
puts("FAIL 3!");
return 1;
}
[pool releaseObjects];
x = [OFDataArray dataArrayWithItemSize: 2];
y = [OFDataArray bigDataArrayWithItemSize: 4];
y = [OFBigDataArray dataArrayWithItemSize: 4];
if ([x isEqual: y]) {
puts("FAIL 4!");
return 1;
}
[pool releaseObjects];
|
︙ | | |