ObjFW  Diff

Differences From Artifact [2e56b1156a]:

To Artifact [388224bcd6]:

  • File src/OFDataArray.m — part of check-in [526d04018d] at 2009-05-23 21:53:20 on branch trunk — A few renames.

    OFArray:
    * -[add:] to -[addObject:].
    * -[last] to -[lastObject].

    OFAutoreleasePool:
    * +[addToPool:] to +[addObjectToTopmostPool:].
    * -[addToPool:] to -[addObject:].

    OFDataArray:
    * -[add:] to -[addItem:].
    * -[last] to -[lastItem].

    OFObject:
    * -[addToMemoryPool:] to -[addItemToMemoryPool:]. (user: js, size: 4781) [annotate] [blame] [check-ins using]


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
	if (index >= count)
		@throw [OFOutOfRangeException newWithClass: isa];

	return data + index * itemsize;
}

- (void*)last
{
	return data + (count - 1) * itemsize;
}

- add: (void*)item
{
	if (SIZE_MAX - count < 1)
		@throw [OFOutOfRangeException newWithClass: isa];

	data = [self resizeMem: data
		      toNItems: count + 1
		      withSize: itemsize];







|




|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
	if (index >= count)
		@throw [OFOutOfRangeException newWithClass: isa];

	return data + index * itemsize;
}

- (void*)lastItem
{
	return data + (count - 1) * itemsize;
}

- addItem: (void*)item
{
	if (SIZE_MAX - count < 1)
		@throw [OFOutOfRangeException newWithClass: isa];

	data = [self resizeMem: data
		      toNItems: count + 1
		      withSize: itemsize];
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203

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

	return self;
}

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

	if (SIZE_MAX - count < 1 || count + 1 > SIZE_MAX / itemsize)
		@throw [OFOutOfRangeException newWithClass: isa];

	nsize = ((count + 1) * itemsize + lastpagebyte) & ~lastpagebyte;







|







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203

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

	return self;
}

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

	if (SIZE_MAX - count < 1 || count + 1 > SIZE_MAX / itemsize)
		@throw [OFOutOfRangeException newWithClass: isa];

	nsize = ((count + 1) * itemsize + lastpagebyte) & ~lastpagebyte;